method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1aec81d5-6607-491d-af59-3a55ba8d798f
1
private void paintInfo(Graphics2D g2) { g2.setColor(Color.BLACK); int x = MARGIN_X; int y = WAVE_INFO_SPACE_TO_TOP; g2.drawString("Current WaveNr: " + enemyGroups.getCurrentGroupNr() + " Time to next Wave " + stringConverter((int) board.getCountdownToNextWave()), x, y)...
6e8d0624-0a9e-4bdd-ba25-2995848f873b
2
public void setPrivate(final boolean flag) { if (this.isDeleted) { final String s = "Cannot change a field once it has been marked " + "for deletion"; throw new IllegalStateException(s); } int mod = methodInfo.modifiers(); if (flag) { mod |= Modifiers.PRIVATE; } else { mod &= ~Modifiers.PRI...
8f6efc24-c642-4779-b387-e64c0a2fff27
2
int getScheduleFitness(Schedule s){ int scheduleFitness = 0; for (RoomScheme[] schedule : s.schedule) { for (RoomScheme sch: schedule) { scheduleFitness += sch.getFitness(); } } return scheduleFitness; }
c00b3065-2e6e-4e30-beb3-7ca57a0d1e14
7
private synchronized void resize(int newSizeColumns, int newSizeRows) { TerminalCharacter [][]newCharacterMap = new TerminalCharacter[newSizeRows][newSizeColumns]; for(int y = 0; y < newSizeRows; y++) for(int x = 0; x < newSizeColumns; x++) newCharacterMap[y][x] = new Ter...
56fcad2a-ad86-454a-b1b9-5c6ee3241a78
4
public void checkFields (LYNXsys system) { // check textfields method for (int i = 0; i < system.getUsers().size(); i++) { // loop through all users if (system.getUsers().get(i).getFirstName().equalsIgnoreCase(getFirstName().getTextField().getText()) && // if user exists (all fields match) system.getUsers().g...
32aad985-c6e8-4eff-a8c0-c2f28e72fdb8
7
private Map<CustomEnchantment, Integer> getValidEnchantments(ArrayList<ItemStack> items) { Map<CustomEnchantment, Integer> validEnchantments = new HashMap<CustomEnchantment, Integer>(); for (ItemStack item : items) { ItemMeta meta = item.getItemMeta(); if (meta == null) continue;...
10498d0c-727a-4c88-8d9d-f66000b64df9
1
public eOrientation getOrientation() { if (rdbHorizontal.isSelected()) { return eOrientation.Horizontal; } return eOrientation.Vertical; }
6b9ac680-d60a-41c5-b827-124d2c962e52
3
public boolean isHurdle(int positionX, int positionY) { boolean hasHurdle = false; for (int i = 0; i < hurdleFactory.getQuantityOfHurdles(); i++) { if (hurdleFactory.getHurdle(i).position.getX() == positionX && hurdleFactory.getHurdle(i).position.getY() == positionY) { hasHur...
848aec9a-0707-4bc5-9267-3e847841ef47
5
public void saveStats(GameState gameState) { queryLock.lock(); try { for (Player player: gameState.players) { if (player.username.equals("guest")) continue; String command = "UPDATE players " + "SET total_games = total_games + 1," + "num_kills = num_kills + ?," + "num_deaths = num_deaths +...
9012dc9e-7c3a-42dd-9f67-57d4c9ba13ec
9
public boolean checkValidate() { boolean coma = false, parallel = false, openTok_brace = false, first = true; int outNum = 0, inNum = 0; // while(lex.nextToken() != null) { while(!lex.End()) { lex.nextToken(); Token token = lex.currentToken(); ...
58f8a813-9a43-41dc-9afe-b22bde65a7cd
5
public static int checkField(int luaState, Object obj, String fieldName) throws LuaException { LuaState L = LuaStateFactory.getExistingState(luaState); synchronized (L) { Field field = null; Class objClass; if (obj instanceof Class) { objClass = (Class) obj; } ...
a6c03cb8-fcc6-4076-b7cd-eaaade572cdc
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder( ); int caso = 1; for(String line; (line = in.readLine())!=null; caso++){ if(line.equals("0 0")) break; StringTokenizer st = new StringTo...
a17a68a9-9ec5-47bf-a471-b902cfe25ef5
8
int zeller(final int year, final int month, final int day) { /* * 蔡勒(Zeller)公式: 用于推算某个日期为星期几 * * 仅适用于1582年10月5日以及之后 * 参考:格里高利历 * * w = ([c/4] - 2c + y + [y/4] + [13(m+1)/5] + d - 1) mod 7 * * c = (int) (year / 100) * y = y...
bdfa3c33-b415-4387-bda6-52ba667c0cdf
2
public void UpdateProjeto(Projeto projeto) throws SQLException, ExcecaoprojetoExistente { ProjetoDAO projetDAO = new ProjetoDAO(); Projeto projet = new Projeto(); projet = projetDAO.selectUmProjeto(projeto.getNome()); if (projet == null || projet.getIdProjeto() == projeto.getIdProjeto(...
026f2906-f75c-4bea-a670-0bd9e361441c
3
public void setFormula(String[] formula) { int dim = 1; if (formula != null) dim = formula.length; else formula = new String[] { "0" }; if (numSpinner != null) numSpinner.setCrt(dim); if (numField != null) numField.setText("" + dim); this.formula = formula; display(); }
503e26df-7feb-45e0-a416-e27bd6114138
0
private void updateObservers() { setChanged(); notifyObservers(); }
baa04540-f95d-4b23-b3dc-dbefb9c43057
9
public static <T, ID> MappedCreate<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) { StringBuilder sb = new StringBuilder(128); appendTableName(databaseType, sb, "INSERT INTO ", tableInfo.getTableName()); sb.append('('); int argFieldC = 0; int versionFieldTypeIndex = -1; // first we coun...
e51221e0-490a-41f6-b05e-3c99f9971898
6
public void var_read(String path) throws IOException { FileInputStream is = null; DataInputStream dis = null; try{ is = new FileInputStream(path); dis = new DataInputStream(new BufferedInputStream(is)); senones = (int)dis.readFloat(); gaussian = (int)dis.readFloat(); var = new float[senones][gaussi...
89995068-3822-40db-8ac1-5c2e06c303ed
5
@Override public AttributeValue getExampleAttributeValue(Example e) { int playerToken = e.getResult().currentTurn; int opponentToken = 3 - playerToken; int height = e.getBoard().height; // 6 int width = e.getBoard().width; // 7 int center = width / 2; int playerScore = 0; int opponentScore = 0; ...
a3dffa63-2ac9-45e2-8823-8485dbaa8b00
0
public int getSearchJumpLength() { _read.lock(); try { return _searchJumpLength; } finally { _read.unlock(); } }
138c7831-6b2e-4126-b918-2be846acdfb9
5
public int longestConsecutive(int[] num) { int result = 0; HashMap<Integer, Integer> h = new HashMap<Integer, Integer>(); //put all number into the hashmap for (int i = 0; i < num.length; i++) { h.put(num[i], null); } //check the longest consecutive list numb...
909bf100-1134-47b4-82d3-4a0fb4e05efc
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
70c32fe2-f2de-4aab-95e6-de1537729cb2
3
public int total() { int result = 0; String separator = ""; for (Object operando : operators) { if (operando != null) { System.out.print(separator + operando.toString()); if (operando.getClass().getSimpleName().equals("Summation")) { ...
51b56de8-31f9-4d5f-b3df-0c130e87b08e
0
public void setPositionName(String positionName) { this.positionName = positionName; }
56fb7e14-b80b-49ad-a485-c79c9838ec6b
8
private String decodePapPassword(byte[] encryptedPass, byte[] sharedSecret) throws RadiusException { if (encryptedPass == null || encryptedPass.length < 16) { // PAP passwords require at least 16 bytes logger.warn("invalid Radius packet: User-Password attribute with malformed PAP password, length = " ...
744ffa26-9187-45b8-a0d1-ad8676f3d6fa
0
//@Test(expected=ReaderException.class) public void testTooManyArgumentsFail() throws ReaderException { ConfigurationManager.init("src/test/resources/test.json"); // No key is given, the method should throw an error ConfigurationManager.read.getItem("test_2", "doesntexist"); }
8eaa4498-4c5a-4322-9a9b-a943962f5091
7
public void sort(int[] intArray,int left,int right){ System.out.println("您调用的算法:快速排序"); //设置关键字 int key=intArray[left]; int leftFlag=left; int rightFlag=right; int swapTemp; while(leftFlag != rightFlag){ //左移操作 while(intArray[rightFlag] >= key && rightFlag > 0) rightFlag--; swapTemp=intArray[...
b8c3f2d9-9848-4fa4-84f4-32a66399642d
0
public ButtonList() { super(); this.setLayout(new FlowLayout(FlowLayout.LEFT)); this.add(reset); this.add(output); this.add(help); }
4a7d8fc6-124b-4f5d-b5fd-5d07d6dc9e0c
1
public void moveUp() { if (y - v > 0) { y -= v; } else { y = 0; } }
0cb3143b-b431-4469-b9ea-50ba0180cb0c
7
public List<String> getmenuItemsCategory() { List<String> menuItemsCategory = new ArrayList<String>() { private static final long serialVersionUID = 3109256773218160485L; { try { //Connect to database conn = DriverManager.getConn...
1613b0e0-e777-4a44-ad41-ccaf7e64f912
6
@Override public boolean isQuestionAlreadyAnswered(String userId, Long qId) { try { pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(User.class, ":p.contains(userId)"); List<User> result = (List<User>) query.execute(userId); if (result.size() > 0) { List<Long> userActivity = result.g...
32bf02a2-a1f1-4418-8528-f077d559e2f0
7
@Override public void doMedianBlur() { if (imageManager.getBufferedImage() == null) return; WritableRaster raster = imageManager.getBufferedImage().getRaster(); double[][] newPixels = new double[raster.getWidth()][raster.getHeight()]; for (int x = 1; x < raster.getWidth() - 1; x++) { for (int y = 1; y < ras...
41ebeafe-3f78-4e41-b810-d5e9c2f29714
2
public void doClick(int btn, int mod) { if(!isActual()) return; if (UI.instance.mapview != null) { Coord sz = UI.instance.mapview.sz; Coord sc = new Coord((int) Math.round(Math.random() * 200 + sz.x / 2 - 100), (int) Math.round(Math.random() * 200 + sz.y / 2 - 100)); Coord oc = position(); UI....
c5928e3c-f3e8-476e-84a5-55dbbeaa93de
3
@SuppressWarnings("unchecked") @Override public void onResponseReceived(Request request, Response response) { if( response.getStatusCode() == HTTP_OK ) { try { JSONObject jsonObject = JSONParser.parseStrict(response.getText()).isObject(); if( jsonObject != null ) { callback.onSuccess((T)deseri...
81ab76bc-349c-4435-bc8e-8b2f4e68da5e
0
void move() { System.out.println("A goose is flying"); }
7efb6c95-79bb-420b-8e14-aa8c22d168c1
5
@Override public boolean connect(String host, int port) { log.fine("Connecting to:"+host+" on Port:"+port); if(side == Side.CLIENT) { if(SERVER != null) { disconnect(SERVER); try { SERVER.stop(); } catch(Throwable e) { e.printStackTrace(); } SERVER = null; } socket = new Co...
b7557829-1a96-4c3d-917f-9b03f14165d7
1
public boolean AIorPlayer(){ if (getHold()>21) AI=true; else AI=false; return AI; }
9b2c5e12-cef3-46a5-b9bd-8f57fdb11416
3
public void runAcceptor(){ while(!Thread.interrupted()){ Socket clientSocket; try { clientSocket = serverSocket.accept(); } catch (IOException e) { LOG.severe("Error while waiting for client-connection! " + e.getMessage()); brea...
9e5165f9-8937-4dbf-a199-4c8524141d0a
7
public int namespace(String title) throws IOException { // sanitise title = title.replace('_', ' '); if (!title.contains(":")) return MAIN_NAMESPACE; String namespace = title.substring(0, title.indexOf(':')); // all wiki namespace test if (namespace.equal...
1b4df9fa-568c-4244-92aa-883735370a8a
4
public void basicSetWorkout(Workout myWorkout) { if (this.workout != myWorkout) { if (myWorkout != null){ if (this.workout != myWorkout) { Workout oldworkout = this.workout; this.workout = myWorkout; if (oldworkout != null) oldworkout.unsetParcours(); } } } }
11015595-a7cf-4cef-9753-62936b82ab69
5
protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) { if (section instanceof MemorySection) { MemorySection sec = (MemorySection) section; for (Map.Entry<String, Object> entry : sec.map.entrySet()) { output.add(createPath(sectio...
994a7daf-4c57-4bf6-ae9e-37e040c8099e
1
public EquationsHard() { this.multiply = getRandomBool(); x = randomNumber(1, Game.getHardness().getMaxNumb()); y = x * randomNumber(1, Game.getHardness().getMaxNumb() / 2); // result * x = y; -> result = y / x; if (multiply) result = y / x; // resul...
73026d21-2055-43a7-ac8d-cf74885ce848
0
public int getRandomNumber(int min, int max) { return (int) Math.floor(Math.random() * (max - min + 1)) + min; }
b4c731f0-f3b2-4144-ab48-75da21d596e0
3
@Override public boolean equals(Object obj) { boolean res = false; if (obj instanceof TableEntry) { TableEntry other = (TableEntry) obj; if(other.tableName.equals(tableName)) { if(other.dbId.equals(dbId)) { res = true; } } } return res; }
5fd40753-e398-411d-b172-a5b866090605
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
08604bca-3c61-4b61-8508-90b10b2ae99f
9
protected static void formatTimeDifference(long diff, StringBuilder b){ //--Get Values int mili = (int) diff % 1000; long rest = diff / 1000; int sec = (int) rest % 60; rest = rest / 60; int min = (int) rest % 60; rest = rest / 60; int hr = (int) rest % 24; rest = rest / 24; int ...
d55a0fc2-7eb4-434f-bc36-c2aea110509d
3
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) { JCheckBox editor = null; filter = getFilterOut(value); if (filter != null) { node = (DefaultMutableTreeNode) value; editor = (JCheckBox) (super.getComponent()); ed...
8fb75ae6-349a-412f-a088-0df9d36ad7fd
2
public List<Venda> listarTodas() throws Exception{ try{ PreparedStatement comando = conexao .getConexao().prepareStatement("SELECT * FROM vendas WHERE ativo = 1"); ResultSet consulta = comando.executeQuery(); comando.getConnection().commit(); ...
431cdaa5-c0df-4966-a295-93d5ae254eca
4
public void insert(String table, ArrayList<String> fields, ArrayList<String> values) { if(fields != null) if(fields.size() != values.size()) throw new IllegalArgumentException("The number of fields and values must correspond."); String tableString = "`" + table + "`"; String fieldsString = fiel...
5401e3d2-4fb7-4312-8bb3-52bc91a703ee
0
protected Automaton getAutomaton() { return automaton; }
96addcbd-8316-42e5-a985-6a46c0b794ba
0
public Game() { board = new Board(2,4,4, new Random().nextInt(4), new Random().nextInt(4)); }
3d408474-5104-4f80-9f26-a80df6d8e9b9
9
private String checkType(Nodo chk){ String res=new String(); switch(chk.getToken()){ case Identificador: res+=this.genCode(Nodo.KindToken.ID,((Nodo)chk.getNodo().iterator().next()),chk.getDato()); break; case PalabraReservada: if(ch...
c9e6956c-6bad-4504-81be-68f8406f489f
7
public static boolean validCastle(int myXCoor, int myYCoor, int targXCoor, int targYCoor){ if (myYCoor != targYCoor) return false; else{ if (myXCoor < targXCoor){ for (int i = myXCoor+1;i<targXCoor;i++){ if ( !(board.isEmpty(i,myYCoor)) ){ return false; } } return true; } els...
e93d0eaa-28d4-4c4b-8c5e-668e8975ce13
0
public List<V> put(K key, List<V> value) { return this.map.put(key, value); }
893d2c87-c1f6-483e-aada-6f4f7ee38f84
8
protected void stepFWDCalc(boolean showSteps) { if (m_currentStep == 0) { m_btnSetOne.setEnabled(false); m_btnSetTwo.setEnabled(false); m_btnSetGapOne.setEnabled(false); m_btnSetGapTwo.setEnabled(false); m_btnPrev.setEnabled(true); m_btnBeginning.setEnabled(...
f5d94197-64f1-4c57-99de-b2af23dbdbcc
0
public static Dimension resizeToArea(int width, int height, long newArea) { double x1 = (double) width; double y1 = (double) height; double a1 = (double) (x1 * y1); double a2 = (double) newArea; double s = (float) Math.sqrt((a2/a1)); double x2 = x1 * s; double y2 = y1 * s; int newX = (int) Math.ro...
8bb7a562-bde4-4278-baa9-3677d428f8cc
6
public String GetCurrentLine(int pindex) { int tindex = pindex; if (pindex >= length) { tindex = length - 1; } while ((tindex > 0 )&& (iExpr.toCharArray()[tindex] != '\n')) { tindex--; } if (iExpr.toCharArray()[tindex] == '\n') { tinde...
10316186-f893-43c2-b2b3-f85d2a431b2c
3
public void pokupiPodatke() { if(rdbtnOracle.isSelected()) { tip = textField_Host.getText() + " - Oracle"; kon = new OracleKonekcija(textField_User.getText(), textField_Pass.getText(), textField_Host.getText(), textField_Port.getText(), textField_dbName.getText()); } else if(rdbtnPostgresql.isSelected()) ...
0f28d462-9ebe-4682-8807-799ef5e5e72f
4
public static void main(String[] args) { //first, let's populate the list of primes. int a = 0, b = 2; while (a < 1000) { if (isPrime(b)) some_primes[a++] = b; b++; } // -------------------------------------- // ...
9acb8f97-8523-431a-b039-9c2d02bead86
0
public ConvertPDAToGrammarAction(AutomatonEnvironment environment) { super(environment); }
8e20c90f-eff5-4ea2-95b7-0a704c193fc1
3
public void setDayBordersVisible(boolean dayBordersVisible) { this.dayBordersVisible = dayBordersVisible; if (initialized) { for (int x = 7; x < 49; x++) { if ("Windows".equals(UIManager.getLookAndFeel().getID())) { days[x].setContentAreaFilled(dayBordersV...
410b0c50-fcfa-479a-9835-6fd208c867b8
7
private void editorKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_editorKeyTyped if ((evt.isControlDown() && (evt.getKeyChar() == (char) 24 || evt.getKeyChar() == (char) 22)) || (!evt.isActionKey() && !evt.isControlDown() && !evt.isAltDown())) { updateLineNum(); if (saved) { s...
9b75155e-3da6-4617-93b9-25f803daf8e3
2
public int[][] getImagePixels(BufferedImage image) { int w = image.getWidth(null); int h = image.getHeight(null); int[] tmpPixels = new int[w * h]; image.getRGB(0, 0, w, h, tmpPixels, 0, w); int[][] pixels = new int[w][h]; for(int y = 0; y < h; y++) { ...
9ced510a-7270-4c0d-b3de-1b33ccc124fc
1
public void setResolution(Dimension res) { this.res = res; if (res != null) resolution.setText(res.width+"x"+res.height); else resolution.setText(" "); }
4cbbb6ee-ba7e-48e0-b16a-9ac2515a7b12
4
public static Direction getByMovement(int xa, int ya) { if (xa < 0) return LEFT; if (xa > 0) return RIGHT; if (ya < 0) return UP; if (ya > 0) return DOWN; return NONE; }
d50668bd-7fa0-483a-972f-eb102f0759ec
7
private boolean checkIsCreate(String stype, GameDescription game, ArrayList<SpriteData> allSprites){ for(SpriteData sprite:allSprites){ if(spawnerTypes.contains(sprite.type) && sprite.sprites.contains(stype)){ return true; } for(SpriteData sprite2:allSprites){ ArrayList<InteractionData> data = ga...
9f85e276-4a4d-4b98-8539-ec9d8100d203
8
private void selectFire() { squareSelector.reset(); squareSelector.setCriteria(new SquareCriteria() { private final String desc = "Select: Fire"; public String getDescription() { return desc; } public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) { if ( roomId < 0 |...
68b39108-1879-490b-94df-813527f55b41
2
public ResultSet searchEngineInfo(String patient_info){ try{ if(Helper.isInteger(patient_info)){ String testRecordQuery = "SELECT p.name, p.health_care_no, t.patient_no, t.employee_no, " + "t.test_id, t.type_id, tt.type_id, tt.test_name, t.test_date, t.result " + "FROM patient p, test_record t, te...
441cc1e2-c3e8-4ccd-be6d-7e87cf6b8b91
0
public void setId(Integer id) { this.id = id; }
b545c677-b93c-4f5e-bd3f-75d0227ba959
0
private boolean isValidInput(final String s) { return s.matches("[1-9]{1}"); }
bd795372-eff6-4a82-bba2-6f45960021c2
6
public static MultiSearcher wrapSearcher(final Searcher s, final int edge) throws IOException { // we can't put deleted docs before the nested reader, because // it will through off the docIds Searcher[] searchers = new Searcher[] { edge < 0 ? s : new IndexSearcher(makeEmptyIndex(0), true), ...
04c0cb66-b429-4093-97b1-b29dfd8a1437
1
public void addPatient(Patient newPatient) { if (this.nextPatient == null) { this.nextPatient = newPatient; } else { this.nextPatient.addPatient(newPatient); } }
8f7adc1e-5023-42a6-975b-3d29a69b1ba3
2
public void Eliminar(String pArchivo) throws Exception { try { //Se elimina el archivo File fichero = new File(pArchivo); if (!fichero.delete()) //Si no encuentra el archivo se muestra la excepcion throw ...
e3ace7c3-4b15-4aa0-bdb8-2154f280fea0
3
public boolean authenticate(String email, String hash) { initConnection(); //Check password matches for given email String preparedString = null; PreparedStatement preparedQuery = null; try { //Prepare Statement preparedString = "SELECT email,password FROM users WHERE email = ? AND password = ?;...
701dcd8e-fa77-43bd-a6f8-25d571b61205
9
boolean showDialog(final ImagePlus imp, final String[] list) { final int fileCount = list.length; String name = imp.getTitle(); if (name.length() > 4 && (name.substring(name.length() - 4, name.length())) .equalsIgnoreCase(".tif")) { name = name.substring(0, name.length() - 4); } int i = name.leng...
0d36b247-d1b6-4955-9712-38f53240f26c
6
public Object tooltip(Coord c, boolean again) { long now = System.currentTimeMillis(); if (!again) hoverstart = now; if ((now - hoverstart) < 1000) { if (shorttip == null) { String tip = shrtTip(); if (tip == null) return null; shorttip = RichText.render(tip, 200); } return (shorttip); }...
4877fee5-9d4f-4a02-8db1-0a315f028c0e
0
public SharedTorrent getTorrent() { return this.torrent; }
33403fb1-d5cc-4dd2-b50a-6982e9fe8838
1
static List<String> splitCSVLine(List<String> buf, String line){ Stream.of(line.split(";")).map(String::trim).forEach(buf::add); if (line.endsWith(";")) { buf.add(""); } return buf; }
4f7c5ac6-85cd-4280-a30e-6618ed4c2591
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, Case__typeInfo)) { ...
4dd59020-5e2c-4757-ac87-ad12f6599900
6
@Override protected void onReceive(String message) { System.out.println("Received message: \"" + message + "\""); Message msg = Message.parse(message); switch(msg.getType()) { case ID_RESPONSE: //TODO handle id break; case SPAWN: //TODO spawn entity break; case DESPAWN: //TODO despaw...
edc3e3e2-4395-4ba9-bfb7-5a00f7a78fa2
6
@Override public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) { if (args.length <= 1) { return false; } final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]); if (player == null) { ...
9b7d2874-0d10-4562-b2d3-20cf00cb043e
8
@Override public List<AssemblyLine> generate(Context context) { final List<AssemblyLine> lines = Lists.newLinkedList(); if (Compiler.debug) { lines.add(new Comment("Start condition term")); } if (children.size() == 1) { context.set...
9b96ca0e-faa9-440e-b2ae-c873dedfb02b
1
@RequestMapping(value = "/event-branch-room-event-list/{eventBranchId}", method = RequestMethod.GET) @ResponseBody public RoomEventListResponse eventBranchRoomEventList( @PathVariable(value = "eventBranchId") final String eventBranchIdStr ) { Boolean success = true; String errorM...
7a718a63-d859-4a7c-b9ab-5b41c85277f9
9
public static void chplft_draw_bg(osd_bitmap bitmap, int priority) { int sx, sy, offs; int choplifter_scroll_x_on = (system1_scrollx_ram.read(0) == 0xE5 && system1_scrollx_ram.read(1) == 0xFF) ? 0 : 1; if (priority == -1) { /* optimized far background */ /* for every ch...
e277f62b-b6a6-4da9-89a9-236c2a3d5597
8
public static void displayURL(String url) { if (url == null || url.length() == 0) { url = "http://www.google.com"; } boolean windows = isWindowsPlatform(); String cmd = null; try { if (windows) { // cmd = 'rundll32 url.dll,FileProtocolHandler http://...' /* * Rundll32 doesn't like ....
623a32fd-622c-4c6f-87da-481380ab638c
3
@Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); for(int row = 0; row < getRowSize(); row++) { for(int column = 0; column < getColumnSize(); column++) { Integer move = getMoveAt(row, column); String ...
b7888123-f5f3-4dbf-aaed-342b6fb29ee2
0
public static ComponentUI createUI(JComponent c) { return new MetalScrollBarUI(); }
c4bb7e57-3590-4809-8327-527d0a7179e3
6
public static boolean isSpecialTrainer(Trainer t) { switch(t.type) { case JAVA: if(t.name.equals("BOSS")) return true; else return false; case BABB: case ELITE: case GYM_LEADER: case RIVAL: return true; default: return false; } }
8bf5f447-cdf3-4dd5-870c-d53f9ed8a99a
1
public boolean smartClick(){ boolean isClicked=isEnabled(); if(isClicked){ click(); } return isClicked; }
e6aa6bb0-34da-417e-beba-a662cd22dee2
6
public void removeAll() { for (int i = 0; i < items.size(); i++) { items.remove(i); } for (int i = 0; i < backgroundParticles.size(); i++) { backgroundParticles.remove(i); } for (int i = 0; i < entities.size(); i++) { entities.remove(i); } for (int i = 0; i < projectiles.size(); i++) { pro...
c5d9a24f-3125-47ea-874c-6c70c83ac1d7
4
public String getType() { if (this instanceof ItemCoupon) return "Item"; if (this instanceof EconomyCoupon) return "Economy"; if (this instanceof RankCoupon) return "Rank"; if (this instanceof XpCoupon) return "Xp"; else return null; }
ebd375a8-c78b-4188-bc4c-d3652e8ea1b1
7
public void calcPhaseDeviation() { // saves the result of the FFT in an object that contains the spectrum, // real and imaginary part. FFTComponents components = this.nextPhase(); double[] phase = new double[components.real.length]; double[] previousPhase = new double[components.real.length]; double[] anteP...
10b9505c-d69a-477a-9260-6b00b318cdc6
9
@Override public void update(Observable o, Object value) { if (o instanceof RecordManager) { updateLastNames(RecordManager.getInstance().getUniqueLastNames()); final GivingRecord selectedRecord = RecordManager.getInstance().getSelectedRecord(); if (selectedRec...
84ba6aef-005c-48a9-b9ef-f2d1050f3c4c
3
private static String loadSiteUID(){ String uid = DEFAULT_SITE_USER_ID; try{ FileInputStream fis = new FileInputStream(workingDir + SITE_UID_FILE_NAME); try{ BufferedReader reader = new BufferedReader(new InputStreamReader(fis)); try { uid = reader.readLine(); } catch (IOException e) ...
4a7fb4fc-9e64-4657-a30d-bfe8a869cc2f
6
public void run(){ // If we have a list of replies from a previous repetition // calculate suspected processes if (lastHeartbeat != 0) { for(int i = 0; i <= p.getNo(); i++) { if (i != 0 && i != p.pid) { if (!successfulReplies[i-1] && !suspectedProcesses[i-1]) { ...
537749a7-0a4a-4ec4-9a99-1b181f1e884d
3
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // totaal hoeveelheid van alle kleuren int total = 0; int startAngle = 0; int arcAngle = 0; for (Color color: stats.keySet()) { // teller van alle kleuren worden bij elkaar opgeteld total += stats.get(color).getCount...
014d0363-8392-4af6-86aa-dbd41b0cc19e
4
private ConcatExpr parseConcatExpr(Vector<String> tokens, int lo, int hi) { ConcatExpr expr = new ConcatExpr(); for (int i = lo; i < hi; i++) { String v = tokens.get(i); if (v.length() >= 2 && v.charAt(0) == '<' && v.charAt(v.length() - 1) == '>') { expr.addItem(v.substring(1, v.length() - 1...
41e7c0d3-26b7-44fc-8202-5fe741b6bcee
3
public RealDistribution realisedDemand(int t, int k) throws ConvolutionNotDefinedException{ //check if k is lower or equal than t-l_max, then all orders will be open if (k <= t-getMaxOrderLeadTime()) return new RealSinglePointDistribution(0.0); //check if k is bigger than t, then all orders will be realised ...
9af07b59-2a04-473e-a9a3-bdb260c29b8a
5
Message getMessage(double x, double y) { Message result = null; for (Edge edge : edges) for (Message message : edge.queue.getMessages()) { if (message.isOnPoint(x, y) && (result == null || message.position < result.position)) result...
7859011a-60bd-4a46-9261-202675c0e6dd
1
private static int getAttribute(Node node, String attribname, int def) { final String attr = getAttributeValue(node, attribname); if (attr != null) { return Integer.parseInt(attr); } else { return def; } }