method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2e5625db-7cac-4b77-b12b-4e58b049ea3c
5
static void parseSetRegionPacket(int i) { Class312.anInt3931 = 0; anInt9345++; int sizeId = Class299.gameBuffer.method3342(); int chnkY = Class299.gameBuffer.getWordLE128(-117); int chnkX = Class299.gameBuffer.readLEShort(false); boolean force = ((Class299.gameBuffer.method3329((byte) 21) ^ 0xffffffff) ==...
48cabf17-a8a2-4913-b180-dd6b9b0ac581
0
public UndoableEdit( Node node, String oldText, String newText, int oldPosition, int newPosition, int oldMarkPosition, int newMarkPosition) { this.node = node; this.newText = newText; this.oldText = oldText; this.newPosition = newPosition; this.oldPosition = oldPosition; this.newMarkPo...
dd3cc550-d489-4c2d-b78d-2900eb78d5af
7
protected final void setTComponentContainer(TComponentContainer componentContainer) { if (tComponentContainer != componentContainer) { if (tComponentContainer != null) { tComponentContainer.getParent().removeMouseListener(this); tComponentContainer.getParent().removeMouseMotionL...
c2965920-0e00-4b9d-ba64-2e68986b0738
3
public void joinEntityInSurroundings(Entity var1) { int var2 = MathHelper.floor_double(var1.posX / 16.0D); int var3 = MathHelper.floor_double(var1.posZ / 16.0D); byte var4 = 2; for (int var5 = var2 - var4; var5 <= var2 + var4; ++var5) { for (int var6 = var3 - var4; var6 <= v...
535d7e17-1451-405c-8cab-10578bd5dbc9
1
public void method278(int z, int x, int y, int arg3) { GroundTile groundTile = groundTiles[z][x][y]; if (groundTile != null) { groundTiles[z][x][y].anInt1321 = arg3; } }
90aadac4-96c7-4389-8511-0463a4ac0155
3
public void setGain( float g ) { // Make sure there is a gain control if( gainControl == null ) return; // make sure the value is valid (between 0 and 1) float gain = g; if( gain < 0.0f ) gain = 0.0f; if( gain > 1.0f ) gain...
d3a5e056-4c53-46b0-bb80-19fd166a4e3d
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...
bbc9c148-8cb9-4a09-892c-544f54520e83
1
public void setAttribute(String name, byte[] content) { if (unknownAttributes == null) unknownAttributes = new SimpleMap(); unknownAttributes.put(name, content); }
0f83b16d-c16b-46ec-966a-6898b7496c21
3
public ListNode insertionSortList(ListNode head) { if(head == null || head.next == null) return head; ListNode sorted = null; ListNode indicator = head; while(indicator != null){ sorted = insertIntoSortedList(sorted, indicator); indicator = indicator.n...
7f4f5d68-08d9-435f-8750-5eb2a6fa58d0
3
public boolean havePD(){ for (Map.Entry<Long, Tool> a:tools.entrySet()){ if (a.getValue() instanceof ExpRing){ if (a.getKey()>System.currentTimeMillis()){ return true; } } } return false; }
19e1f3a1-5cfd-479e-8bb4-c3efc39f2770
3
private static boolean equalArrays(char[] s, char[] t){ if(s.length!=t.length) return false; for(int i=0;i<s.length;i++){ if(s[i]!=t[i]) return false; } return true; }
e2ea8b77-eb95-44a0-afc1-44da94228e01
2
public static void main(String[] args) { int retval = 0; try { jlp player = createInstance(args); if (player!=null) player.play(); } catch (Exception ex) { System.err.println(ex); ex.printStackTrace(System.err); retval = 1; } System.exit(retval); }
89d87b24-efa1-4bdd-a465-6adb1e4e9e10
8
private int translateUpperNoneClosedRowsDownwards(TetrisMatrixModel tetrisMatrixModel) { TetrisBlockModel[][] tetrisBlockMatrix = tetrisMatrixModel.getTetrisBlockMatrix(); int closedLineCount = 0; for (int i = 0; i < tetrisBlockMatrix.length; i++) { boolean isClosedLine = true; ...
e43fea61-eba9-402c-bb6d-c6c2e04ff35c
7
@Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException { switch(currentTag){ case TITLE: word = data.toString(); word = Utils.replaceUnicodeQuotation( word ); if(!generator.isValidWord(word)){ ...
bbeb4647-a9aa-4fba-bd1f-19b3ed0b9c1c
9
private static int[] calc(int[] a, int[] b, char calculator) { int opbS = b[0]; int opbP = b[1]; System.out.println(a[0] + "/" + a[1] + " " + calculator + " " + b[0] + "/" + b[1]); int[] c = new int[2]; if (calculator == '-') { opbS = 0 - opbS; calculator = '+'; } else if (calculator == '/') { i...
04e82f2a-d8f7-40e0-94df-96c0e1b8d4df
3
public SimpleResponse authenticate() { Session session = HibernateUtil.getSession(); //TODO -Change the query to fetch only user related data and not all user data List<UserTbl> users = session.createQuery("from UserTbl").list(); for(UserTbl user : users) { if(user.getUserName().equals(bean.getUserN...
449ec48f-75d4-4345-b789-827b6bafefab
9
private boolean r_postlude() { int among_var; int v_1; // repeat, line 66 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 66 // [, line 68 bra = cursor; ...
87423c09-3a4e-474c-a0c1-b491b243299d
2
public static Font getFontWithSize(String fontName, float size) { Font customFont = null; try { //create the font to use. Specify the size! customFont = Font.createFont(Font.TRUETYPE_FONT, new File("assets/" + fontName + ".ttf")).deriveFont(size); ...
9f8470df-f9c9-4d4a-9952-2300491cf07b
3
public static byte[] encrypt(byte[] data, byte[] key) { if(data.length == 0) { return data; } int[] s = Util.bytesToInts(data); int[] g = Util.bytesToInts(Arrays.copyOfRange(key, 0, 16)); int d = s.length; int j = s[d - 1], l = s[0]; int o = 0x9E3779...
e7e08e7e-491f-439c-a788-f974a6378170
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TabelOutletSubGroup other = (TabelOutletSubGroup) obj; if (!Objects.equals(this.subGroupId, other.subGrou...
eebea885-3347-4c82-b6fb-5fd3205fd93c
3
public void newGame(){ paused = false; gameOver = false; drawOver = false; screen = new Square[22][10]; for (int row = 0; row < 20; ++row) { for (int col = 0; col < 10; ++col) { screen[row][col] = new Square(true, Color.BLUE); } } for(int i = 0; i < 10; ++i){ screen[20][i] = new Square(false,...
26a695e7-a4db-45ea-b5fa-43c00119906b
9
private static void calculateThresholdForBlock(byte[] luminances, int subWidth, int subHeight, int width, int height, int[][] blackPoints, BitMatrix matrix) { for (int y = 0; y < subHeight; y++) { int yoffset = y << 3; if ((yoffset + 8) >= height) { yoffset = height - 8; } for ...
1db546c3-ae60-4bf2-b58b-a02321c4f239
5
public void tarjanSCC(int u) { dfs_num[u] = dfs_low[u] = dfsNumberCounter++; s.push(u); visited[u] = true; for (int i = 0; i < ady[u].size(); i++) { int v = ady[u].get(i); if (dfs_num[v] == -1) tarjanSCC(v); if (visited[v]) dfs_low[u] = Math.min(dfs_low[u], dfs_low[v]); } if (dfs...
b50cac6e-863a-447d-bdc1-18a170026097
2
public Channel getPlayersSimilarChannel( String channel ) { for ( Channel chan : channels ) { if ( chan.getName().contains( channel ) ) { return chan; } } return null; }
9fc76f28-8fc0-4d02-9836-7cea6c25da91
0
public String getNomBd() { return nomBd; }
b0f791b9-c50b-4e26-92d1-e256e9fb19b6
1
public void sendAddonMessageToChannels(String msg) { String[] channels = getChannels(); for (String channel : channels) sendMessage(channel, msg ); }
a618e62c-985e-4a09-bf0b-240dde7737d1
3
public static String addStencilShape(EditorPalette palette, String nodeXml, String path) { // Some editors place a 3 byte BOM at the start of files // Ensure the first char is a "<" int lessthanIndex = nodeXml.indexOf("<"); nodeXml = nodeXml.substring(lessthanIndex); mxStencilShape newShape = new ...
80cf897f-2970-4809-827d-8411eff7d299
4
public static Face getLeft(Face face){ switch (face){ case NORTHERN: return WESTERN; case WESTERN: return SOUTHERN; case SOUTHERN: return EASTERN; case EASTERN: return NORTHERN; } return null; }
5342d55e-5b30-4796-a1ad-ca5bbde5a05f
0
public static void main(String[] args) { launch(args); }
1f54b131-4bd7-46f5-8e49-3623c05ae720
1
void addPredecessor(Instruction pred) { if (preds == null) { preds = new Instruction[] { pred }; return; } int predsLength = preds.length; Instruction[] newPreds = new Instruction[predsLength + 1]; System.arraycopy(preds, 0, newPreds, 0, predsLength); newPreds[predsLength] = pred; preds = newPreds; ...
595502b6-9299-4593-9ca3-5765b2db5943
9
public static int minCut(String s) { if (null == s || 0 == s.length()) return 0; int len = s.length(); int[] result = new int[len]; boolean[][] palindrome =new boolean[len][len]; for (int start = len - 1; start >= 0; start--) { result[start] = len - start - 1; for (int end = start; ...
ff5eabe3-b73a-4e40-b7c8-49138b3192f6
3
private void writeCommentExtension(OutputStream os) throws IOException { os.write((int) '!'); // GIF Extension Introducer os.write(0xfe); // Comment Extension Label int remainder = theComments.length() % 255; int nsubblocks_full = theComments.length() / 255; int nsubblocks = nsubbloc...
f9347867-cef2-4c9d-a60e-2518cd4dc54d
8
public void makeXml(Object object, Document doc, Element parent) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException { String className = object.getClass().getCanonicalName(); String nameSpace = persistConf.getNameSpaceForClassName(className); ...
23e4c042-58c5-49b0-9cad-ae5834ff9b6c
0
public static void main(String[] args) { MemberInner.MemInner memberInner = (new MemberInner()).new MemInner(); MemberInner memberInner2 = new MemberInner(); memberInner.dosomething(); System.out.println("---------------------------"); memberInner2.run(); }
f491ac16-4635-454c-9206-5ea97a78e803
9
private Ability getAbility(Party cp) { // TODO Auto-generated method stub if(this.isRaging()) { return new Attack(); } if(getLevel() <= 4) { //choose ability at random Random gen = new Random(); return getAbilities().get(gen.nextInt(getAbilities().size())); } if(getLevel() > 4 && getLevel() ...
c08f2e9e-b38d-4401-ab01-ab75b8d64c5d
7
private String executeNativeScripts(String str) { str = str.trim(); if (str.equals("")) return ""; String output = ""; synchronized (scriptLock) { String[] token = str.split(":"); if (token.length >= 3) { // reconnect "http://......" and others that should not have been broken up if (token.leng...
46a37537-552f-4b44-83d4-0c47a88ebecc
4
private void Accept1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Accept1ActionPerformed if (vars.size() >= 1) { int Index = Controller.failureManagerFormat; Object[] what = new Object[1]; String str = ""; for (int i = 0; i < vars.size() - 1; ...
c7b0b9b4-2c57-4c22-baca-7554d6b331bf
8
public void animalEat(Player p, ItemStack i){ String uuid = p.getUniqueId().toString(); if(plugin.getAnimalData().contains("Farmer." + uuid)){ List<Entity> nearby = p.getNearbyEntities(2, 2, 2); for(Entity entity: nearby){ if(this.isAnimal(entity)){ if(this.isAnimalOwner(p, entity)){ Animals a ...
afff200c-4abc-4b55-83a5-b0facb43a497
3
private int boardValue(Board board) { //Take the next checker. Checker curChecker = board.pop(); //Exception case: there is no board! if (curChecker == null) return 0; //Every piece has an initial value of 2 points. int value = 2; //Having a king is worth another 3 points. if (curCh...
6db31ed6-6e3f-4c1a-a770-1826c90d498f
1
public JSONObject optJSONObject(String key) { Object object = opt(key); return object instanceof JSONObject ? (JSONObject)object : null; }
d5916d57-c95d-470b-9813-ba1369fa52f1
8
private void checkPawnPath(int xScale, int yScale, Position basePos) { int xPos = basePos.getxPos() + xScale; int yPos = basePos.getyPos(); Position beside = new Position(xPos, yPos); //앙파상일 경우 공격가능한 폰의 위치 Position checkedPos = new Position(xPos, yPos+direction); if (xScale != 0) {//공격하는 경우 움직이는 경로 ...
38dc425e-709f-40c9-8010-9280f09baf77
9
public double findMedianSortedArrays(int[] nums1, int[] nums2) { int len1 = nums1.length, len2 = nums2.length; if(len1 == 0 && len2 == 0) return 0; Arrays.sort(nums1); Arrays.sort(nums2); int i=0, j=0, k=0, len3 = len1 + len2; int[] temp = new int[len3]; for(k=0;...
54cf2cc8-84ee-457e-a83e-8b35bf32a17d
8
public void write(AbstractBaseGraph<Word, LexicalRelation> graph) { Set<Word> graphNodes = graph.vertexSet(); Writer out = null; try { // A não indicação do charSet, faz com que grave em UTF-8 (final parece // que não grava em UTF-8, mas sim aquilo que o sis...
b52ea976-1728-4b08-b91a-f56788349f4d
6
public Player getWinner() { if (players == null || players[0] == null || players[1] == null || !isOver()) { // The winner can't be determined yet return null; } else if (players[0].getScore() > players[1].getScore()) { return players[0]; } else if (players[1].getScore() > players[0...
acb60240-580a-4f3f-83f7-968558c8ac95
3
private static Action determinerAction(String action, Map<String, Action> routes) { Action handler = routes.get(action); if (handler != null) return handler; String a = action; int i = a.lastIndexOf("/"); while (i > 0) { a = action.substring(0, i); ...
8d1567b9-0133-4d9a-901b-627a74e6314b
7
private void addTiles(Tile tile) { for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[0].length; j++) { if (!map[i][j].contains(tile)) { int nr = generateArrayOfCrossDirections(tile, i, j).size(); if(nr>2){ if(tile instanceof Grass) map[i][j].add(new Grass()); else if(t...
170f616e-6d24-457e-b566-bd4cd56f80fa
8
public void mark (TextPosition Start, TextPosition End) { if (Start == null || End == null) return; TextPosition P1, P2; if (Start.before(End)) { P1 = Start; P2 = End; } else if (End.before(Start)) { P1 = End; P2 = Start; } else return; ListElement e = P1.L; ((Line)e.content()).block(...
c9ef6222-473c-49e2-9485-06fd23484d05
2
public static JSONArray nextSync(long uid) { UserNotificationBuffer monitor = getMonitorFor(uid); synchronized(monitor) { if(monitor.isEmpty()) { try { monitor.wait(COMET_TIMEOUT); } catch (InterruptedException e) { e.printStackTrace(); } } return monitor.packJson(); } }
940895d0-6003-4fac-ab67-b73f57e0fae7
0
public static String yyyymmdd_hhmmss() { SimpleDateFormat D = new SimpleDateFormat("yyyyMMdd_HHmmss"); return D.format(new Date()); }
5abef904-31e2-4bb6-9a35-ccd9372d4953
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
1a587c95-abeb-4f81-b999-b2075b2fbb7a
7
public static boolean advanceCheckpoint(){ switch(state){ case FINISHED: return false; case INACTIVE: eCoreEventManager.startEvent(); break; case PROUDOFSUBJECT: eCoreEventManager.loungeHint(); break; case TELEPORTER_BEFORE: eCoreEventManager.temporaryRetreat(); break; case ...
790ad6d2-02bf-412d-8522-69f042252cf5
1
private void pauseSong(){ if(songStatus == SONG_PLAYING){ myPlayer.pause(); songStatus = SONG_PAUSED; } }
e4e10838-3264-48a3-a079-65f7613aabe6
3
public Letter getOpposite() { Letter letter = null; if (value == 0) return this; for (int i = 0; i < Letter.values().length; i++) if (Letter.values()[i].getValue() == -getValue()) { letter = Letter.values()[i]; } return letter; }
ef8c917a-c27d-4438-a084-652b6acf0e60
4
public void keyReleased(KeyEvent e) { if (e.getKeyChar() == 'a' || e.getKeyChar() == 'A') { theMap.getCharacter().setDirection(0); } else if (e.getKeyChar() == 'd' || e.getKeyChar() == 'D') { theMap.getCharacter().setDirection(0); } theMap.getCharacter().setDirection(0); }
4b6cab9f-4886-44c6-ac32-2749cd6d1fc2
0
public void afficherVisiteur(){ CtrlPrincipal ctrlP = new CtrlPrincipal(); ctrlP.action(EnumAction.VISITEUR_AFFICHER); // Supprime l'affichage de la vue Menu // this.getVue().setVisible(false); }
0040897c-4ec1-4c13-899e-03b259ff97c0
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
0faadde2-9997-4b20-887f-bc634592b47f
2
@Override public void update(Observable arg0, Object arg1) { ModelNotification notificationType = (ModelNotification) arg1; switch(notificationType) { case SETTINGS_CHANGED: refreshForms(); break; case LANGUAGE_CHANGED: refreshLabels(); break; } }
ba183453-0d24-478d-aa5a-d22cfe9d70ed
6
@Override public int getMask(int plane, int localX, int localY) { int currentChunkX = localX / 8; int currentChunkY = localY / 8; int rotation = regionCoords[plane][currentChunkX][currentChunkY][3]; int realChunkX = regionCoords[plane][currentChunkX][currentChunkY][0]; int realChunkY = regionCoords[plane][cu...
20723ca9-8a2b-489e-b787-3f69e8c35c43
1
@Override public void put(int position, byte[] source) throws IOException { ByteBuffer bf = ByteBuffer.wrap(source); while (bf.hasRemaining()) { int len = fileChannel.write(bf, position); position += len; } }
a00795bf-b5dd-4a6f-a3d0-82a3c77b8a5e
0
public void setAllOrders(List<Order> allOrders) { this.allOrders = allOrders; }
817f2dfd-5282-49b5-8ec9-87c395a7f425
1
public void add(Object x) { if (next < items.length) items[next++] = x; }
f6e8ad72-6e4c-4278-9643-a5ce404f685d
7
private void closeRequest(OnDemandData onDemandData) { try { if(socket == null) { long l = System.currentTimeMillis(); if(l - openSocketTime < 4000L) return; openSocketTime = l; socket = clientInstance.openSocket(43594 + client.portOff); inputStream = socket.getInputStream(); out...
5305dfc1-b673-4612-9f0b-630e8442000e
6
final void method3240(byte i) { ((Class348_Sub42_Sub14) this).anInt9643 = 12800; ((Class348_Sub42_Sub14) this).anInt9644 = 12800; ((Class348_Sub42_Sub14) this).anInt9627 = 0; anInt9636++; ((Class348_Sub42_Sub14) this).anInt9635 = 0; if (i != 37) method3244(30, -85, -43); for (Class348_Sub18 class348_sub18 ...
60bb11dc-49d6-4b27-ad14-1cbf58593c67
1
public void render( Shader shader, RenderEngine renderEngine ) { for ( GameComponent component : components ) component.render( shader, renderEngine ); }
6b66b9f7-63b0-4392-a182-5d34500f4e4c
0
public void shuffle() { size = cards.size(); java.util.Collections.shuffle(cards); }
9cf5fbee-85bd-4af9-a431-5d770c7f7df3
8
private int getOctave(double freq) { if (freq > defaultSaFrequency) { int octave = 0; do { if ( (defaultSaFrequency * (octave + 1) <= freq) && freq < (2*(defaultSaFrequency * (octave+1))) ) { return octave; } else { octave++; } }while(true); } else if (freq < defaultSaFrequency) { ...
8cc7086f-c6de-4944-9b24-c3226c091ca9
4
public static void main(String[] args)throws IOException { double finalAnswer=-99; double finalShortPeriod=0; double finalLongPeriod=0; double finalPercDif=0; double[] PortfolioValue=new double[60*260]; double[] BaseValue=new double[60*260]; final XYS...
07f159f4-6892-4b99-b543-7b9bfd7f95aa
8
@NotNull public RuntimeException asUncheckedException() { switch(errorCode) { case JDWP.Error.NOT_SUSPENDED: return new NotSuspendedException(); case JDWP.Error.INVALID_OBJECT: return new InvalidObjectException(); case JDWP.Error.INVALID_FRAMEID: return new InvalidStackFrameException(); ca...
422f1b96-9baf-4dc5-af06-634e738115ad
1
public synchronized void addWay(String codigo, WayOsm w, Long idway){ if (totalWays.get(codigo) == null) totalWays.put(codigo, new ConcurrentHashMap<WayOsm, Long>()); totalWays.get(codigo).put(w, idway); }
2d193ea8-90ea-4d0d-8e0c-1d80f5b52b63
5
public void run(){ while(!isInterrupted()&&!shutdown){ for(int i=0;i<getActive();i++)if(isDone(i))remove(i); try{Thread.sleep(200);}catch(Exception e){e.printStackTrace();} } }
f077086d-f01a-400d-b07d-b9c46fd57a46
8
private char DNACompliment(char inputBase){ char matchingBase = 'X'; switch(inputBase) { case 'A': matchingBase = 'T'; break; case 'a': matchingBase = 'T'; break; case 'G': matchingBase = 'C'; break; case 'g': matchingBase = 'C'; break; case 'T': matchingBase = 'A'; break; ca...
016e8fe7-c83d-4844-968e-9b426a18b3ba
7
protected int widestDim(double[][] nodeRanges, double[][] universe) { final int classIdx = m_Instances.classIndex(); double widest = 0.0; int w = -1; if (m_NormalizeNodeWidth) { for (int i = 0; i < nodeRanges.length; i++) { double newWidest = nodeRanges[i][WIDTH] / universe[i][WIDTH]; ...
bb1d8e2e-9fcf-4f4e-85f6-abdef1b41d7f
2
public void visitTypeInsn(final int opcode, final String type) { checkStartCode(); checkEndCode(); checkOpcode(opcode, 3); checkInternalName(type, "type"); if (opcode == Opcodes.NEW && type.charAt(0) == '[') { throw new IllegalArgumentException( "NEW cannot be used to create arrays: " + type); } m...
a69e65eb-fd23-471e-98da-6b291f817613
6
public void setVolume(float v) { if(v > 100.0f) { v = 100.0f; } if(v < 0.0f) { v = 0.0f; } float max = getMaxGain(); float min = getMinGain(); if(!(max < -500.0f || min < -500.0f)) { float diff = max - min; float gai...
4658dc35-6002-45ba-a544-f23d7bf9d050
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Authentication other = (Authentication) obj; if (password == null) { if (other.password != null) return false; } else if (!password.equa...
88dd1344-504a-4507-979d-f72049ad34ea
1
private void assertPieceTypePlacement(Board board, PieceType type, int column) { final ChessPiece whitePiece = ChessPiece.from(PieceColor.WHITE, type); final ChessPiece blackPiece = ChessPiece.from(PieceColor.BLACK, type); final int edgeOffset; if (type == PieceType.PAWN) { ...
333e488f-a673-45e4-bcf8-4a96f1123040
4
@Override void merge(Author oldEntity, Author newEntity) { if(!oldEntity.getFirstName().equals(newEntity.getFirstName())) oldEntity.setFirstName(newEntity.getFirstName()); if(!oldEntity.getLastName().equals(newEntity.getLastName())) oldEntity.setLastName(newEntity.getLastName()); if(oldEntit...
198efa0f-994d-467a-88ba-8624cb3c8f7a
6
public int[] getClosestClusters(){ int []arr = new int[2]; arr[0]=0; arr[1]=0; double largestSimilarity = -100; for (int i = 0; i < numberOfDocuments; i++) { for (int j = 0; j < numberOfDocuments; j++) { if( i>=j || !clustersExists.get(i) || !clustersExists.get(j) ) continue; if(similairtyMatrix[i]...
1ed53902-e2c4-4022-84c7-9ac25e5b7eda
3
public static void main(String[] args) { HashMap<String, String> strings = new HashMap<String, String>(); strings.put("Evan", "evan@mit.edu"); strings.put("Eugene", "eugene@mit.edu"); strings.put("Adam", "adam@mit.edut"); System.out.println(strings.size()); strings.remove("Evan"); System.out.prin...
62fb96c0-f029-4e82-a228-09c6d05cdf4c
6
public void handleBotTrajectory(){ Thread botTrajectoryRandomizer = new Thread(){ public void run(){ while(true){ try { Thread.sleep(500); } catch (InterruptedException e) { } if(firstPlayer.getHealth()>0 && secondPlayer.getHealth()>0 && isRunning){ for(int i=0 ; i < botList.si...
919dc9a9-38ff-4e48-821e-350ce17efbe2
4
static private boolean jj_3R_5() { if (jj_scan_token(LPAR)) return true; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_7()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAR)) return true; return false; }
8fc89955-3135-4e67-85f3-0c0d5a2fbcf7
0
public MatchCounter(File directory, String keyword, ExecutorService pool) { this.directory = directory; this.keyword = keyword; this.pool = pool; }
874e834f-5688-4f9d-8c76-60085559470f
0
@Test(expected=EmptyStackEvaluationException.class) public void testEvaluateEmptyStackIsIllegal(){ calculator.evaluateStack(); //assertTrue("An EmptyStackEvaluationException should heve been thrown here.", false); }
90e36881-1b4b-4613-9b30-93bff1587696
5
public Ball findCollidingBall(Ball me) { for (PhysicsElement e: elements) if ( e instanceof Ball) { Ball b = (Ball) e; if ((b!=me) && b.collide(me)){ if(applet)bColl.play(); return b; } } return null; }
ffe3237f-9665-4cfc-b9a6-aea6a825935c
5
public static boolean setDebugging(String debuggingString) { if (debuggingString.length() == 0 || debuggingString.equals("help")) { usageDebugging(); return false; } StringTokenizer st = new StringTokenizer(debuggingString, ","); next_token: while (st.hasMoreTokens()) { String token = st.nextToken().i...
734df90c-067f-4e35-81c2-68411ada4857
1
public static void sorter(int array[]) { heapify(array); for (int i = N; i > 0; i--) { swap(array, 0, i); N = N - 1; maxheap(array, 0); } }
dc8f1b29-f9e5-4471-85a9-b75e1886db8f
6
private void parseBotCore(Element el){ NodeList nl = el.getElementsByTagName("Config"); if(nl != null && nl.getLength() > 0) { for(int i = 0; i < nl.getLength(); i++) { Element el2 = (Element)nl.item(i); if(el2.getAttribute("name").equals("...
805826b7-55bd-4714-84d7-9190e9cc95e5
6
public static Cons walkVariableArguments(Cons arguments, MethodSlot method, StandardObject firstargtype) { { StandardObject targettype = MethodSlot.variableArgumentsType(method); boolean listifyargsP = MethodSlot.passVariableArgumentsAsListP(method); boolean wrapargsP = false; Cons cursor = argume...
6407b385-8560-4791-b919-33eb56992cb1
9
private Object optimize(Object ctx, Object thisValue, VariableResolverFactory factory) { if ((fields & DEOP) != 0) { fields ^= DEOP; } AccessorOptimizer optimizer; Object retVal = null; if ((fields & NOJIT) != 0 || factory != null && factory.isResolveable(nameCache)) { optimizer = getA...
2d295ae5-1319-4474-ba71-cdd8f85eaf22
4
@Override public boolean hasInteractable(Interactable interactable) { for(Component component: components()) { if(component instanceof InteractableContainer) if(((InteractableContainer)(component)).hasInteractable(interactable)) return true; ...
45ebd5ed-e0b0-491a-a4af-0abcbfe29b62
7
private static void testInvalidNode(ListNode p) { System.out.println("p.isValidNode() should be false: " + p.isValidNode()); try { p.item(); System.out.println("p.item() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.item() should throw...
27c8a5f7-4307-403d-b1bc-c218d2cfa10e
7
public void Generate() { RG.Init(); Rep0 = 1; while (Pos < BufferSize) { if (GetRndBit() == 0 || Pos < 1) { Buffer[Pos++] = (byte) RG.GetRnd(8); } else { ...
62164f59-a818-46be-b919-82f1986fbd2b
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection c = null; Statement stmt = null; String sql; PrintWriter out = response.getWriter(); response.setContentType("text/html"); String movie = request.getParamete...
1af2922e-5999-4b88-9711-061797a6e7da
8
public boolean parseFile(int dId) { _logger.debug("Start parsing: " + dId); boolean result = false; // Http liegen nicht als Datei vor try { FileType fileType = new MySqlDatabaseHelper().loadFileType(dId); if (fileType != FileType.HTML) { // Zusammenbau Dateipfad _file = new File(Control.R...
ac9314fa-4148-420e-8846-d1a29c2055df
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; int ind = 1; while ((s = br.readLine()) != null) { if (s.equals("0 0")) { break; } StringToken...
25d26a8a-138b-462d-875a-a076673d4546
3
public void mouseReleased(MouseEvent e) { if(Global.isRunning) { return; } // block mouse input while simulating if(shiftStartPoint != null || rotateStartPoint != null){ gui.redrawGUI(); } shiftStartPoint = null; rotateStartPoint = null; setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
ce7aabb2-0fcc-420b-b9f1-309f07e2dbdd
6
@Override public String toString() { switch (kind) { case EOF: return "EOF"; case FLOAT: case IDENT: case INT: return "'"+data+"'"; case KEYWORD: return data.toString(); case STRING: return "\""+data+"\""; default: return "<unknown token>"; } }
a224f931-f3a3-492d-bf50-33079f1d2199
0
public Heroes getheroesplugin() { return hr; }
3e796a55-b352-4afa-b11e-812ecbef95a3
3
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
e5136b5e-467a-45c2-b961-6eb2552ba11c
1
@Override public double[][] solve(double[] T_0, int n, double k, double u, double dt, double dx) { double[][] ans = new double[n][]; ans[0] = T_0; double S = u * dt / dx; double R = k * dt / dx / dx; for (int layer = 1; layer < n; layer++) ans[layer] = Sweep.sweep(ans[layer - 1], -R -...