method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6bfc6daf-9137-44d6-8426-64fe417e32c9 | 7 | private ArrayList<ToDoItem> getItems(String cat) {
List list = data.getChildren();
ArrayList<ToDoItem> listOfItems = new ArrayList<>();
Iterator iter = list.iterator();
while (iter.hasNext()) {
Element e = (Element) iter.next();
if (cat.equals("") || cat.equals(e.... |
abcc1b47-c906-4250-a004-618affc2d47f | 5 | public double cos(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return cos[a];
}else if(a <= 180){
return -cos[180 - a];
}else if(a <= 270){
return -cos[a - 180];
}else{
return cos[360 - a];
}
} |
9696a766-2755-476f-bb4f-bf033b8f6bad | 3 | private static List<String> parseSqls(List<Sql> sqls, boolean undo) {
List<String> result = new ArrayList<String>();
for (Sql sql : sqls) {
result.add(undo? sql.getUndoSql():sql.getDoSql());
}
if (undo) {
Collections.reverse(result);
}
return result;
} |
6b8ec614-4b8a-4706-b42d-1caeb8b13d1d | 0 | public NumberMessageShower(String message, IOnStringInput onStringInput) {
super(message,SYMBOL, onStringInput);
} |
88da2c48-0d24-41dd-a180-46188cc293c1 | 9 | public static String getWindowImg(String wnd, int pos) {
if (pos < 1)
pos = 1;
int imgPos = 0;
Widget root = UI.instance.root;
for (Widget wdg = root.child; wdg != null; wdg = wdg.next) {
if (wdg instanceof Window)
if (((Window) wdg).cap.text.equal... |
bca48d0b-9aec-4f29-9c88-5fbeedc371b1 | 2 | private void consoleInput(){
if(KeyHandler.isPressed(KeyHandler.ESCAPE))
isConsoleDisplayed = false;
else
consolePrint = KeyHandler.keyPressed(KeyHandler.ANYKEY, consolePrint);
if(KeyHandler.isPressed(KeyHandler.ENTER))
consoleCommands(consolePrint);
} |
de24c419-eed5-4730-93b0-fc37e4e87bac | 9 | @Override
public void copySources( HashMap<String, Source> srcMap )
{
if( srcMap == null )
return;
Set<String> keys = srcMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source source;
// Make sure the buffer m... |
930828db-f0ef-4dad-ab45-685cc0f735a3 | 4 | public static void updateUtilisateur(Utilisateur utilisateur) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from utilisateur where id_utilisateur=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, util... |
20659ffe-9bae-420b-baf4-b95ddf54b7f1 | 1 | @SuppressWarnings("unchecked")
public void saveMessage(HttpServletRequest request, String msg) {
List messages = (List) request.getSession().getAttribute(MESSAGES_KEY);
if (messages == null) {
messages = new ArrayList();
}
messages.add(msg);
request.getSession()... |
3053e20d-66d2-445b-8c00-02120201373a | 0 | public void setHasNegativeWeights(boolean hasNegativeWeights) {
this.hasNegativeWeights = hasNegativeWeights;
} |
3b3babb8-0f76-4872-a242-1bb7de0a0b8a | 8 | private void calcRowSizes(int[] rows, int size, int iterations, int mod)
{
zeroArray(rows, size);
for(int index = 0; index < size; index++)
{
if(index == 0 || index == size -1)
{
rows[index] = iterations;
}
else
{
... |
6de9f768-837e-4e87-80fa-24935a37b3f1 | 0 | public static void setLogLevel(Level newLevel) {
PropertyTree.logger.setLevel(newLevel);
PropertyTree.consoleHandler.setLevel(newLevel);
} |
6b76496e-1cef-4b14-9142-98f9b944fd47 | 0 | public PersonBean getPerson() {
return person;
} |
67fa76ed-dd96-46a3-a2ee-d954695c6e44 | 9 | public static IProtocalInfo getProtocalInfoType(String name) {
if (name.equalsIgnoreCase(ProtocolType.EJB.name())) {
return new EJBProtocalInfo();
} else if (name.equalsIgnoreCase(ProtocolType.WEBSERVICE.name())) {
return new WebServiceProtocalInfo();
} else if (name.equa... |
b1cd4a20-5ec3-489e-b13f-8a838de1b6a6 | 2 | public String getPopulationDetails(Field field)
{
StringBuffer buffer = new StringBuffer();
if(!countsValid) {
generateCounts(field);
}
for(Class key : counters.keySet()) {
Counter info = counters.get(key);
int stringLength = info.getName().length(... |
f1fb571d-e82c-4544-a1dd-444f57d0992a | 3 | public boolean equals(Object configuration) {
if (configuration == this)
return true;
try {
return super.equals(configuration)
&& myUnprocessedInput
.equals(((FSAConfiguration) configuration).myUnprocessedInput);
} catch (ClassCastException e) {
return false;
}
} |
4767e02f-e31d-49cd-9e9d-15e9c61728db | 1 | public void setDesignacao(String designacao) {
this.designacao = designacao.isEmpty() ? "sem designação" : designacao;
} |
9aaa7eee-0b6e-490a-b9da-90e204f8cabc | 1 | public void zoomIn(double mouseXCoord, double mouseYCoord)
{
zoomInConstant = 0.98;
if (visibleArea.getyLength() <= (quadTreeToDraw.getQuadTreeLength() / 5000))
{
return;
}
final double mouseMapXCoord = convertMouseXToMap(mouseXCoord);
final double mouseMapYCoord = convertMouseYToMap(mouseYCoord);
fin... |
bff6754a-772f-4236-b5a3-a2552089296d | 6 | public void host(int port) {
player1.setPos(4, HEIGHT / 2);
player2.setPos(WIDTH - 12, HEIGHT / 2);
hosting = true;
try {
serverSocket = new ServerSocket(port);
serverSocket.setSoTimeout(1000);
serverThread = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted... |
47961ed7-1cdd-46d1-bb16-3d39de74b2a8 | 7 | public UrinalStatus occupyUrinalVO( final int urinalPositionToOccupy ) {
UrinalStatus status = urinalVOs.get( urinalPositionToOccupy ).getStatus();
if( status == UrinalStatus.OCCUPIED )
return UrinalStatus.OCCUPIED;
else if( status == UrinalStatus.TRAPPED )
return UrinalStatus.TRAPPED;
else {
urinalVOs... |
cd2245b4-57ef-472a-953a-ca2c8f013386 | 1 | public static void copyTo(InputStream in, OutputStream out) throws IOException {
int c;
while ((c = in.read()) != -1)
out.write(c);
out.flush();
} |
c058d295-3ec1-4913-8a65-9d0fc62ae3da | 2 | public ArrayList<ArrayList<Card>> holeCardsCombinations() {
ArrayList<ArrayList<Card>> combinations = new ArrayList<ArrayList<Card>>();
for (int i = 0; i < cards.size(); i++) {
for (int j = i + 1; j < cards.size(); j++) {
ArrayList<Card> combination = new ArrayList<Card>();
combination.add(cards.get(i))... |
d6a0e9b7-95ab-473f-8c0b-1667aa841bb6 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof User)) return false;
User user = (User) o;
if (id != user.id) return false;
if (!email.equals(user.email)) return false;
if (!name.equals(user.name)) return false;
if (!password.equals(user.password)) return fals... |
bb7704d1-f698-439c-8cf6-80c40fa42418 | 3 | public static Connection getConnection() {
try {
driver = PropertiesReader.getValue("driver");
url = PropertiesReader.getValue("url");
user = PropertiesReader.getValue("user");
pwd = PropertiesReader.getValue("pwd");
} catch (Exception e) {
// TODO: handle exception
}
try {
// load driver
... |
3cc235dd-22c7-420f-8228-ee24fe2dc719 | 6 | public void handleAndSendReply(final BufferedInputStream in)
throws IOException {
// Peek at the reply id and tag.
in.mark(200);
final XMLInputFactory xif = XMLInputFactory.newInstance();
final String networkReplyId;
final boolean question;
try {
fi... |
6795c5ca-f753-4e24-8493-ccd47e60e143 | 8 | public static void main(String[] args) {
System.err.println("INDI for Java Basic Server initializing...");
int port = 7624;
for (int i = 0 ; i < args.length ; i++) {
String[] s = splitArgument(args[i]);
if (s[0].equals("-p")) {
try {
port = Integer.parseInt(s[1]);
} ... |
ce3848cd-9f80-4f99-b732-13de094730c6 | 5 | @Override
public void run()
{
try
{
this.init();
this.isRunning = true;
while(this.isRunning)
{
this.currentTime = System.currentTimeMillis();
if(this.currentTime-this.lastClockTime >= 1000L)
{
this.applet.showStatus("UPS: "+this.cups+" RPS: "+this.crps);
this.ups = this.cup... |
a884ed8c-f9ee-42ed-bbc5-4869f269db5e | 9 | public void update() {
KeyboardAdapter kba = KeyboardAdapter.getInstance();
int dx = 0;
int dy = 0;
if (kba.isPressed(KeyboardAdapter.KEY_NAME.UP)) {
dy -= speed;
}
if (kba.isPressed(KeyboardAdapter.KEY_NAME.DOWN)) {
dy += speed;
}
if (kba.isPressed(KeyboardAdapter.KEY_NAME.LEFT)) {
dx -= speed... |
cc1a1371-8c2b-4b44-97f8-4f88d47a15f6 | 3 | public static File renameFile(String srcFile, String destFile)
{
if (StringUtils.isBlank(srcFile) || StringUtils.isBlank(destFile))
{
return null;
}
File oldfile = new File(srcFile);
File newfile = new File(destFile);
if (oldfile.renameTo(newfile))
... |
a3b11009-c6b9-41e5-a67d-97e0dfa5a8d9 | 4 | private ArrayList<Models.DatabaseModel.Bill> findUserBill(int patientId, boolean outStanding) {
String query = "SELECT `bill`.`billId`, "
+ " `bill`.`patientId`, "
+ " `bill`.`dateCreated`, "
+ " `bill`.`datePaid`, "
+ " `bill`.`con... |
4f9ca9d2-31d9-4118-9391-a9ad0d71967f | 9 | * @param client
*/
private void cmd_set(final String arg, final Client client) {
final Player player = getPlayer(client);
final Room room = getRoom(player.getLocation());
MUDObject mobj;
// ex. @set here=header:======================
debug("SET: " + arg);
String[] args = arg.split("=", 2);
/... |
bbfddbb9-274f-46d5-8dab-136e7fd9b0e9 | 6 | public void stacksum(String[] split)// prints the total from each person of
// a person's stack
{
if (split.length != 2)
{
PrintMessage("Syntax:!score [player]");
return;
}
Player p = (Player) getPlayer(split[1]);
if (p == null)
{
PrintMessage(split[1] + " does not exist");
return;
}
for (... |
24f02258-88fc-405f-821e-97f284c60743 | 1 | public void pop() throws NotExistException {
if (amount != 0) {
head = head.next;
} else {
throw new NotExistException("Stack is empty!");
}
} |
feca589c-22bd-4bff-b502-c62cd3c0adfa | 8 | public static String countAndSay(int n) {
if (0 >= n) return "";
if (1 == n) return "1";
String str = "1";
for (int i = 0; i < n - 1; i++) {
int num = 1;
StringBuffer temp = new StringBuffer();
for (int j = 0; j < str.length(); j++) {
if (0 == j) {
if (s... |
ee895898-19c9-4244-8d1e-a5abad3bd8ee | 9 | private void saveSettings() {
String[] resolution = ((String) view.getCmbResolution().getSelectedItem()).split("x");
if (resolution.length == 2) {
settings.setWidth(Integer.parseInt(resolution[0]));
settings.setHeight(Integer.parseInt(resolution[1]));
} else {
log.fine("Bad resolution form... |
402efb96-3571-45ec-9909-6701305d62d0 | 9 | public int writeVarLong (long value, boolean optimizePositive) throws KryoException {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
int varInt = 0;
varInt = (int)(value & 0x7F);
value >>>= 7;
if (value == 0) {
writeByte(varInt);
return 1;
}
varInt |= 0x80;
varInt |= ((value & 0x... |
d654a4bc-01bd-4446-8055-ef48346f5233 | 3 | public static <T extends DC> Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> despatch(Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>> pair,
Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> sets)
{ if(pair==null)
... |
9e9680f9-45bb-4842-a603-439d9ded592a | 0 | @Override
public void setCivilState(String civilState) {
super.setCivilState(civilState);
}; |
6b1867dd-5144-4d7a-91cd-80c35901ef8a | 9 | private void drawCollection(Graphics2D g, Object collection, Class cls) {
ModelEntityAdapter adapter = modelAdapters.get(cls);
if (adapter == null) return;
if (collection instanceof Map) {
Map map = (Map)collection;
for (Object key: map.keySet()) {
Object obj = map.get(key);
ModelEntity en = (Model... |
797fca99-6460-4542-a1b6-52ff7b710c07 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Uitlening)) {
return false;
}
Uitlening other = (Uitlening) object;
if ((this.id == null && other.id != null) |... |
8ef77834-cb35-45f2-ac56-a02d359c981c | 4 | public String toString() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: toString() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: toString() END");
}
return "Coordinate(" + m_X + ", " + m_Y + ", " + m_Value + ")";
} |
b11dc2db-333b-43a4-8cbe-72922a5d59a4 | 6 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._var_ == oldChild)
{
setVar((PVar) newChild);
return;
}
if(this._aDe_ == oldChild)
{
s... |
3e70d994-7a92-4f7d-b76e-285d8ca8b357 | 2 | public String compareFiles(String filenameOK, String filenameOUT) throws FileNotFoundException {
Scanner sOK = new Scanner(new File(filenameOK));
Scanner sOUT = new Scanner(new File(filenameOUT));
while (sOUT.hasNext()) {
String s1 = sOK.nextLine();
String s2 = sOUT.next... |
005fd2bc-b7f7-423f-84b7-ddc98df2c69b | 7 | private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
60ca5a24-5f44-423b-a9f1-bd01492b27f5 | 4 | public boolean existeStation(Station s){
if(s == null) return false;
for(Station st : stations){
if(st != null) {
if(st.getNom().equals(s.getNom())){
return true;
}
}
}
return false;
} |
f514e592-5fb8-40de-a0a0-494c973e30f8 | 0 | public String getTypeName() {
return this.typeName;
} |
7703f4c2-3fed-423f-b398-85d5310161e3 | 5 | public boolean validationCategory (String chargeCategory) {
Statement statement = null;
try {
statement = connection.createStatement();
statement.execute("select category from categories");
ResultSet set = statement.getResultSet();
while(set.next()){
... |
b45d2750-c047-4bbb-9556-97f632c2de7c | 4 | void setExampleWidgetBackgroundImage () {
if (backgroundImageButton != null && backgroundImageButton.isDisposed()) return;
Control [] controls = getExampleControls ();
for (int i=0; i<controls.length; i++) {
controls [i].setBackgroundImage (backgroundImageButton.getSelection () ? instance.images[ControlExample... |
b9573bc5-6a7f-4925-b88e-f084cdf3b8e5 | 0 | @After
public void tearDown() {
} |
c9d226f3-a991-4057-a1b5-57d511e028aa | 9 | public void generate(Shell parentShell, IType objectClass) {
IMethod existingEquals = objectClass.getMethod("equals",
new String[] { "QObject;" });
IMethod existingHashCode = objectClass.getMethod("hashCode",
new String[0]);
Set excludedMethods = new HashSet();
... |
289a2b29-0c3b-4ffd-b7e7-1bcc957b8df3 | 6 | public static String reverseWords(String s) {
List<String> words = new ArrayList<String>();
int len = s.length();
StringBuffer res = new StringBuffer();
String word = null;
int begin = 0, end = 0;
for (int i = 0; i < len; i++) {
if (' ' == s.charAt(i)) {
if (end != begin) {
word = s.substring(be... |
765d5b2d-66b3-40db-b87e-e75632c806e1 | 6 | public static Set smallerSymbols(Grammar grammar) {
Set smaller = new HashSet();
Production[] prods = grammar.getProductions();
boolean added;
do {
added = false;
for (int i = 0; i < prods.length; i++) {
String left = prods[i].getLHS();
String right = prods[i].getRHS();
int rightLength = minim... |
1b7a8f5e-ea31-4014-a734-5920196065b2 | 8 | public BuscarItem() {
setLayout(new GridLayout(2,2));
aceptarBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Inventario.setStatusBarText("Se dispone a buscar una cadena!!!");
IServidorInventario servidor = ConexionServidor.getServidor();
String buscar = bu... |
fc7815e7-e6c4-4543-b829-6cf8cd570c4e | 9 | public int minCut(String s) {
int n = s.length();
int[] part = new int[n];
boolean[][] isPalindrome = new boolean[n][n];
//j as start index, i + 1 as length
for(int i = 0; i < n; i++) {
for(int j = 0; j < n - i; j++) {
if(i < 1)
isPalindrome... |
8a2b045c-6686-4d84-9e36-48926215e480 | 5 | private static void game() {
while (continueGame) {
listElements(); //Prints out the elements you have
String element1 = GuiMaster.getEnteredText();//inputs first element
if(elementValidize(element1)){ //checks first and second
String element2 = GuiMaster.getEnteredText();; //inputs second element
... |
c8545f08-3c20-4de3-b4fe-ea4dd2af66cd | 6 | public void upgradePawn(Point location, Piece newPiece)
{
if(!this.isOnBoard(location))
{
throw new AssertionError("This location: "+location+"isn't on the board");
}
if(!(newPiece instanceof Queen ||newPiece instanceof Rook ||newPiece instanceof Bishop||newPiece instanceof Knight))//if it isn't a queen,... |
e68594a9-a7c7-4cd7-8273-30dcf4bad79e | 3 | public boolean isOccupied(int x, int y){
for (int i = 0; i < mobs.size(); i++){
int occupiedX = mobs.get(i).getX();
int occupiedY = mobs.get(i).getY();
if (x == occupiedX && y == occupiedY){
return true;
}
}
return false;
} |
83d8eb80-f845-4e98-99fb-7a6fdf97de76 | 3 | @EventHandler
public void registerEconomyPlayer(PlayerJoinEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user == null)
return;
try {
if (economy.existsEconomyPlayer(player.getName()))
return;
economy.registerEcono... |
6863f7fe-2dec-4f86-9556-c5eb1b90e2e6 | 9 | private boolean isNumberStart() {
if (isEof()) {
return false;
}
int[] c = peek3();
if (isDigit(c[0]) || (c[0] == '.' && isDigit(c[1]))) {
return true;
}
if (c[0] == '+' || c[0] == '-') {
if (isDigit(c[1])) {
return tr... |
4a23cf51-1059-4227-a9b2-c2b42f863fd8 | 9 | public static double incrementPrice(double price) {
double newPrice;
if (price >= 100.0) {
newPrice = price + 10.0;
} else if (price >= 50.0) {
newPrice = price + 5.0;
} else if (price >= 30.0) {
newPrice = price + 2.0;
} else if (price >= 20.0... |
bca76874-a6c6-4864-9458-64e43ae69d16 | 0 | public static void main(String[] args) {
String input;
System.out.println("Enter the string ");
Scanner scan = new Scanner(System.in);
input = scan.nextLine();
System.out.println("Reversed word : " + reverseWord(input));
} |
929bd744-512f-4762-8221-1b404bb2bb81 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... |
b12271df-49a8-4b0e-a2ed-a194681f5693 | 1 | private void detectEnd(){
if(LogController.getConsumedLogs() >= endNum){
threadFlag = false;
}
} |
be8d905b-f3b8-4a20-a970-4490e585fc73 | 4 | public Double convert(Object object,Double defultValue,Object... args) throws HeraException{
if(object instanceof Integer){
return new IntegerDoubleConverter().convert((Integer)object, defultValue, args);
} else if(object instanceof Long){
return new LongDoubleConverter().convert((Long)object, defultValue, ... |
a6f4f041-8dd0-4161-849f-f5ad36df112c | 6 | protected void printParameter(String parentParameterFile,
String childParameterFile, ArrayList<_Doc> docList) {
System.out.println("printing parameter");
try {
System.out.println(parentParameterFile);
System.out.println(childParameterFile);
PrintWriter parentParaOut = new PrintWriter(new File(
pa... |
361bcc64-b441-4665-91bf-06cccee88e85 | 5 | public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value instanceof javax.swing.Icon) value = new JLabel((Icon) value);
if (value instanceof ZoomButtons) value=new DropButton((ZoomButtons)value);
((JComponent)value).... |
f961fc93-95ae-4af7-8e50-e64306472afc | 8 | public static Proposition buildTopLevelProposition(Stella_Object tree, boolean trueassertionP) {
if (Stella_Object.isaP(tree, Logic.SGT_STELLA_STRING_WRAPPER)) {
return (Logic.buildTopLevelProposition(Stella.readSExpressionFromString(((StringWrapper)(tree)).wrapperValue), trueassertionP));
}
{ Proposi... |
8dae2f23-ded9-4e35-bdd4-d64c9ebcf197 | 8 | public static <V> List<V> topologicalSort(final DirectedGraph<V> g) {
List<V> ts = new LinkedList<>();
int inDegree[] = new int[g.getNumberOfVertexes()];
Queue<V> q = new LinkedList<>();
int i = 0;
// for every vertex...
for (V vertex : g.getVertexList()) {
i... |
3ed41152-7ff9-44a5-8fd9-5c5dda67a8c7 | 2 | @Override
public void update(final Observable o, final Object arg) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
update(o, arg);
}
});
... |
50b0a31f-c49c-4f8d-923c-6cf3acda9ee2 | 8 | public void loadFromFiles() {
List<String> categories = Arrays.asList("pets", "futurama", "perl",
"smac", "starwars", "familyguy", "humorists", "computers", "linux", "goedel",
"art", "ascii-art", "cookie", "debian", "definitions", "drugs", "education",
"ethnic", "firefly", "food", "fortunes", "kids", "kn... |
5349efeb-1fc4-4723-bbf0-79ee7aefce9c | 4 | private static String convertToHex(byte[] data) {
StringBuilder buf = new StringBuilder(50);
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
... |
1e78c2f6-a827-4e2b-b3fe-de2c4a83e121 | 3 | static void LWS()
{
Scanner in = new Scanner(System.in);
final Board b = Board.readBoard(in);
ArrayList<Integer> nextPiece = new ArrayList<Integer>();
while(in.hasNextInt())
nextPiece.add(in.nextInt());
Heuristic hAll [] =
{
new LinearWeightedSum(new double[] {0.3,0.1,0.6,0.0,}),
new Line... |
9f7310fa-73a7-47af-bcf5-12731a0470d7 | 8 | @Override
public void encodeTerm(long[] longs, DataOutput out, FieldInfo fieldInfo, BlockTermState _state, boolean absolute) throws IOException {
IntBlockTermState state = (IntBlockTermState)_state;
if (absolute) {
lastState = emptyState;
}
longs[0] = state.docStartFP - lastState.docStartFP;
... |
551d188a-f27f-46d7-aab6-76eb066df066 | 0 | private static Thread createCommandManagerThread(PrintStream commandSender) {
CommandManager commandManager = new CommandManager(commandSender, verbose);
log.info("Create commandManager");
Thread commandManagerThread = new Thread(commandManager);
log.info("Create commandManagerThread");
return commandManagerT... |
ae7a9efa-1530-4b4d-b18e-a453e8a2c204 | 8 | private void computePositions() {
// Determine time for rendering
if (fConf.getInt("fixedTime") == 0) {
// No fixed time.
// final long lTimePassed = System.currentTimeMillis() - fsStartTime;
// fCurrentTime = fsStartTime + (long) (fConf.getDouble("timeWarpFactor") * lTimePassed);
fCurrentTime = System.... |
c1e8d8ae-281f-4b8e-8989-eebafe0dc948 | 7 | public static Filter createFilter(String command) {
// NYI: A filter with arguments.
command = command.trim();
int argIndex = command.indexOf(" ");
String name = null;
if (argIndex > 1) {
name = "filters." + command.substring(0, argIndex);
} else {
... |
5ad434b2-3960-4ad8-b280-fc7ec30df1c2 | 4 | @Override
public String getPayRecord(String mid) {
// TODO Auto-generated method stub
String payRecordInfo = "";
ArrayList<PayRecord> payRecords = new ArrayList<>();
String sql = "select * from payrecord where mid = \'" + mid + "\'";
try {
resultSet = statement.executeQuery(sql);
while (resultSet.nex... |
d26d02c8-87c8-4954-9212-80109da65caf | 3 | private boolean setColumnDividerHighlight(int x) {
int oldDividerIndex = mMouseOverColumnDivider;
int dividerIndex = mAllowColumnResize ? overColumnDivider(x) : -1;
setCursor(dividerIndex == -1 ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
mMouseOverColumnDivider = dividerIn... |
17d8c8b6-48a3-4662-876b-4ae22338a890 | 6 | private void addMainFunction(StringBuilder code){
// variables names:
final String luminance = "luminance";
final String feature = "feature";
final String heightColor = "h";
// function code:
String func = "void main(void){\n";
... |
d5bdb903-1ff1-4cfe-b862-593c9e56ea75 | 4 | public void loadAllStaff(){//COMPLETE
try {
ResultSet dbAllStaff = null;
Statement statement;
statement = connection.createStatement();
dbAllStaff = statement.executeQuery( "SELECT Staff.staffID, Staff.role FROM Staff;");
wh... |
f6b6e929-1aa0-49f4-9945-8e7098a35566 | 3 | @Override
public int compare(Quiz quiz1, Quiz quiz2) {
if (quiz1.raterNumber == 0)
return 1;
if (quiz2.raterNumber == 0)
return -1;
if (quiz1.totalRating / quiz1.raterNumber > quiz2.totalRating / quiz2.raterNumber)
return -1;
else
return 1;
} |
d2888a7c-b7a9-4f1e-89f1-cbd661be6797 | 2 | public boolean Salvar(Email obj, int idPessoa) {
try{
if(obj.getId() == 0){
PreparedStatement comando = banco.getConexao()
.prepareStatement("INSERT INTO emails (endereco,"
+ "id_pessoa,ativo) VALUES (?,?,?)");
... |
111f3416-55f3-4a19-ac7a-cbca847bb46f | 5 | public int[] getHitBox() {
if (isWalking) {
switch (getFacing()) {
case North:
return new int[] {trueX(), trueY(), trueX(), trueY() - 1};
case South:
return new int[] {trueX(), trueY(), trueX(), trueY() + 1};
case East:
return new int[] {trueX(), trueY(), trueX() + 1, trueY()};
case West:
... |
f7c71a20-74c6-42d5-b4b4-f5d37ad2fabe | 2 | public EncryptedCommunityCards listenForCommunityCards()
throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException, NoSuchAlgorithmException,
InvalidSubscriptionException, IOException, InterruptedException {
final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '"
+ COMMUNITY_CARD... |
52e2e580-e96b-49da-8865-3dbb23dd5cf2 | 3 | void assignToRow( Atom a ) throws Exception
{
if ( !addToExisting(a) )
{
Row r = new Row( sigla, groups, base );
// this will always be a nested row
r.setNested( this.nested() );
FragList fl = new FragList();
fl.setBase( a.versions.nextSetB... |
8523eac3-e4de-4bc3-9be0-2085ad8c4483 | 3 | public ArrayList<Point> getAllFreeSpots(){
ArrayList<Point> result = new ArrayList<Point>();
for(int x=0; x<level.length; x++){
for(int y=0; y<level[0].length; y++){
if(level[x][y] == null){
result.add(new Point(x, y));
}
}
}
return result;
} |
269c78c7-2523-4311-a7c9-42870e109475 | 9 | private boolean advanceRpts(PhrasePositions pp) throws IOException {
if (pp.rptGroup < 0) {
return true; // not a repeater
}
PhrasePositions[] rg = rptGroups[pp.rptGroup];
FixedBitSet bits = new FixedBitSet(rg.length); // for re-queuing after collisions are resolved
int k0 = pp.rptInd;
int... |
8c7f926a-145d-4df3-9be0-6940d29b0fa6 | 7 | public <T> T getProperty( String key, Class<T> type ) {
Object value = parsed.get( key );
if ( value != null ) {
try {
return type.cast( value );
} catch ( ClassCastException cce ) {
// fall through to ParseException below
}
} else {
try {
Method method = this.getClass().getMethod( "get" +... |
3bd2979d-551f-4222-8a48-75bcb0a19f63 | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
states[0] = monkeyDay(new GameState(state), card, false);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
... |
c9f544a9-555c-42e6-8802-a28ed2e07325 | 8 | public static String get(String ip, String comunidade, String objeto) throws Exception {
System.out.println("\nSNMP Get");
System.out.println("Objeto: " + objeto);
System.out.println("Comunidade: " + comunidade);
// Inicia sessaso SNMP
TransportMapping transport = new DefaultUdp... |
de1f564e-bbbc-4e55-ba96-ed0ddab68203 | 9 | @org.junit.Test
public void testLevels_Grey2JUL()
{
LEVEL[] levels = LEVEL.values();
for (int idx = 0; idx != levels.length; idx++)
{
LEVEL lvl = levels[idx];
java.util.logging.Level jul_lvl;
switch (lvl)
{
case OFF: jul_lvl = java.util.logging.Level.OFF; break;
case ALL: jul_lvl = java.util... |
81ccadab-44b3-47dc-aa06-bf5c47278b9b | 8 | public cell getCell(int x, int y){
cell hyperion = new conveyorCell();
switch(aamode){
case 1: hyperion = pete.culture[x][y];
case 2: for(int b = 0; b < gridy; b++){
for(int a = 0; a < gridx; a++){
if(x >= grid[a][b].xmin && y >= grid[a][b].ymin){
if(x <= grid[a][b].xm... |
e28c19e0-a418-4381-b256-d85c8671f423 | 9 | private String mygettoken() {
while (this.index < this.length){
char c = this.line.charAt(this.index);
if (this.flag) {
if (this.resky.indexOf(c) != -1) {
if (this.count > 0) {
String t = this.line.substring(this.start,this.... |
00bf0c28-b7f7-45b4-b095-0c24b9914c45 | 5 | @Test
public void testExecutionSuccess() throws ExecutionException {
IProcessComponent<Void> decoratedComponent = TestUtil.executionSuccessComponent(true);
IProcessComponent<Void> busyComponent = new BusyComponent(decoratedComponent);
AsyncComponent<Void> ac = new AsyncComponent<Void>(busyComponent);
Future<... |
7235dc34-fde7-492a-b919-9f793006eca2 | 9 | public boolean checkThatDatesSelected() {
String checkFromDate = this.fromDate.getText();
String checkTillDate = this.tillDate.getText();
Date frDate = null;
Date tiDate = null;
try {
tiDate = currentFormat.parse(checkTillDate);
} catch (ParseException e) {
... |
ec249163-305b-451a-ae38-ff7b19483b1e | 3 | public void run()
{
try
{
this.MPrioW.acquire();
if(this.counter == 0)
this.MReading.acquire();
this.counter++;
this.MPrioW.release();
this.MWriting.acquire();
System.out.println("Ecriture");
Thread.sleep(1000);
this.MWriting.release();
this.MPrioW.acquire();
this.co... |
e951b6ad-1a1b-401f-bbca-d0cd810d44e1 | 1 | private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... |
b78076a9-c75f-4127-b96b-c2adfdd88e65 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
Outliner.documents.addDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
setEnabled(false);
} |
608d82dd-6174-43f0-95aa-bd96db77667f | 9 | public void refreshGrid(Square[][] grid) {
if (grid != null) {
board = grid;
}
playerList.clear();
for (int j = 1; j < BOARD_SIZE - 1; j++) {
for (int k = 1; k < BOARD_SIZE - 1; k++) {
if (board[j][k].getPlayer() != null) {
if (!board[j][k].getPlayer().getName().contains("Enemy")) {
playerL... |
189d759a-2d84-40da-8077-2794c8858eec | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.