method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c00f46e5-0279-41bc-9f23-dd439bd5bfa1
8
@Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; for (int i = 0; i < pills.size(); i++) { pills.get(i).paintObj(g, this); } for (int j = 0; j < bullets.size(); j++) { bullets.get(j).paintObj(g...
00f54e70-d2cf-48d9-9f9d-86c706aff250
5
public static void main(String[] args) throws Exception { // The Firefox driver supports javascript WebDriver driver = new FirefoxDriver(); File jsonPlayers = new File("/u/jeremiah/players.txt"); Scanner lookAtFile = new Scanner(jsonPlayers); JSONObject playerNam...
ee597771-e85d-4f75-b6d7-3cf00092d371
4
public boolean isResponse() { if (opcode == PING_RESPONSE.toByte() || opcode == STORE_RESPONSE.toByte() || opcode == FIND_NODE_RESPONSE.toByte() || opcode == FIND_VALUE_RESPONSE.toByte() ) return true; else return ...
24072326-63ed-4ca5-b3ee-498a9fa79e43
1
public void checkspaceleft() { File file2 = new File("/Users/"); if(file2.getUsableSpace()<1000) { JOptionPane.showMessageDialog(null,"Please increase the amount of memory in your hard disk in order for this program to function.", "Tim...
8f536765-159e-465b-a64b-3ffebf53c78c
3
private String shaderTypeString(int type) { if (type == FRAGMENT_SHADER) return "FRAGMENT_SHADER"; else if (type == VERTEX_SHADER) return "VERTEX_SHADER"; else if (type == GL32.GL_GEOMETRY_SHADER) return "GEOMETRY_SHADER"; else return "shad...
316bc516-af10-45bb-80eb-ef057edcb4ad
8
public MessagePasser(String configuration_filename, String local_name){ //parse configuration_filename and setup sockets for communicating with all processes // listed in the configuration section of the file //initialize buffers to hold incoming and outgoing messages to the rest of the nodes in the system ...
c54ae619-90d4-40f5-b409-2c30a806479c
0
@Override public void setGUITreeComponentID(String id) {this.id = id;}
570e31de-2a43-49ca-a1a8-1f4582dd3bee
0
@Override public void dollarDetected(Dollar dollar) { gestureName = dollar.getName(); System.out.println(gestureName); gestureOk = dollar.getScore() > 0.80; }
d3d9bb13-33ed-4cc4-988b-6f0a8aaa603a
0
public void setAuthenticatorClient(byte[] authenticatorClient) { this.authenticatorClient = authenticatorClient; }
771cd359-6f62-47bc-bb02-dea3318c394c
2
public Object opt(int index) { return (index < 0 || index >= length()) ? null : this.myArrayList.get(index); }
af33d0be-00b6-475a-849d-999e32b73290
8
@Override public boolean equals(Object o) { if(o == null) return false; if(!(o instanceof StuecklisteDTO)) return false; StuecklisteDTO stl = (StuecklisteDTO)o; if(!stl.getBauteil().equals(this.getBauteil())) return false; if(!stl.getGu...
05c2562f-db67-4cf7-8849-33c71f790c0d
4
public Example() { HttpClient client = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://hc.apache.org/httpclient-3.x/dependencies.html"); HttpResponse response; try { response = client.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { //InputStream i...
4b79bdaa-dd8d-41e8-8a0e-906eccfbaa13
5
public String getStraightFlush() { String stt = "0"; //if the straight and flush are not computed yet, do it know (subsequent calls will probably follow) this.straight = (this.straight == null) ? getStraight() : this.straight; this.flush = (this.flush == null) ? getFlush() : this.fl...
32f33ebd-69fa-4222-bdd1-684f0be6ef94
6
@Override public 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 despawn e...
1c1fc992-381f-4bec-95f1-ec7bf29d5cc1
5
@Override public void run() { try { while (poweredOn && programCounter.getValue() < memory.length){ Thread.sleep(1000 / frequency); if (liveMode || isSteppable()) nextOperation(); } } catch (Exception e) { e.printStackTrace(); poweredOn = false; } }
54e98435-de98-4b33-8fdc-5363cf29f7a9
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
c0e6f9f4-94bb-4509-bee4-65ec924c6986
0
public void setTool(Tool tool) {this.tool = tool;}
111d39e3-4989-4150-8b67-6a2292ea05b6
8
public void doRun(int run) throws Exception { if (m_ResultProducer == null) { throw new Exception("No ResultProducer set"); } if (m_ResultListener == null) { throw new Exception("No ResultListener set"); } if (m_Instances == null) { throw new Exception("No Instances set"); } ...
fb3e7732-24b5-4469-a50a-f67bba5da50d
4
public void sendMessage (String message) { // Do nothing if a player tries to chat before registering a name. if (this.name == null) return; // Do nothing if the chat message is invalid. if (message == null) return; message = message.trim(); if (message.length() == 0) return; // Prepend the player'...
a399ca2e-c12c-4730-a447-1602ab913e96
8
boolean hasProperty(long i) { int[] numbers = Problem30.getNumbers(i); if (numbers[5] != 5 && numbers[5] != 0) { return false; } if (numbers[3] % 2 != 0) { return false; } if ((numbers[2] + numbers[3] + numbers[4]) % 3 != 0) { return false; } if ((numbers[4] * 100 + numbers[5] * 10 + numbers[6]...
0974e761-80c6-4a80-9779-028391eeb3fe
4
@Override public Double get(int index) { switch(index) { case 0: return x; case 1: return y; case 2: return z; case 3: return w; default: throw new IndexOutOfBoundsException(); } }
87f67851-ebcf-4b4b-8d16-a44722ffd99c
1
private void handleJoinGame(PlayerJoinGamePacket packet) { client.addMessage(packet.name + " has joined the game"); ClientPlayer player; if (packet.name.equals(getName())) { player = me; state = State.PLAYING; } else { player = new ClientPlayer(this, packet.name); } player.setType(packet.type); ...
7cd1cc46-76b8-4f0d-a15c-159412933d1f
7
@Override public boolean inTarget() { return inSituationRecord || inLatitude || inLongitude || inCarParkIdentity || inCarParkOccupancy || inCarParkStatus || inOccupiedSpaces || inTotalCapacity; }
d883079d-a7bc-4adb-86f7-39bf776b05fd
0
public void setSkillId(int skillId) { this.skillId = skillId; }
d28c4956-a09b-472e-b53b-be3be593b1ca
2
public void addGenotype(String vcfGenotypeStr) { if (vcfGenotypes == null) vcfGenotypes = new ArrayList<VcfGenotype>(); if (format == null) format = ""; vcfGenotypes.add(new VcfGenotype(this, format, vcfGenotypeStr)); }
1d4001e6-804b-46ea-9a3c-13602a3f3f39
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Position other = (Position) obj; return this.x == other.x && this.y == other.y; }
9b644818-9bf1-4355-be19-f5f3e210873b
7
public void renderPreview(ShapeRenderer shapeRenderer) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_COLOR); shapeRenderer.begin(); for (int face = 0; face < 6; ++face) { if (face == 0) { shapeRenderer.normal(0F, 1F, 0F); ...
1261de99-49d6-4daf-a1fb-718ab94c0a15
2
@Override public BusinessAcademy deleteAcademy(String nameId) { for (BusinessAcademy academy : academys) { if (academy.getName().equals(nameId)) { academys.remove(academy); return academy; } } return null; }
02c18f67-3110-4a80-8f84-7387f0c2fa04
8
private void regulateKeys() { if(nyckellyssnare.getEsc()) { System.exit(1); } if(nyckellyssnare.getR()) { restart = true; } if(nyckellyssnare.getP()) { pause = true; } if(nyckellyssnare.getPlus()) ...
9a65031f-c315-4487-821d-6f4f042589cd
5
private boolean parse(String command) { StringTokenizer tokens = new StringTokenizer(command, Utils.SEPARATOR); if (tokens.countTokens() != 2) return false; String process = tokens.nextToken(); if (! r.contains(process)) return false; String action = tokens.nextToken(); if (! (action.equals("ON") || a...
c52c64ce-f41e-4fe2-94c4-d76a349908ce
2
public void move(Direction dir) { if(!isPerformingAction()) { Tile targetTile = level.getTile(tile, dir); if(targetTile.canEnter(this)) { setCurrentAction(Action.MOVE); facingDirection = dir; moveDirection = dir; moveToTile = targetTile; tile.onLeaving(this); onLeaving(tile); moveToT...
929eded4-9630-4ed1-b775-3819a0ec8a40
2
public boolean isPrimitive() { return !isReference() && !isMethod() && !isVoid(); }
d9d8b7a6-f21b-449b-9443-59994919b985
1
public void emptyHistory(){ for (int i = 0; i < MAX_NUMBER_OF_STEPS; i++){ history[i].emptyField(); } }
4b37465b-a36b-4548-8911-67648fcee523
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BoardVO other = (BoardVO) obj; if (bo_no == null) { if (other.bo_no != null) return false; } else if (!bo_no.equals(other.bo_no)) ret...
148dd2db-5fcb-440c-84f6-fe23e22884ba
0
public void setIdDetalle(int idDetalle) { this.idDetalle = idDetalle; }
692b05d1-5da9-4b46-a682-b7dcb06091b0
3
@Override public mxICell removeEdge(mxICell edge, boolean isOutgoing) { if (edge != null) { if (edge.getTerminal(!isOutgoing) != this && edges != null) { edges.remove(edge); } edge.setTerminal(null, isOutgoing); } return edge; }
352409d5-fe0c-471e-8d93-ed4d545ea7a7
7
public int crearEnunciado(Enunciado en) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; String des = en.getEnunciado().replace("\\", "\\\\"); if (en.getDespuesDe().getCodigo() != 0) { consulta = "IN...
6db95190-6dbf-4498-b9d3-eee6f22d3112
4
public void WGDonate(String channel, User user, Game game, Command command) { if(user.hasUnsetWords()) { if(command.arguments.length == 2) { User recipient = getUserByNick(game, command.arguments[1]); if(recipient == null) { sendMessageWrapper(chan...
4a448021-35ad-427b-8b25-23ac64fa198f
0
public int [] getTopLeft () { return topLeft; }
0d10c030-49e8-43b8-9227-53dfc690de2a
4
public void run(int numIterations) throws IOException, RemoteException { engine.setEnableScheduler(true); int memoryBudget = 1200; if (System.getProperty("membudget") != null) memoryBudget = Integer.parseInt(System.getProperty("membudget")); engine.setMemoryBudgetMb(memoryBudget); ...
022df556-df99-46f8-b76d-3fc85485e70e
4
protected void wash() throws InterruptedException { myMachine.setLock(true); myWaterController.putEvent(new WaterEvent(this, WaterEvent.WATER_DRAIN, 0d)); mailbox.doFetch(); myWaterController.putEvent(new WaterEvent(this, WaterEvent.WATER_FILL, 0.5d)); mailbox.doFetch(); myWa...
a0cd108a-d5cb-4597-994e-89409e5d584d
3
@Override public synchronized void run() { while(true) { if (getSocket() == null) { try { this.wait(); } catch (InterruptedException ignored) { } } ByteBuffer buffer = ByteBuffer.allocat...
a2e3fb5f-408a-496b-8963-a2abb7534bfd
1
@Override public void performAction() { if(!started) { performActionStartup(); } else { manaCrystal.setState(State.PERFORMING_ACTION); Collector collector = (Collector)unit; collector.setMana(initialAmount + (System.nanoTime() - this.getStartTime()) / (double)time); } }
2ebf88c9-c2b0-4ab7-93d2-1d2f4af428a9
5
public String getJavaName() { /* * Don't load attributes for class names not containing a dollar sign. */ if (name.indexOf('$') == -1) return getName(); if (getOuterClasses() != null) { int last = outerClasses.length - 1; StringBuffer sb = new StringBuffer( outerClasses[last].outer != null ? o...
0dfba21d-1941-41a0-991a-237cfe2f2b93
1
public boolean noChildren() { if(children == null) return true; else return false; }
fb3181d5-10c1-4f04-83e5-dffb7f56d1c4
2
private void whileStatement_rest() throws Exception { BasicBlock oldCurrent = currentBB; BasicBlock oldJoin = currentJoinBlock; BasicBlock loopHeader = new LoopHeader(oldCurrent); // the previous basic block will fall through to the header oldCurrent.setFallThrough(loopHeader...
aa5815a0-4ca9-46b6-961c-921dfbc2f4df
0
public void popFrameRunTimeStack() { runStack.popFrame(); }
0a463a7f-01a1-4ae5-8364-bd4f365ef565
1
@Override public void draw(Graphics g) { if (!catched) { Rectangle masse = getAbsoluteRect(); g.setColor(Color.cyan); g.fillOval( (int)masse.getX(), (int)masse.getY(), (int)masse.getWidth(), (int)masse.getHeight()); } }
3bcd58b3-de62-4b72-87f2-dbfbe5b8adc7
1
public Value getLocal(final int i) throws IndexOutOfBoundsException { if (i >= locals) { throw new IndexOutOfBoundsException( "Trying to access an inexistant local variable"); } return values[i]; }
15193883-13d0-4968-a2df-c0246ee98b33
9
public int[][] parseHCP() { boolean success = false; // Keep trying if file not found while (!success) { System.out.print("Enter filename (or 000 to exit): "); this.file = in.nextLine(); if (file.trim().equals("000")) { System.out.println("Program Terminated"); System.exit(0); } try { ...
6be18e0f-d994-4c49-95da-d43ed19c4863
2
public void saveLifts(){ try{ for(int i=0;i<lifts.size();i++){ //System.out.println("save " + lifts.get(i).getLiftID()); lifts.get(i).saveLift(); } }catch (IOException e){ e.printStackTrace(); } }
ffdc2723-8b67-4d45-a464-545f51114107
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
b8228ee8-af15-4efc-98f1-174ec505a8e7
3
protected Object getFieldValueWithAccessor(Object obj, Field field) { Object value = null; if (field != null) { try { Method method = getAccessor(obj, field, true); if (method != null) { value = method.invoke(obj, (Object[]) null); } } catch (Exception e2) { // ignore ...
00ee1d94-4b3e-41f3-ba5c-885c73c501cb
5
private void btAddRdvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddRdvActionPerformed if (cbMedecin.getSelectedIndex() == 0 || cbSpecialisation.getSelectedIndex() == 0 || cbTranche.getSelectedIndex() == 0 || dpDate.getDate() == null) { ...
a45aaf8c-705a-4766-b012-14b46a94c8d5
5
private static void handleHeroMoveKeys(Hero hero, Input input) { for (int key : MOVEMENT_KEYS.keySet()) { if (input.isKeyDown(key)) { Direction direction = MOVEMENT_KEYS.get(key); if (isCtrlDown(input) && !hero.isMidMovement() && !hero.isStunned()) { hero.setDirection(direction); } else { her...
88ce7937-b0ac-4cac-8b91-9b89b299f93e
1
void move(boolean dir) { if (dir) y += speed; else y -= speed; }
673245cb-caee-461a-a48b-e796d866e740
4
public static String removeUnderscoresAndAddCaps(String in) { String spaced = in.replaceAll("_", " "); char[] chars = spaced.toCharArray(); boolean found = false; for (int i = 0; i < chars.length; i++) { if (!found && Character.isLetter(chars[i])) { chars[i] = Character.toUpperCase(chars[i...
dda18ff6-09b5-4827-b452-fee1d6ab20bd
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
036f7662-3860-4d09-a455-a8353e590756
4
private int wordend(int from) { while((from < line.length()) && !wordchar(line.charAt(from))) from++; while((from < line.length()) && wordchar(line.charAt(from))) from++; return(from); }
a056ddf2-67a9-4893-a0c5-f2db7d4423bf
4
public void onMode(String channel, String sourceNick, String sourceLogin, String sourceHostname, String mode) { if (channel.equalsIgnoreCase(DarkIRC.currentChan.name)) { GUIMain.add_line("*" + sourceNick + " set mode " + mode + "\n"); User[] u = DarkIRC.bo...
bff351e4-e470-4a83-9a89-15b8cc5436e9
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(commandLabel.equalsIgnoreCase("fuckyou")){ Player target = (Bukkit.getServer().getPlayer(args[0])); if (target == null) { sender.sendMessage(args...
c2f34e66-b711-4a8e-88ae-1a7cf8b66ee4
1
@Override public int hashCode() { int hash = 0; hash += (onumber != null ? onumber.hashCode() : 0); return hash; }
33a266af-86d3-4920-a2dd-356789681be4
4
public void falling() { if(!isBlocked(x, y + velY + 1f)){ timer += delta; if(velY < 16){ if(timer > 100){ velY = velY += 1f; timer = 0; } } mapY += velY; isOnGround = false; }else if(velY < 16){ velY = 0; isOnGround = true; }else{ velY = 0; isOnGround = true; i...
7cc87e99-3f5e-45d6-a085-0c22e9ca96bc
4
public PowerGem combineGems(PowerGem gem1, PowerGem gem2) { CombinedPowerGem cGem=new CombinedPowerGem(); Elements e1,e2; if(gem1 instanceof CombinedPowerGem) { int rand=(int)(Math.random()*2); if(rand==1) e1=gem1.getElement(); else e1=((CombinedPowerGem)gem1).getElement2(); } if(gem2 instance...
d9e0b60c-f00c-4f3e-8e97-85ecf22eb8a4
4
void menuReopen() { if (currentName == null) return; animate = false; // stop any animation in progress Cursor waitCursor = display.getSystemCursor(SWT.CURSOR_WAIT); shell.setCursor(waitCursor); imageCanvas.setCursor(waitCursor); try { loader = new ImageLoader(); ImageData[] newImageData; if (fileN...
77c75877-544b-46eb-9c07-21a45eae1024
3
private boolean outOfBounds(int x, int z) { return x < 0 || x >= 32 || z < 0 || z >= 32; }
bb90fa97-a1af-4497-9304-bae39be7a5ae
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 Laptops)) { return false; } Laptops other = (Laptops) object; if ((this.idLaptop == null && other.idLaptop != n...
edc1ed76-6495-4092-875a-ce452aa4ff52
5
public void verifyCommunityCards(final CommunityCards myComCards) throws InvalidSubscriptionException, IOException, InterruptedException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException { // if anyone disagrees with the deck they will call cheat final Sub...
47f41894-24d9-4e6f-8bd9-1c7f8c2be40f
8
private int getSenseCondition() { char read = (char) readAhead; int s = -1; switch(read) { case'F': case'f': break; case'H': case'h': break; case'M': case'm': break; case'R': case'r': break; default: break; } return s; }
8cd2d95c-5aee-4dc1-b67c-04a5b9037d58
5
public void sequenceStAnomalies(ArrayList<OutlierInfo> sTanomalies) { int loopSizeDeterminer;//determines teh size of the inner loop and is dynamic. for (int index = 0; index < sTanomalies.size(); index++) { OutlierInfo stOutlier = new OutlierInfo(); stOutlier = sTanomalies.ge...
f8929549-0003-45ae-8b95-4f51b0d11ac7
7
public int hashCode() { int hash = 7; hash += 31 * hash + (getId() == null ? 0 : getId().hashCode()); hash += 31 * hash + (source == null ? 0 : source.hashCode()); hash += 31 * hash + (firstTurn == null ? 0 : firstTurn.getNumber()); hash += 31 * hash + (lastTurn == null ? 0 : las...
dfd46107-1986-4c11-9184-69c2b752a62f
2
public static boolean isVariableOnRHS(Production production, String variable) { String[] variables = production.getVariablesOnRHS(); for (int k = 0; k < variables.length; k++) { if (variables[k].equals(variable)) return true; } return false; }
89a937ff-2c9c-4b52-8b10-521e36274089
3
public DictionaryMainWindow() { needDictionary = new Vector<>(); initialize(); table.setModel(model); JPopupMenu popupMenu = new JPopupMenu(); addPopup(table, popupMenu); JMenuItem mntmNewEntryRightClick = new JMenuItem(Localization.getInstance().get("newEntry")); mntmNewEntryRightClick.addAction...
8ace5192-cb33-4fbb-a028-786014b8143c
4
@Override protected void run() { long startTime = System.currentTimeMillis(); long elapsedTime = 1; EDA eda = (EDA) algorithms.get("EDA"); int sameCounter = 0; eda.run(); runBestIndividual = eda.getBestIndividual(); System.out.println(); boolean reset = false; while (elapsedTime < 8640...
7e759d50-e317-483d-b9d5-beec1755c729
1
private boolean performChecks() { return !closed && layout != null; }
f875162d-6753-4dcd-91ce-b253a60452e7
6
public void run() { try { ObjectOutputStream out = new ObjectOutputStream(server.getOutputStream()); ObjectInputStream in = new ObjectInputStream(server.getInputStream()); // --Mutil User but can't parallel String [] arr= (String[]) in.readObject(); System.out.println(arr[0]+arr[1]); switch (arr[0])...
c7c9f2fb-c05a-42b9-869a-9303b450743e
2
private ImageIcon getBrick(final String difficulty) { //думаю, тут все понятно. просто смотрим на сложность и берем соответствующий кирпичик. плюем его ImageIcon img; if (difficulty.equals("Легко")) { img = new ImageIcon(getClass().getResource("/bricks/big.jpg")); } else if (...
6f4e9d71-c3d3-47e5-8c35-3df3bda09829
6
private int valueCexpand(char[] charArray, int i) { if ('C' == charArray[i]) { if (charArray.length > i & ('D' == charArray[i + 1] | 'M' == charArray[i + 1])) { return -100; } else if (charArray.length + 1 > i + 1 & ('D' == charArray[i + 2] | 'M' == charArray[i + 2])) { return -100; } else ...
fd314ca0-e5a5-4597-b9b8-9d4e90e590a8
1
private void otrisovkaOdnoiDiagrammy(GC gc, int contactTextDistance, int arrowStartYPosition, String contactLabel) { int arrowStartXPosition = contactTextDistance + 33; gc.drawString(contactLabel, contactTextDistance, arrowStartYPosition); // нарисовать подпись контакта strelka(gc, arrowStart...
35410fe2-5da7-4605-a1ea-0e7ed2feac5e
4
private void loadPermissions(final ConfigurationSection permissions) { if (permissions == null) return; for (final String name : permissions.getKeys(false)) { final ConfigurationSection permission = permissions.getConfigurationSection(name); final String description = permission...
3ae4e328-11d3-4f82-b9ae-9beeeea82f7b
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
2a82f48b-1b66-432f-9d97-add3baf1195f
2
public double bonusDefense(Peuple attaquant){ if ((attaquant instanceof PeupleEtudiantTC) || (attaquant instanceof PeupleEtudiantBranche)){ return Double.POSITIVE_INFINITY; } return 1; }
fa2975a2-91a8-4197-9f05-3e84403d48d6
6
public int lengthOfLastWord(String s) { int i = s.length() - 1; if (i < 0) return 0; for (; i > -1; i--) { if (s.charAt(i) != ' ') break; } if (i < 0) return 0; int mark = i; for (; i > -1; i--) { i...
60a67cd3-adfd-4a3e-8119-a38272e2e5c4
8
public void initTextures(DrawContext dc) { if (isLoading()) return; GL2 gl = dc.getGL().getGL2(); textures = new HashMap<String, Texture>(); try { display.initialize(gl); } catch (InitializationException e) { e.printStackTrace(); } for (String key : bimages.keySet()) { Texture tex = null;...
7df0e9b3-3a2e-4bd7-a1d9-0af3323c927b
9
private boolean canClaimFreeCenterTile(Tile tile) { String build = getGame().getSpecification() .getStringOption("model.option.buildOnNativeLand").getValue(); return isEuropean() && tile.getOwner() != null && tile.getOwner().isIndian() && ("model.option.bu...
2b0f70cf-7441-4884-a914-988bf4e65ea1
8
public void drawFailure(Graphics2D g) { if(state.selection.equals(location)) { g.setColor(Color.RED); g.fill(area); } g.setColor(darker); g.draw(area); if(state.annotation != null && ((GridAnnotation)state.annotation).coloring.keySet().contains(new Point(location.x, location.y))) { drawCell...
9950a1ad-4db7-42fc-a8a1-8feece0b9fd1
2
private void nameReplaced() { CtMember.Cache cache = hasMemberCache(); if (cache != null) { CtMember mth = cache.methodHead(); CtMember tail = cache.lastMethod(); while (mth != tail) { mth = mth.next(); mth.nameReplaced(); }...
46b3489f-afcb-4c24-a012-e5ea89d77a1d
9
private static String findLanguage(String rawData){ for(int i = 0; i+5<rawData.length(); i++){ boolean dashDetected = rawData.charAt(i+4)=='-'; if(rawData.charAt(i)==',' && rawData.charAt(i+1)== '"' && ((rawData.charAt(i+4)=='"' && rawData.charAt(i+5)==',') || dashDetected)){ if(dashDetected){...
fdb75068-3ec3-4360-a1cf-cbe4744aa8a8
8
public static MaplePacket closeRangeAttack(int cid, int tbyte, int skill, int level, byte display, byte animation, byte speed, List<AttackPair> damage) { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(SendPacketOpcode.CLOSE_RANGE_ATTACK); mplew.write...
1c3a5c46-efed-4650-907d-b46919406f30
8
public static Direction getDirectionBetween(Tile from, Tile to) { if(to.getX() == from.getX() + 1 && to.getY() == from.getY()) return Direction.RIGHT; if(to.getX() == from.getX() - 1 && to.getY() == from.getY()) return Direction.LEFT; if(to.getX() == from.getX() && to.getY() == from.getY() - 1) return Di...
2f5c5ad3-6b8a-4dcd-bd7f-eca179dc91e6
0
public synchronized List<String> getSearchedSites() { return searchedSitesList; }
b449ec61-7e1c-4937-8cea-baa7411de075
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
0e08229a-0471-46f8-b82d-d7079f32eaf8
5
@SubCommandHandler(name = "invite", parent = "channel", permission = "multichat.channel.invite") public void InviteChannel(Player player, String[] commandArgs) { String playerName = player.getName(); String playerDisplayName = player.getDisplayName(); if (commandArgs.length > 1 && !commandArgs[1].isEmpty()) {...
eced3f96-e865-4e72-8b23-adc93ec09400
3
* @param subGraph the directly opposite subgraph * @param left true if we are doing the left subarc, otherwise the * right */ private void installSpecial( TreeMap<SpecialArc,Graph> specials, SpecialArc special, Graph subGraph, boolean left ) throws MVDException { assert special.getFrom() != null && specia...
8bb80f14-bab0-4c88-a15a-27d07664482e
5
public static boolean Exists ( PcParts thing, List<Stock> shopStock ){ check = false; item = thing; for(int i=0; i < shopStock.size(); i++){ if ( thing.getManufacturer().equals(shopStock.get(i).getManufacturer()) && thing.getmodelName().equals(shopStock.get(i).getmodelName()) && thing.getmodelYear() == shopSt...
d6f57251-8e4c-4e7a-b6b5-0383f181d262
3
public static Homework_database read(int value) { Homework_database homeworkreturn = null; { try { RandomAccessFile raf = new RandomAccessFile(login_area.setURL.getUrl(), "rw"); raf.seek(raf.length()); raf.seek(538*value); Timetable_main_RWRAF.delete = raf.read(); ...
9954dd6e-8ea8-437e-8f30-8ed89582ffb0
0
public String getDesignation() { return designation; }
e1e66565-6892-4eb7-a9da-c2e8cc96d8f6
6
public static void main(String[] args) { Runtime.getRuntime().addShutdownHook(halterThread); application = new Application(); application.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line; try { while((line =...
bd087d02-3cb8-46ba-9da0-8edbafd2146e
0
public void load(int[] aInt, float[] aFloat, String[] aString ){ this.aInt = aInt; }
1d3dc6f1-ca56-409f-88bd-ec845c475b3c
9
private static void crossingOver() { int crosspoint; ArrayList<Arrangement> children = new ArrayList<Arrangement>(); for (int i = 0; i < populasi.size(); i++) { for (int j = i + 1; j < populasi.size(); j++) { children.add(new Arrangement(populasi.get(i).getAr...