method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
65bdc6e7-a77f-4125-8a56-f9021283bd95
5
private boolean canSimpleCheckerFight(Cell fighter, Cell targetCell) { if (targetCell == null || !targetCell.isEmpty()) { return false; } StepDirection direction = chessBoardModel.getDirection(fighter, targetCell); Cell victimCell = getRelativeCell(fighter, direction); ...
1abd8224-8121-4c73-82bc-2d3cf2db910c
5
private boolean jj_3R_14() { if (jj_scan_token(STRING)) return true; Token xsp; xsp = jj_scanpos; if (jj_3_67()) { jj_scanpos = xsp; if (jj_3_68()) { jj_scanpos = xsp; if (jj_3_69()) return true; } } if (jj_3R_31()) return true; return false; }
3e67045a-f29c-4f8d-b057-caa8376ec7d5
5
private void asetaAKuva() { if (noppa == 2 || noppa == 3){ ImageIcon raha1 = new ImageIcon(new ImageIcon(getClass().getResource("/kolikot.jpg")).getImage()); setIcon(raha1); } else if (noppa == 4){ ImageIcon raha2 = new ImageIcon(new ImageIcon(getClass().getResource("...
ec581d57-c20d-4237-ae30-e341bf96362d
4
public void repartirFichas(){ int k=10; for (int i = 0; i < 14; i+=2) { this.listaFichaPc.add(this.listaFicha.get(this.fichasBarajadas[i])); this.listaFichaHumano.add(this.listaFicha.get(this.fichasBarajadas[i+1])); int tlh = Domino.listaFichaHumano.size(); ...
87c66c11-fcdb-4c27-a0a8-15ebb78fbaaa
2
public void reactionAnalysis(){ //System.out.printf("%d\n", reactions.size()); for(int i=0; i<reactions.size(); i++){ if(reactions.get(i).getCount() > 1){ System.out.printf("%d\t", reactions.get(i).getCount()); System.out.printf(""+reactionToString(reactions.get(i))+"\n"); } } ...
e6aa970a-1232-4461-bd72-c894d38bcbd2
1
public static void print(String s) { if (verbose) System.out.println(s); }
0c6e953c-440b-4aa0-8d57-b8b115d8dd46
5
public boolean interact(EntityPlayer var1) { ItemStack var2 = var1.inventory.getCurrentItem(); if(var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared()) { if(!this.worldObj.multiplayerWorld) { this.setSheared(true); int var3 = 2 + this.rand.nextInt(3)...
66dcb4b1-6f0a-43be-9e6d-a9acbe698fe1
7
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((adresse == null) ? 0 : adresse.hashCode()); result = prime * result + ((emailAdresse == null) ? 0 : emailAdresse.hashCode()); result = prime * result + geburtsjahr; result = prime * result + ((geschl...
aaa4c0f2-a2c4-43ed-87c7-a5b781979b1f
4
public double getMAP() { if (this.predictionData.size() != 0 && this.realData.size() != 0 && this.numFoundRelevantDocs != 0) { double sum = 0.0; for (int i = 1; i <= this.predictionData.size(); i++) { sum += (getPrecisionK(i) * isCorrect(i - 1)); } return sum / this.realData.size(); } return 0.0; ...
2dab0c4a-d1d5-4a58-bc11-e91cc8d76571
2
public static void main(String[] args) { ArrayList<Figura> figuras = new ArrayList(); fabricarFiguras(figuras); for (Figura figura:figuras) { figura.desenhar(); if (figura instanceof Figura2D) { Figura2D figura2D = (Figura2D) figura; System...
ec6aea49-91cf-4e80-8ba7-44a97d36dd09
4
public static void addWadToBlacklist(String filename, String sender) { String query = "SELECT `md5`,`name` FROM `" + mysql_db + "`.`blacklist` WHERE `name` = ?"; try { Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(query); pst.setString(1, filename); ResultSet r = pst.exe...
0e7ef1f2-7cf2-4982-89ed-d3020347790d
9
public boolean isMatched(String str){ String[] s=str.split(" "); Map<String,String> map= new HashMap<String,String>(); map.put(")","("); map.put("}","{"); map.put("]","["); for(String item : s){ System.out.println("handle "+item); if(item.equals("(") || item.equals("[") ||item.equals("{"))...
896309c1-d043-4f4e-abbf-e021d921d5ad
9
public PartList getPartList(InputStream is) throws Exception{ PartList partList; Element root; try { root = getRootElement(is); } catch (Exception e) { throw e; } String bucketName = root.getElementsByTagName("Bucket").item(0).getTextContent(); String uploadId = root.getElementsByTagNam...
92850c9e-111b-4f19-a7b3-b44250444d62
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...
c2d12860-cff0-4256-816b-5fa7edf8d47a
4
static String toHex4String(int pValue) { String s = Integer.toString(pValue, 16); //force length to be four characters if (s.length() == 0) {return "0000" + s;} else if (s.length() == 1) {return "000" + s;} else if (s.length() == 2) {return "00" + s;} else if (s.length() == 3) {re...
7fbeefff-50de-43f3-bd93-008f5ac130bf
2
public static BigInteger convertoToRepresentationNumber(String representationString, char[] alfabet){ Hashtable<Character,Integer> conversionFunction = new Hashtable<>(); BigInteger base = BigInteger.valueOf(alfabet.length); BigInteger out = BigInteger.ZERO; for...
6e8e4407-816c-46f8-8616-4c91673eac64
7
@Override public double evaluate(int[][] board) { int r = 0; int n = board.length; int m = board[0].length; int x = 0, y = 0; while (y != m) { int nextX, nextY; if (y % 2 == 0) { if (x == n - 1) { nextX = x; ...
59399e22-5b8b-4fa8-8bf7-32ecdc9de0be
0
public void clickChooseSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) { System.out.println("You can't choose items, you haven't got any characters to put items on."); }
35b7efa7-02e2-42b9-aa3b-c6b1b9d16fac
0
public void setCode(String code) { this.code = code; }
068c1eef-1807-4553-aaf8-25456fa1826d
0
@EventHandler public void preInit(FMLPreInitializationEvent event) { }
afbca138-9212-4e69-bbe6-7e386c6de9ad
7
private void FacturarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FacturarActionPerformed // TODO add your handling code here: List<Usuario> us = new Conectar().ConexionUs(); Usuario u = new Usuario(); String s1 = null; try { s1 = new Us...
9c038697-803b-40dc-8820-ba90acbcae48
6
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) { if (!isCheckedException(ex)) { return true; } if (declaredExceptions != null) { for (Class<?> declaredException : declaredExceptions) { if (declaredException.isInstance(ex))...
20215b11-0785-4864-b8db-f010b782694f
6
private static Node intersection(Node l1, Node l2){ int len1=findLength(l1); int len2=findLength(l2); if(len1>len2){ int diff = len1-len2; while(diff-->0){ l1=l1.next; } } else { int diff = len2-len1; while(diff-->0){ l2=l2.next; } } while(l1!=null && l2!=null){ if(l1 == l2) ret...
18ad34ec-ec4a-4a72-b11e-f3f3794f9e0f
6
public void calculateBobbing(){ float maxB = 3.5f; float inc = 0.25f; if(moving){ if(up){ if(bob + inc < maxB) bob += inc; else bob = maxB; if(bob == maxB) up = false; }else{ if(bob - inc > 0.0f) bob -= inc; else bob = 0.0f; if(bob == 0.0f) up = true; } }else{ bob = 0.0f;...
22c1fb46-9c15-43a2-948a-86d79b24ac58
1
public void setOutputChannels(OutputChannels out) { if (out==null) throw new NullPointerException("out"); outputChannels = out; }
75db9862-9dca-4073-8c34-74f5e82c240a
7
static void tokenizeInstruction(String strLine) { StringTokenizer tt= new StringTokenizer(strLine,", \t"); stepins=tt.nextToken(); strLine = strLine.replace(",", " "); if(frontend.FrontEnd.onconsole.isSelected()) { System.out.println("Current Instruction ->...
82ec9084-b810-4c99-a737-691d4b2a412f
5
public void cambiarPassword(String newpass, String nick){ try { String queryString = "UPDATE Usuarios SET password=? WHERE nick=?"; connection = getConnection(); ptmt = connection.prepareStatement(queryString); ptmt.setString(1, newpass); ptmt.setString(2, ...
8dce9061-5107-495f-a983-c03c1e276070
2
public int isFriend(User user) { try { String statement = new String("SELECT * FROM " + FriendDBTable + " WHERE uid1 = ? AND uid2 = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, userID); stmt.setInt(2, user.userID); ResultSet rs = stmt.executeQuery(); if ...
a082facf-032c-4996-809d-ecb3ee8f0c06
3
synchronized void doDelay(int milliseconds) { // ожидает указанное время, или пока не прервет управляющее сообщение присланное через setMessage() // для неопределенно длительного ожидания < 0 if (milliseconds < 0) { try { wait(); } catch (I...
5bd997d1-1e08-40f4-aa75-dda6d45d94ed
7
public Simulator() { e = new Employee[6]; r = new Random(); for (int g = 0; g < 6; g++) { if (g < 2) { e[g] = new TastebudStylist(); } else if (g < 4) { e[g] = new Moover(); } else { e[g] = new Shaker(); } } for (int i = 0; i < 24; i++) { for (int j = 0; j < e.length; j++) { for...
c7c2395b-27b5-4c9a-b467-049ec253a65a
1
public long skip(long n) throws IOException { long skip = in.skip(n); if (available > 0) { available -= skip; } return skip; }
a1c8caf7-0fdf-4f87-b764-cf4389ca790e
5
public static char two(int r, int c, int f) { if (s2(r, c, f) || s5(r, c, f)) return '|'; else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f)) return '_'; return '.'; }
24f82428-4e0a-492b-8e07-1e60732ab9dc
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
95113eb0-9fd3-4be0-a693-185f08002537
1
public boolean autoBitrateSize(){ if (prop.getProperty("autoBitrateSize").equals("true")) return true; else return false; }
1e04af4f-7141-469f-898b-a5e08eca18ef
6
@EventHandler(priority = EventPriority.LOWEST) public void onKickServer(ServerKickEvent e) { ProxiedPlayer p = e.getPlayer(); if (p == null) { return; } if (plugin.maintenanceEnabled && !p.hasPermission("bungeeutils.bypassmaintenance")) { p.disconnect(new Co...
1aac85a5-5ff0-444c-bf0a-fe3fbd68a53e
0
public Dysk dawajDysk(){ System.out.println("Dodaje: " + name); return new DyskDlaLaptopa(); }
03a12965-bdd3-46f3-8f0f-4704d80726db
0
@Override public int compareTo(DoublyLinkedList<E> o) { return this.size - o.getSize(); }
471d3d84-041b-463d-9797-e6a88d5ceef8
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...
e07b4011-c80f-4467-b003-6b8d34ce0902
7
private static String reformatTimezone(String str, int signIdx) { String str2 = str; if (signIdx >= 0 && signIdx + 5 < str.length() && Character.isDigit(str.charAt(signIdx + 1)) && Character.isDigit(str.charAt(signIdx + 2)) && str.charAt(signIdx + 3) == ':...
dcae4a3b-77bd-4508-bf83-26b9635a7410
9
void actionAwardFilter() { if (isEmpty(awardFilterTxt.getText()) && !achievedOkFilter.isSelected() && !achievedKoFilter.isSelected() && !secretFilter.isSelected() && !multiFilter.isSelected() && !addedFilter.isSelected()) { awardListModel.filter(null); } el...
fb26cc1b-5148-4659-8cbf-e80af1272d75
0
public void setMinLength(Long value) { this.minLength = value; }
0a1a59a8-3ec7-4210-9757-e10f25c1e351
3
public Whitelist addAttributes(String tag, String... keys) { Validate.notEmpty(tag); Validate.notNull(keys); Validate.isTrue(keys.length > 0, "No attributes supplied."); TagName tagName = TagName.valueOf(tag); if (!tagNames.contains(tagName)) tagNames.add(tagName); ...
43de8b51-f10f-45c5-9c32-e6916d0e3d28
4
private static void send() { wLabel.setText("- VOID -"); lLabel.setText("- VOID -"); GWCAOperation operationToInvoke = (GWCAOperation) cb.getSelectedItem(); String parameterType = (String) cbType.getSelectedItem(); String wInput = wTextField.getText(); String lInput = lT...
0786c1b1-f6af-4b4e-a016-e055dcb87479
9
public void paintComponent(Graphics gfx) { super.paintComponent(gfx); Graphics2D g = (Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setFont(font); //g.setColor(Color.gray); //g.drawRect (0,0,get...
e0d753f8-4f7a-45f8-bfe2-32b822b68ce8
2
public static void insertCompte(Compte compte) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("insert into compte (typeCompte, solde, dateCreation, fk_id_utilisateur) values (?,?,?,?)"); stat.setString(1, compte.getTypeCompte()); ...
4c760745-bb30-4c69-a5ee-5d4a4565811d
9
@Test public void reTest2() { userInput.add("hi"); userInput.add("my name is meng meng"); userInput.add("i want to go to the canteen"); userInput.add("can i eat at line one"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling");...
e926962f-2f20-4176-b802-1e1e229bb816
2
@Override public IssueStatus getStatus() { if (statusValue == null || isEmpty(statusValue.getText())) { return null; } return IssueStatus.valueOf(statusValue.getText().trim()); }
9fb91af5-8f40-4e4d-abae-9ff99f5be41a
5
public void mouseDragged(MouseEvent me) { if (this.isEnabled()) { this.wasDragged = true; int tool = tools.getSelectedDrawingTool(); if (!(tool == Toolset.TOOL_EYEDROPER || tool == Toolset.TOOL_PAINT_BUCKET || tool == Toolset.TOOL_PENCIL) ...
b0414681-d395-40e4-8601-81166589c952
5
public void update(float delta) { for (Plant plant : this.plants) { plant.update(delta); } for (Rock rock : this.rocks) { rock.update(delta); } for (Light light : this.lights) { light.update(delta); } for (Nutrients nutrient : t...
917f2414-98a0-4614-9859-61e8f35b1658
3
static int dfs(int node, int num){ if(visited[node]) return num; num++; visited[node]=true; for(int neighbor: g.get(node)){ if(!visited[neighbor]){ num = dfs(neighbor, num); } } return num; }
3dd6474f-099a-4976-ae89-c9b56ffad622
7
static public <T> ConstructorAccess<T> get (Class<T> type) { try { type.getConstructor((Class[])null); } catch (Exception ex) { if (type.isMemberClass() && !Modifier.isStatic(type.getModifiers())) throw new RuntimeException("Class cannot be created (non-static member class): " + type.getName()); else ...
1511cd0d-38d1-4ebd-b000-a1925d3f6a66
0
public void placeDisk(String position){ board = board.placeDisk(position); this.passedBefore = false; }
3cfcea07-4f03-4c74-90ff-c69f1d68eae9
5
Object[] parameterForType(String typeName, String value, Widget widget) { if (value.equals("")) return new Object[] {new TabItem[0]}; if (typeName.equals("org.eclipse.swt.widgets.TabItem")) { TabItem item = findItem(value, ((TabFolder) widget).getItems()); if (item != null) return new Object[] {item}; } i...
c0679dc9-9d68-4334-8e04-3ca1f33a4129
9
public Matrix solve (Matrix B) { if (B.getRowDimension() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!this.isNonsingular()) { throw new RuntimeException("Matrix is singular."); } // Copy right hand side with pivoting int n...
6bb55b99-e4f3-47bf-8eae-7575a9b392b6
4
public int compareTo(Point that) { if (this.y < that.y) { return -1; } else if (this.y > that.y) { return 1; } else if (this.x < that.x) { return -1; } else if (this.x > that.x) { return 1; } else { return 0; } /* YOUR CODE HERE */ }
acb9532a-2fd5-4c28-9e96-f90bed62a897
9
public long transfer( final FileChannel dst, long position, long count) throws IOException { if (dst == null) { return 0; } if (this.completed) { return 0; } long bytesRead; if (this.buffer.hasData()) { ...
c7913bb4-ed09-48fd-9bcc-a7d70db3bd32
3
public void rendererCheckboard(CPRect r) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(r); for (int j = rect.top; j < rect.bottom; j++) { for (int i = rect.left; i < rect.right; i++) { if ((i & 0x8) != 0 ^ (j & 0x8) != 0) { data[i + j * width] = 0xffffffff; } else { data[i + j * ...
0957be74-843a-414b-a05f-bf0fdf5bf87b
8
protected double renderThread(Graphics2D g2d, Thread[] threads, int height, int width, int tdiam, int tradius, double angle, Thread t, Map<String, Integer> actorIdMap) { try { int x = width / 2 + (int) (Math.cos(angle) * tradius); int y = height / 2 + (int) (Math.sin(angle) * tradius); ActorRunnable ar = ...
7ba572ac-766a-4bc6-b69e-2fdbfe2ac8ad
6
private boolean isBankCommand(CommandName input) { return input == CommandName.newAccount || input == CommandName.getAccount || input == CommandName.deleteAccount || input == CommandName.deposit || input == CommandName.withdraw || input == CommandName.balance || input == CommandName.list; }
8fee1ecd-4539-4082-add7-1dccf87ca31e
0
public VertexChain(Graph g) { vertices = new ArrayList(); graph = g; }
c7f1291d-e613-462e-834c-83e7bb55767a
2
public static TreeMap<Double,Integer> rhythmRound(TreeMap<Double,Integer> rhythmTreeIn){ TreeMap<Double,Integer> rhythmTreeOut = new TreeMap<Double,Integer>(); Iterator<Double> rhythmIterator = rhythmTreeIn.keySet().iterator(); while(rhythmIterator.hasNext()){ double origKey = rhythmIterator.next()...
28467cd1-a537-4935-8253-42e4cbe0494c
9
public static ArrayList<String> getTrackList(){ JsonParser jp = null; boolean leadingKEY = false; String ldKEY = null; ArrayList<String> trackID = new ArrayList<String>(); try { jp = Json.createParser(new FileReader(DaemonMainController.getDatabasePath())); while(jp.hasNext()){ JsonParser.Event ...
1bfbae0a-84ed-41be-bd64-d6049f3f9454
2
@RequestMapping(method = RequestMethod.GET, value = "/login") public String getLoginPage(@RequestParam(value = "error", required = false) String errorMsg, @RequestParam(value = "msg", required = false) String msg, Model uiModel){ if (errorMsg != ...
3ec0531e-62da-42c0-9d78-654d186634d8
2
public String toString(){ String txt = "["; for (String[] values : allLines) { String line = " ["; for (String value : values) { line += " \"" + value + "\","; } txt += line.substring(0, line.length()-1) + " ],"; } txt = txt.substring(0,txt.length()-1) + " ]"; return txt; }
a53beb62-5515-418e-a396-8344c5fcca44
4
public void unreadFrame() throws BitstreamException { if (wordpointer==-1 && bitindex==-1 && (framesize>0)) { try { source.unread(frame_bytes, 0, framesize); } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR); } } }
d04f77f2-ab68-48f7-a5eb-268eb455a192
1
private static boolean isInteger(String s) { try { Integer.valueOf(s); } catch(NumberFormatException e) { return false; } return true; }
13ff8180-2ab1-4e04-a644-400f5d09bb63
2
public void execute() { final int initialTurns = (int) Math.ceil(3.0 / State.coolingRate) + 4; double safeTurns = state.robotGunHeat / State.coolingRate; if(state.time < initialTurns) { /* * Do we have enough time to move around before they can start * firing? */ if(safeTurns > 4) { doMoveme...
ba1f5f53-6a9b-458f-b9dc-0f7779a95c01
9
static final void method2131(int i) { if (i == 0) { if (Npc.anInt10503 == 2) { Class348_Sub40_Sub34.aClass293Array9432[0] .method2206(GfxLoader.aClass315Array3982[0]); Class348_Sub40_Sub34.aClass293Array9432[1] .method2206(GfxLoader.aClass315Array3982[1]); } else if (Npc.anInt10503 == 3) { ...
ef4186ff-6f3a-4d5f-b7cb-2b8d0506f26c
6
public void finalWinSimu(int total, int count){ int leftNum = total; int[] allPeople = new int[total]; int nextGoIndex = -1; for(int i=0;i<allPeople.length;i++){ allPeople[i]=i; } while(leftNum>1){ for(int i=1;i<=count;i++){ nextGoIndex = getNextIndex(nextGoIndex,total); while(allPeople[nextGo...
9181b0b4-4653-4bc5-bad0-0a9c6ba12752
7
public void obfuscate(RawCorpus corpus) throws UndefinedException{ ArrayList<ArrayList<String>> ret = new ArrayList<ArrayList<String>>(); System.out.println("obfuscating corpus ..."); if(corpus==null || corpus.getData()==null || corpus.getSize()==0){ System.err.println("non-input corpus..."); return ; } ...
f921cb9c-3338-4c30-bceb-4e93790e6bc5
7
public void move(int xa, int ya) { if (xa != 0 && ya != 0) { move(xa, 0); move(0, ya); return; } if (ya < 0) direction = 0; if (ya > 0) direction = 1; if (xa < 0) direction = 2; if (xa > 0) direction = 3; if (!checkCollision(xa, ya)) { x += xa; y += ya; } }
945764df-30ec-4118-bbed-4e70960d5c04
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/transition.gif"); return new javax.swing.ImageIcon(url); }
17009ed5-af73-4e9a-83b8-f5293eae31ab
6
public static int checkLogin(Db db, LogAc logAc, String userName, char[] password){ int i = 0; while (logAc.getDoctor(i)!=null){ if (logAc.getDoctor(i).getUserName().equals(userName)){ if (Arrays.equals(logAc.getDoctor(i).getPassword().toCharArray(),password)) return 1; } i++; } i = 0; while...
f8ff0925-4c36-4e4a-b5a9-d721352534be
3
@EventHandler public void crafting(PrepareItemCraftEvent e){ Player p = (Player)e.getViewers().get(0); ItemStack[] items = e.getInventory().getContents(); ArrayList<ItemStack> correct = new ArrayList<ItemStack>(); for(ItemStack i : items){ correct.add(i); } correct.remove(0); ItemStack result = e....
bc98b8c5-78ad-4368-a603-4ddf3463fe67
9
void Load(GL2 gl2,String fname) { name=fname; BufferedReader br = null; try { br = new BufferedReader(new FileReader(new File(fname))); String line; int j=0; while( ( line = br.readLine() ) != null ) { if( line.length() < 16 ) continue; j++; if(j==4) { j=0; num_triangles++; ...
b660c452-6d15-4c58-be56-1312f3eb935f
6
public static String trimTrailingZerosAfterDecimal(String buffer, boolean localized) { if (buffer != null) { buffer = buffer.trim(); int dot = buffer.indexOf(localized ? DecimalFormatSymbols.getInstance().getDecimalSeparator() : '.'); if (dot != -1) { int pos = buffer.length() - 1; while (true) { ...
91c547bf-188b-49a7-8ad3-b1c9b611f9ab
6
public Book getBook(long isbn) { //TODO Book ret = null; Connection conn = null; Statement st = null; ResultSet rs = null; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); st=conn.createStatement(); rs = st.executeQuery("SELECT isbn, t...
c5321341-db24-4883-80ab-66aa30b1805a
5
@Override public void keyReleased(KeyEvent e) { //only checks for user input if the game has started if(gameStarted){ if (KeyEvent.getKeyText(e.getKeyCode()).equals("Escape")) { // if the in game menu is up, close it if (ingameMenuActive) { closeIngameMenu(); } else { // otherwise bring ...
f66e2430-b46a-4e4b-a15b-738d96ba9772
5
@Override public boolean gainPassage(Oergi oergi) { if (jumpheight == 3) { //a wall, no real corridor return false; } Element element = oergi.getElement(); ElementMovability elementMovability = new ElementMovability(); Movability movability = elementMovability.getMovability(this.getBiotype(), element);...
a5226e07-2e0a-497c-918e-4d96040269eb
0
@Override public <T extends PersistentObject> T update(T entity) { return (T) dataStore.put(entity.getId(), entity); }
2c06d6b4-3578-4f75-944d-4703885b5277
4
public void set(String counterName, long[] countersValue) { if(counterName.equals("Reduce input groups")) { Reduce_input_groups = countersValue; } else if(counterName.equals("Combine output records")) { Combine_output_records = countersValue; } else if(counterName.equals("Map input records")) { Map_i...
619a3d56-c600-48d8-a288-0ac936eb6ad5
7
@Override public void actionPerformed(ActionEvent e) { // New button clicked if (e.getSource() == newPersonButton) { submitButton.setVisible(true); newPersonButton.setVisible(false); deletePersonButton.setEnabled(false); editPersonButton.setEnabled(false); cancelButton.setVisible(true); if (subm...
596706fb-0bd1-44b7-829d-791b018d961a
0
public int numCasesTotal() { return myAllCases.size(); }
5a06a214-124c-4578-b01f-8ad4605abe65
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
d8d62a15-c80f-46d0-bc8d-ebc4f814f949
7
public void spawnEtoile() { if(timer > 0) timer --; else { int x = 0; int y = 0; while(carte[x][y] == '1' || carte[x][y] == '4' || carte[x][y] == '2' || carte[x][y] == '5') { x = (int)(Math.random()*(width-2)+1); y = (int)(Math.random()*(height-2)+1); } if(carte[x][y]=='3') ca...
24135201-66ab-4d76-ba89-823d81181b2e
1
public void updateProduct(Product product) { try { beginTransaction(); session.update(product); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSesion(); } }
01722c95-211c-4ee6-a6a1-f0eef92bae14
9
@Override public boolean equals( Object toCompare ) { //only deal with PolynomialTerm comparison if ( toCompare instanceof PolynomialTerm ) { //check for equaling to zero if ( toCompare instanceof Numerical ) { if ( toCompare.equals( Numerical.ZERO ) ) { for ( Monomial aTerm : this.m_numerato...
b1d837dc-59a6-4c01-8a7b-503c8044e124
7
private void addSongsToPlaylistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSongsToPlaylistActionPerformed JPanel panel = new JPanel(); JList list = new JList(); Map<String, Library> playlists = currUser.getLibrary().getPlayLists(); Vector<String> tmp = new Vector<String>(); for...
b96184ef-3ef5-402e-bc76-86f64f562c51
2
public static boolean deleteNode(ListNode node){ if(node == null || node.next ==null) return false; ListNode next = node.next; node.val = next.val; node.next =next.next; return true; }
5a845985-20ed-466a-8752-dc4f2d52edfd
6
public static void loadFromFile(File f) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String inlin = ""; int line = 0; while((inlin = in.readLine()) != null) { String lin = comment.matcher(inlin).replaceAll(""); ...
80bb0bc9-ff88-47b9-a32d-7116237ba14d
1
public static double[][] identity( int n ) { double[][] res = newMatrix(n, n, 0.0); for ( int i = 0; i < n; ++i ) res[i][i] = 1.0; return(res); }
e5404cbc-7ec2-4511-94e3-8acbe252059c
4
private static void sendMsgToClient(Process process, BufferedReader buffer, IoSession session, boolean isNormal) throws IOException { String msg; try { buffer = new BufferedReader(new InputStreamReader( isNormal ? process.getInputStream() : process.getErrorStream())); while ((msg = buffer.readL...
fae553d6-798f-449f-8beb-3113f5d8a82b
2
public static void processSpherePlaneCollision(RigidBody plane, RigidBody sphere, double restitution, double timeStep) { // Predicted positions Vector3d planePosition = new Vector3d(); Vector3d spherePosition = new Vector3d(); Quat4d planeRotation = new Quat4d(); Quat4d sphereRotration = new Quat4d(); s...
9caa9612-c665-481a-bdca-3cf479690f82
5
private void sumNumbersRec(TreeNode root, int tmp) { if(root == null) return; if(root.left == null && root.right == null){ this.res += tmp + root.val; } if(root.left != null){ sumNumbersRec(root.left, (tmp + root.val) * 10); } if(root.right != null){ sumNumbersRec(root.right, (tmp + root.val) * 10)...
4dc8c8b2-7f5e-43d9-81d4-29c83941293a
5
public void updateLookAndFeel(String newlnfClassName) { if(newlnfClassName != null) { try { UIManager.setLookAndFeel(newlnfClassName); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e....
8d1102ac-7bb8-4ee9-a6cb-8765f44d09b6
2
public void run() { double t = 5; //timeScale; int i = 0; while (true) { rungeKutta(t); if (i>1000){ System.out.println(bodies.get(3).position); i = 0; } i++; } }
3f984524-a9da-4177-9fa8-26315e835e65
0
@Override public double getHig() { return hight; }
ac28450e-9fab-4053-83ab-1f7b09871822
2
private SootMethod getMethodFromHierarchyEx(SootClass c, String methodSignature) { if (c.declaresMethod(methodSignature)) return c.getMethod(methodSignature); if (c.hasSuperclass()) return getMethodFromHierarchyEx(c.getSuperclass(), methodSignature); throw new RuntimeException("Could not find method"); }
47ba463c-eabc-4633-a972-527988a2ae4c
8
private void build_map(HashMap<Character,String> m1,HashMap<String,Character> m2) { int i=1; int j=1; int k=1; boolean[] filled=new boolean[26]; for(int m=0;m<keyword.length();m++) { char cur_c=keyword.charAt(m); int char_pos=cur_c-'A'; if(!filled[char_pos]) { String...
893aa04d-6571-40eb-ad41-ba9c46c38a3a
2
private void paintBoard(PaintEvent event) { for (int xCoordinate = 0; xCoordinate < game.getBoardWidth(); xCoordinate++) { for (int yCoordinate = 0; yCoordinate < game.getBoardHeight(); yCoordinate++) { paintCell(event, xCoordinate, yCoordinate); } ...