method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
510b3081-e4e0-4017-89a4-9946a6c1a4f6
1
@Override public void serialize(ByteWriter bw) throws IOException { bw.write4bytes(size); bw.write4bytes(signature); bw.write4bytes(0x58); bw.write4bytes(0); byte[] b = netbios.getBytes(); bw.writeBytes(b); for (int i=0; i<16-b.length; i++) bw.write(0); d1.serialize(bw); d2.serialize(bw); db1.se...
5566f41d-9071-4a6a-906d-2830094a84ca
7
private int buildStraight(int xo, int maxLength, boolean safe) { int length = random.nextInt(10) + 2; if (safe) length = 10 + random.nextInt(5); if (length > maxLength) length = maxLength; int floor = height - 1 - random.nextInt(4); //runs from the spe...
2669bdf3-b49f-4b06-91d7-6d799519ca71
2
public List<Player> choosePlayersBasedOnMode() { Player playerOne; Player playerTwo; List<Player> players = new ArrayList<Player>(); if (getMode() == 1) { System.out.println("Mode 1 is selected "); playerOne = new HumanPlayer(); playerOne.setSymbol('X'...
260bcfd2-296b-4fb5-959a-317d9cd9020e
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
a4eada64-1ab1-4523-99ea-9beba27fec88
2
public MemExpr get_local(final int vn) { final Iterator iter = LocalStore.keySet().iterator(); while (iter.hasNext()) { final MemExpr le = (MemExpr) iter.next(); if (le.valueNumber() == vn) { return le; } } return null; }
145ec41d-3005-43dd-b7fa-712a7949b2ef
7
private void getContextNodeLongToShort() { while (_contextLength >= MIN_CONTEXT_LENGTH) { _contextNode = lookupNode(_contextLength); if (_contextNode == null || _contextNode.isChildless(_excludedBytes)) { --_contextLength; continue; } while (_contextLength > MIN_CONTEXT_LENGTH && _contextNode.isDetermi...
23ad44eb-52e9-4141-be36-c7bd8557e5b8
8
public static ArrayList<String> mergeSort(ArrayList<String> unsorted) { if (unsorted.size() <= 1) return unsorted; int mid = unsorted.size()/2; ArrayList<String> left = new ArrayList<String>(); ArrayList<String> right = new ArrayList<String>(); int m = 0; while (m < mid) { left.add(unsorted.get(m))...
433f9e4d-b00a-4039-ab20-fa50fb23f8d1
4
public void determineSession(Request request, Response response){ HttpCookie cookie = request.getCookie("pts_sessionid"); SessionData session = null; if(cookie != null){ session = sessions.get(cookie.getValue()); } if(cookie == null || session ...
1cf5b9e0-8f83-4659-81f8-8214e1e00f9d
9
public static ChatCommand getCommand(byte cmd) { if (cmd == 1) return NAME_CHANGE; else if (cmd == 4) return TEXT_ALL; else if (cmd == 5) return TEXT_ONE; else if (cmd == 19) return VERSION; else if (cmd == 26) return PING_REQUEST; else if (cmd == 27) return PING_RESPONSE; else if (cmd =...
c51de3fa-deb7-4f4a-9a65-992545fa0e2f
1
@Override public int hashCode() { int result = moduleId != null ? moduleId.hashCode() : 0; result = 31 * result + personId; return result; }
6bc6245c-2d70-45ae-8343-061647ed84a9
8
public ArrayList<CellStringPair> findStrings(){ ArrayList<CellStringPair> result = new ArrayList<CellStringPair>(); int width = getWidth(); int height = getHeight(); for(int y = 0; y < height; y++){ for(int x = 0; x < width; x++){ if(!isBlank(x, y)){ Cell start = new Cell(x, y); String str = St...
333f1524-eb2d-45b0-acee-d0483578a07e
4
private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0); return 10; } switch(curChar) { case 99:...
3783f090-0b71-4506-8f71-c2e08a472533
3
public void verbindeZweiRaeume(String richtung, Raum nachbar, String gegenRichtung) { // Abbrechen, wenn null übergeben wird. Dies darf vorkommen, sollte aber // keinen Effekt haben. if(nachbar == null || richtung == null || gegenRichtung == null) { return; } this.setAusgang(richtung, nachbar); nac...
03962c2f-465c-4455-b718-6363cb0eb2d7
1
public static void main(String[] args) { Main m = new Main(); m.args(args); if (m.CLI) m.cli(); else m.batch(); }
4c4befc4-d51c-4e46-97fa-b46fdf355ce3
4
public String getOptionArgument(CmdLineOption option) { if (isOptionUsed(option)) { for (CmdLineData one : mData) { if (one.isOption() && one.getOption() == option) { return one.getArgument(); } } } return null; }
828a2ee4-95f1-4d85-8a8e-a5f972d8abce
6
public void receiveShipment(String shippingID) { // The replenishment of the product from the shipping notice is added // to the items current quantity // Assumes that a new product in the shipment is already inserted in the ProductDepot // table in receiveShippingNotice System.out.println("Receiving ship...
3e83c00a-711b-4623-9e8f-af311b3372d1
9
public void readOrderedLog (){ cleanupStructures(); HashMap<int[], String> unorderedLogMap= readLogFromTextfile(); Set<int[]> clock = unorderedLogMap.keySet(); int clocks[][] = new int[clock.size()][clock.iterator().next().length]; int index = 0; for(int[] c : clock) { clocks[index] = c; index++; ...
cb6c3567-b4b6-492c-81e4-842698e2a923
5
public JSONObject increment(String key) throws JSONException { Object value = opt(key); if (value == null) { put(key, 1); } else if (value instanceof Integer) { put(key, ((Integer)value).intValue() + 1); } else if (value instanceof Long) { put(key, ((L...
3664bed6-2150-450c-9ea1-30d9bf74eaf2
1
public void setKillTimer(float countdown) { addTimeListener(new TimeListener() { private float killTimer = countdown; @Override public void timeStep(TimeEvent e) { killTimer -= e.getDelta(); if(killTimer <= 0) { setState(UIElement.KILL_FLAG); } } }); }
2374d567-075a-467d-b180-b5a14efb39e2
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
e50449fb-d205-4c40-9d58-683e5999e36d
8
String ToString() { String retVal = "**************\n" + name + ": \n"; retVal += "************** \n"; retVal += "\t " + maxLength + " the maximum length of a domain\n"; retVal += "\t " + minLength + " the minimum length of a domain\n"; retVal += "\t " + averageLength + " The ave...
92316615-0de4-4fc1-9bef-f3e5ff9dcafb
6
@Override public void render() { minus.render(); plus.render(); if (enabled) glColor3f(1, 1, 1); else glColor3f(0.5f, 0.5f, 0.5f); String title = (titles[Math.round(value - min)] != null) ? titles[Math.round(value - min)] : value + ""; if (rot == GuiRotation.HORIZONTAL) { int tx = FontAssistant...
5bfd8236-06d6-4803-8878-b275855dff70
1
public void accept(final MethodVisitor mv) { Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = ((LabelNode) this.labels.get(i)).getLabel(); } mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels); }
24fe355c-56ab-4381-9761-11c128dcc0c4
8
public int maxPathSum(treeNode curRoot) { int maxPathNotRoot; int maxPathAsRoot; int curMax; int maxPathFinal = 0; treeNode p = curRoot; // max for left tree do { p = p.leftLeaf; maxPathNotRoot = maxPathNotRoot(p); maxPathAsRoot = maxPathAsRoot(p); curMax = maxPathNotRoot > maxPathAsRoot ? m...
e874c2ec-6495-452f-bcc4-8c3dcbb40654
6
@Override public Result run() { Result result = null; try { Equals<Double> criterion = this.getCriterion(); Function<Double, Double> function = this.getFunction(); double goalValue = this.getGoalValue(); double value = this.getInitialValue(); ...
0acb7253-9456-48e8-8619-048057ea4d45
1
public Type getSuperType() { return (this == tObject) ? tObject : tRange(tObject, this); }
4c6dc5a1-c5fe-4360-8ece-6bcde3de36f0
4
private static boolean containedBy(DockLayoutNode node, int x, int y) { if (node != null) { int edgeX = node.getX(); if (x >= edgeX && x < edgeX + node.getWidth()) { int edgeY = node.getY(); return y >= edgeY && y < edgeY + node.getHeight(); } } return false; }
88079439-2968-4fc7-b8e0-506eb33522b0
3
private void Procurar_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Procurar_ButtonActionPerformed // TODO add your handling code here:\ clearTable(Jogadores_Table); int i = 0; Escola escola = a.getDAOEscola().get(Escola_ComboBox.getSelectedItem().toString()); ...
d0977069-9138-416f-a988-7310c0c12b6a
4
public JPanelTauler( boolean partida_en_curs ) { // Inicialitzem els atributs. elements_de_control_partida = PresentacioCtrl.getInstancia().getElementsDeControlPartida(); elements_de_control_jugadors = PresentacioCtrl.getInstancia().getElementsDeControlJugadors(); ultima_pista = new Casella( 0, 0 ); pista_va...
80efaaf1-1eff-4f4e-bd97-c6f21b57aa0e
9
public void write(long pos, byte[] buf) { file.write(pos, buf); synchronized (mutex) { if (pageTimestamps != null) { int pageNo = (int)(pos >> Page.pageSizeLog); if (pageNo >= pageTimestamps.length) { int newLength = pageNo >= pageTimest...
ef63a09f-b60a-451c-9b92-f8524905504d
8
public void update(final FrameStatistics stats) { List<Long> statsThisUpdate = new ArrayList<Long>(); for (InputStatistics is : stats.getInputStats()) { InfoBox infoBox = infoBoxes.get(is.getId()); if (infoBox == null) { infoBox = new InfoBox(); infoBoxe...
8b7bf39a-1833-466e-9763-069cbd540d85
9
boolean tryPlace(int i, int x1, int y1, int x2, int y2) { if (x2 < 0 || x2 >= w || y2 < 0 || y2 >= h) return false; // not empty place if (field[x1][y1] != -1 || field[x2][y2] != -1) return false; // border OK if (isValid(D[i].d1, x1, y1) && isValid(D[i].d2, x2, y2)) { // mark D D[i].x1 = x1; D...
97a52c1e-5e05-4e32-9100-87d93bcac6b8
8
@Override public void run() { //System.out.println("Client: Thread Start Send"); PrintWriter out = null; BufferedReader in = null; String servLine = null; if (sock == null) { return; } try { out = new PrintWriter(sock.getOutputStream(), true); ...
e7e544ed-d77b-4037-844b-1c6f39290b21
6
@Override public Object getValueAt(int row, int col) { StockItem s = info.get(row); switch (col) { case 0: return s.getChargeNo(); case 1: return s.getMaterial().getName(); case 2: return s.getCoilType().getThickness(); case 3: return s.getLength(...
f4068dbe-b364-4ee6-8c44-6474e4a7c4bb
0
public void setId(int id) { this.id = id; }
c0c920a3-b35a-4385-ae6a-92bf7b176820
3
private void initColumnName(ResultSet rs) throws SQLException { if (columnNameSet.isEmpty()) { synchronized (columnNameSet) { if (columnNameSet.isEmpty()) { ResultSetMetaData metaData = rs.getMetaData(); int columnCount = metaData.getColumnCount(); for (int i = 1; i <= columnCount; i++) { ...
d9ce8b57-6d16-452e-bdf3-1e7b6c83d9ab
5
private void initPageResources() throws InterruptedException { Resources res = library.getResources(entries, "Resources"); if (res == null) { PageTree pt = getParent(); while (pt != null) { if (Thread.interrupted()) { throw new InterruptedExcep...
f7a1fe49-c76e-470b-927a-362f8aa1f812
5
@Override public int hashCode() { int hash = 7; hash = 97 * hash + (this.car != null ? this.car.hashCode() : 0); hash = 97 * hash + (this.customer != null ? this.customer.hashCode() : 0); hash = 97 * hash + (this.from != null ? this.from.hashCode() : 0); hash = 97 * hash + (t...
de7ff9de-4a04-495e-b2ea-f524750a2902
3
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { if (!Helpers.isValidDouble(jTextField1.getText())) { JOptionPane.showMessageDialog(this, "Please enter valid number", "Number Format Error", JOptionPane.ERROR_MESSAGE...
0562ccaa-0d42-43a9-9728-7b928b12f8bc
9
public static String getName(EventObject e){ Object o=e.getSource(); //XAux.pl("source "+o); if(o instanceof JComponent){ Object v=((JComponent) o).getClientProperty("name"); if(v!=null)return (String)v; } else if(o instanceof Document){ Object v=((Document) o).getProper...
9d7ddee3-08dd-47ac-8dd2-34ebc0400e33
1
public CtMethod getMethod(String name, String desc) throws NotFoundException { CtMethod m = getMethod0(this, name, desc); if (m != null) return m; else throw new NotFoundException(name + "(..) is not found in " + getName...
9f2228e6-8f66-4dce-b912-8975f21aa7ec
2
public Connection findConnection(RouteLeg currentRouteLeg) { Connection foundConnection = null; for(Connection currentConnection : connections) { if (currentConnection.connects(currentRouteLeg)) { foundConnection = currentConnection; break; } } return foundConnection; }
14587df7-2ace-463f-871b-34470e554d6f
1
public static String convertObjectToString(Object value) { if (value != null) { return value.toString(); } else { return null; } }
81ceb4af-ad68-49b1-ab88-26d6cb8203f9
3
public void addElementToPosition(Element element, Position position) { if (element == null || position == null) throw new IllegalArgumentException("The given parameters are invalid!"); if (validElement(element, position)) getSquare(position).addElement(element); }
859da420-2e8c-49d0-8bdb-3ed5657254fe
9
public static String accentManager (String word) { for (int i = word.indexOf("-a"); i != -1; i = word.indexOf("-a")) { word = word.substring(0, i) + "á" + word.substring(i+2, word.length()); } for (int i = word.indexOf("-e"); i != -1; i = word.indexOf("-e")) { word = word...
e54ee6fb-a643-45cf-82d3-e4bbf7713dbb
4
public String toString() { String s = ""; for (int y = plateau[0].length - 1; y >= 0; y--) { for (int x = 0; x < plateau.length; x++) { if (plateau[x][y] == 1) s += "X "; else if (plateau[x][y] == 0) s += "O "; else s += "" + plateau[x][y]; } s += "\n"; } return s; }
0a812d29-81e9-49bd-816f-0df2d6354649
1
public void escribirPersonaJAXB(String rutaFichero, LinkedHashMap<Integer, Persona> personas) { rutaFichero = rutaFichero + ".xml"; try { MapPersona mp = new MapPersona(); mp.setMapPersona(personas); JAXBContext jaxbContext = JAXBContext.newInstance(MapPersona.class);...
9c47c687-8ea5-40b8-9ab9-7deda933944c
2
public String toString() { if (length == 0) { return "code has no bits yet"; } String str = ""; for (int i = length - 1; i >= 0; i--) { str += getBit(i); } return str; }
bef5eb98-c914-4130-afef-173204f891bd
6
private void addDirToList(S3Item item, ArrayList<S3Item> fileList) { if (item.isDir()) { Collection<S3Item> children = item.getChildren(true); if (children.size() < 750) { for (S3Item child : children) { if (!child.isDir()) { fileList.add(child); } } } else { for (S3Item c...
5ba0a178-ca92-44a7-ac84-557e682e595a
5
public Quadrato(Damiera dam, int r, int c) { damiera=dam; riga=r; colonna=c; attivo=false; this.setOpaque(true); if(damiera.getPosizione(riga, colonna).getSfondo()==false) //assegnamento del background. this.setBackground(Color.BLACK); else { setEnabled(false); this.setBackground(new Col...
5cbfdf3d-ea4e-4056-b4db-bb5d4afadd0b
5
public static ArrayList<Boolean> decimalToBinary(Integer integer, int n) { ArrayList<Boolean> result = new ArrayList<>(); if (integer == 0) { result.add(false); for (int i = 0; i < n - 1; i++) result.add(false); Collections.reverse(result); return result; } while (integer != 0) { if (int...
3ad786a1-7a65-4be7-b9e0-2d9b80f71083
9
public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException { if ( isHasNodeIdentifier() ) { writer.write( ForesterUtil.LINE_SEPARATOR ); writer.write( indentation ); // if ( !org.forester.util.ForesterUtil.isEmpty( getNodeIden...
2f0bd6e2-47fd-4f5c-bdb2-27f97682caa2
7
public static String longestPalindromeDP(String s) { char[] str = s.toCharArray(); int n = str.length; int longestBegin = 0; int max = 1; boolean table[][] = new boolean[1000][1000]; java.util.Arrays.fill(table[0], false); java.util.Arrays.fill(table[1], false); for (int i=0; i<n; i++) {...
135e0efc-753c-421a-9fb3-0b58b5f717bb
1
public static void main(String[] args) { int x = 0; System.out.println((x != 0) && ((10 / x) > 1)); //false }
57d9af4b-da7b-4ff7-a20e-4ac396c92e84
9
public void handleUpdateUserInfo(Packet10UpdateUserInfo packet, InetAddress address, int port) { Player player = null; if (packet.getRace().equalsIgnoreCase("human")) player = new Human(game, packet.getName(), address, port); else if (packet.getRace().equalsIgnoreCase("cyborg") && packet.getColor().equalsIgnor...
45db76dc-0821-4af2-91fd-d2805c98a350
1
public int getRT() { // need to get rid of R if(!immediate) return Integer.parseInt(inst[3].substring(1)); return -1; }
4b056577-aab8-4879-8914-e8f28754bc8e
7
public final Object pop() { if (sealed) throw onSeledMutation(); int N = size; --N; Object top; switch (N) { case -1: throw onEmptyStackTopRead(); case 0: top = f0; f0 = null; break; case 1: top = f1; f1 = null; break; case 2: t...
8ce77c2e-bd64-4db3-a930-b55202bf2db3
8
private static void solveEven(int n, int m, boolean switched) { System.out.println(0); for (int i = 1; i <= m; i++) { print(1, i, switched); } for (int j = 2; j <= n-1; j++) { boolean evenRow = (j % 2 == 0); int start = (evenRow ? m : 2); i...
2603f3dc-270c-4597-8c17-cff6890de25f
1
protected byte[] computeSHAdigest(final byte[] value) { try { return MessageDigest.getInstance("SHA").digest(value); } catch (Exception e) { throw new UnsupportedOperationException(e.toString()); } }
18e35b69-4b0e-49f6-ae0e-583e75cec29c
4
public void run() { // TODO Auto-generated method stub try { System.out.println("hhhhhhhhhhhhhhhhhhhh"+ip_client); char ip1[]=ip_client.toCharArray(); if(ip1[0]=='/') ip_client=new String(ip1,1,ip_client.length()-1); System.out.println("hhhhhhhhhhhhhhhhhhhh"+ip_client); ...
bbc43a13-6c3f-4189-af8e-9090b3e5b56d
9
@Override public void caseAIdxAcsStmt(AIdxAcsStmt node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(AssignArray"); inAIdxAcsStmt(node); if(node.getIdentifier() != null) { node.getIdentifier().apply(this); ...
d3c8c1c0-fedb-4ae8-acb3-5e0e025a9213
2
private void multiplyAndStackUV(double[][] srcU, double[][] srcV, double[][] dst, int colNo, int widthV, int heightU) { for (int x = 0; x < widthV; x++) { double srcElemV = srcV[colNo][x]; for (int y = 0; y < heightU; y++) { // the colNoth column of U times the colNot...
94aa5c7f-772a-454d-8fa3-15aaff773117
7
private void sort2(int[] arr,int up,int down){ int pivot=up+(down-up)/2; int i=up; int j=down; if (up>down) while(i<=j) { if(arr[i]<arr[pivot]) {i++; } if(arr[j]>arr[pivot]) {j--; } if(i<=j) { int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--; } if (up<j) { sort2(arr,up,p...
ef7e02c6-50d9-4127-8731-8815a214c7b7
5
@SuppressWarnings ("unchecked") protected final void remove(final BaseItem item) throws NullPointerException, IllegalStateException, IllegalArgumentException { switch (item.state()) { case Item.APPEND_STATE: case Item.UPDATE_STATE: if (!this.equals(item.pool())) throw new IllegalArgumentException(); th...
af45c3ae-152a-4255-aa56-54e21b83862e
7
private int unEscapeCharData(int token) { if (token == '<') return tError; if (token != '&') return token; getNext(); String sToken = getString(); if (sToken.startsWith("gt;")) return _gt; if (sToken.startsWith("lt;")) return _lt; if (sToken.startsWith("amp;")) return _amp; if (sToken.sta...
742e6702-e698-49c8-bb58-5fc766a89087
5
public static void main(String s[] ) { key = new Scanner(System.in); System.out.println("enter the first number"); int num1=key.nextInt(); System.out.println("enter the second number"); int num2=key.nextInt(); int count=1; if(num2-num1>=100) while(count!=100) { for(int i=num1;i<=num2;i...
854c02ac-45a3-4cb7-b038-b156253a17cf
0
public Record getRecord() { return record; }
138d0192-4bf6-4e2b-9a9b-2337c0c17fbf
0
@Override public void actionPerformed(ActionEvent e) { Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().undo(); }
d6d3c74a-edf5-4da3-8acc-0c5d0a9f9b76
7
public void getTile(int x, int y){ int[] hitBox; Tile temp; Tile newTile; if(x < 0 || y < 0 || x >= w || y >= height){ System.out.println("Outside Map"); tilesPosition(new Tile(x * width, y * height, this, true, false, tile.get(1).getAnimatedSprite())); }else if(tile.containsKey(tiles[x + y * w])){ t...
d46e1365-93da-4655-b158-bc28ef170193
8
public static void main( String args[] ) { int nbPersonnages = 0; // nombre courant de personnages // // cration du tableau de personnages // Personnage pers[] = new Personnage[ MAX_PERSONNAGES ]; // // cration des personnages // pers[ 0 ] = new Sorcier( "Kalam...
3e106e16-2f54-4fa5-a14d-1faa44c56bae
6
boolean checkedBlockIsWithinFurnaceCheckCube(int checkedX, int checkedY, int checkedZ, int furnace_x1, int furnace_x2, int furnace_y1, int furnace_y2, int furnace_z1, int furnace_z2) { boolean res = false; if((checkedX >= furnace_x1) && (checkedX <= furnace_x2) && (checkedY >= furnace_y1) &&...
bb1447e6-210f-49f5-9c9c-8ff9f9a772e0
5
public void affichePlateau(){ System.out.print(" "); for (int i = 0; i < g.getTaille(); i++){ System.out.print(i + " "); } System.out.println(); for (int i = 0; i < g.getTaille(); i++){ System.out.print(i+" "); for (int j = 0; j < g.getTaille...
d84d2d47-97b2-4d45-b4ea-12664b5573d2
1
public void testSetTime_int_int_int2() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.setTime(60, 6, 7, 8); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
6ae6f2a8-645e-4c5a-9c6b-e32bb1607d57
9
public void expire() { this.expired = true; Logger.log("Expired effect: " + this.type, 1); // Un-apply effect switch (type) { case BOTTOM_WALL: break; case ENLARGE_PADDLE: App.getMainWindow().getScene().getPaddle().shrink(); break; case FIREBALL: break; case MULTIBALL: b...
930aa925-5644-4e29-9683-b49f5ded1868
9
private LinkedList <Migration> getMigrationList () { File migrationDir; try { migrationDir = new File (Tatoo.class.getResource ("/tatoo/db/migrate").toURI ()); } catch (URISyntaxException e) { e.printStackTrace (); migrationDir = null; } ...
9c9f7bf2-09a4-4994-ba24-2bf5cc0c079b
0
public void setResourcePackages(List<ResPackage> resourcePackages) { this.resourcePackages = resourcePackages; }
e3cd3449-d5e5-4605-a98f-603f32ec67fa
2
public void setAddress(String address) { if(address == null || address.isEmpty()){ throw new IllegalArgumentException(); } this.address = address; }
647accc3-ed9b-4a0c-989d-d874ce3d5f59
2
public static void main(String[] args) { int linkedListLength = Integer.parseInt(args[0]); int kPositionFromEnd = Integer.parseInt(args[1]); Node headNode = null; if(kPositionFromEnd>linkedListLength || kPositionFromEnd<=0){ System.out.println("Please enter a valid value for Kth position from end")...
388c9aa7-3ea2-4d78-81bc-39b67aaeab19
2
public static IntNode[ ] listPart(IntNode start, IntNode end) { IntNode copyHead; IntNode copyTail; IntNode cursor; IntNode[ ] answer = new IntNode[2]; // Make the first node for the newly created list. Notice that this will // cause a NullPointerException if start is null....
26ee2c31-ede3-449c-8ea6-aca246bbde42
0
public void setGraphY(int y) { this.graphY = y; }
eed0c1c7-9b4a-4e5e-bf61-e20f9615ae3e
4
@Override public void close() { if (readMonitor != stdin) { try { in.close(); } catch (IOException e) { System.err.printf("Cannot close console input. %s: %s%n", getClass(), e.getMessage()); } } if (out != stdout) { try { out.close(); } catch (IOException e) { System.err.printf("Ca...
8664f707-4f2c-4aef-b4f2-8a48464d55fe
5
private void checkStart() { if (mapFile != null) { if ((MapInterpreter.mapchecker(mapFile.getAbsolutePath())) && listOfBrains.size() > 2) { startButton.unlock(); setButtonGreen(startButton); } else { setButtonRed(startButton); startButton.lock(); } } else if (mapMap != null) { if (l...
bf0a95f8-e5b5-459e-817f-f61317ac7cc2
2
public int getScore() { int frameScore = 0; if (isStrike()) { frameScore += MAXPIN + strikeAdditionalScore(); } else if (isSpare()) { frameScore += MAXPIN + spareAdditionalScore(); } else { frameScore += getFrameScore(); } return frameScore; }
0602b337-21eb-4f17-a2cf-ac0f477253e5
2
private void writeList() { String mapperName = table.getDomName() + "Dao"; for ( Column column : table.getColumns() ) { if ( column.isSearchId() ) { // do this to make sure the created method is properly // camelCased String fieldName = column...
b22e9017-a478-4119-a4fd-d33a9c6d0f6b
3
private void actionClosePanel() { AbstractTab tab = MainWindow.getInstance().getActiveTab(); if (tab == null) return; if (tab instanceof ChannelTab) { InputHandler.handlePart(""); } else if (tab instanceof PrivateChatTab) { tab.getServerTab().removeP...
19767c1c-c9c9-4447-b73f-bbb1a8a1ac05
1
public static void main(String[] args) { try { sig = new SigService(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { SwingGUI.showGUI(); } }); }
06f35706-494f-41bc-8764-11df85729b77
8
public void PHPFileIncludes(int TARGET_PHP_FILES_ID, DatabaseAccess JavaDBAccess, PHPFileOperations PHPFile) { PreparedStatement ps = null, psUpdate = null; ResultSet rs = null; String PHPFileTextClean = ""; String RegExpText = "", host = "", HostPath = ""; Boolean CaseSensitive...
bb293c6f-4ed8-4513-9186-4560c4ff11e7
4
void reduce(String s, int a, int b) { for (int i = 0; i < validSet.length; i++) { if (!validSet[i]) { continue; } if ((getA(s, answerSet[i]) != a) || (getB(s, answerSet[i]) != b)) { validSet[i] = false; } } }
6937a7d5-8c64-4395-bd0e-11426422e506
4
public static String getBanner(String playerName){ String banner = "Not Banned"; if(isBanned(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM bans WHERE username='" + playerName + "'"); // This loop checks...
9d3b1303-7e6a-43f3-8feb-664b42c1496d
9
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirect...
8982b566-e91e-4322-8ffe-93a5b474b8da
3
private Pair<PlayerData, PlayerData> getNearFarPlayers(ArrayList<PlayerData> players){ PlayerData closestPlayer = new PlayerData(); // make a new place to record the closest player PlayerData furthestPlayer = new PlayerData(); // make a new place to record the furthest player closestPlayer.setDi...
9cdd3cc6-a101-4dc8-8af9-c71ef80e170a
0
public void setSessionId(String sessionId) { this.sessionId = sessionId; }
f40d53e2-ee64-4b3c-a76a-5558a46c3586
4
public void drawFilledPolygon(double... positions) { if(positions.length == 0 || positions.length % 2 != 0){ Main.fatalError("You are trying to draw a polygon which hasn't got an even number of parameters.\n"); } for(int i = 0; i < positions.length; i++){ double paramx = positions[i]; double paramy = pos...
7a2cb5f3-8a22-4263-ab33-ce8a8aea8187
2
public void select(NodoGrafico n) { if (selected != null) selected.unselect(); selected = n; if (selected != null) { btnRemove.setEnabled(true); selected.select(); } else btnRemove.setEnabled(false); repaint(); }
e1d32cdf-ba57-4593-8bde-c8a4a40ea729
9
public synchronized ClickstreamConfig getConfig() { if (config != null) { return config; } InputStream is = getInputStream("clickstream.xml"); if (is == null) { is = getInputStream("/clickstream.xml"); } if (is == null) { is = getInputStream("META-INF/clickstream-default.xml"); } if (is == nu...
06d565f0-bf1a-4db4-bec4-e66fd08acc86
1
public static void newGame(){ System.out.println("Starting new game..."); empireName = JOptionPane.showInputDialog(null, "Enter your empire's name:", "Empire Name", JOptionPane.QUESTION_MESSAGE); //JOptionPane.showInputDialog(parentComponent, message, title, messageType, icon, selectionValues, initialSelectionVal...
80ab9f54-734d-42e1-8edf-1736c09f447c
9
@Override public void drawHeader(Graphics2D gc) { super.drawHeader(gc); boolean active = isFocusOwner(); Rectangle clipBounds = gc.getClipBounds(); int left = clipBounds.x; int right = clipBounds.x + clipBounds.width; Rectangle colBounds = getHeaderViewBounds(); int dividerWidth = getColumnDividerWidth()...
5b35645f-92b3-47e3-9ec0-53fcb4ca942b
8
private static int calculateFitness(String gene) { /// chromosomeSectorSize int fitness = 0, numberOfUtilities = 0, utilitieIndex; int[] numberOfR = new int[chromosomeSectorSize]; char[] arr = gene.toCharArray(); for(int i = 0; i < numberOfR.length; i++) numberOfR[i] = 0; for (int i = 0; i <...
1c5b6d8c-a1ed-4697-8b9b-4948af0060b9
6
private void deleteButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButActionPerformed int delete = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this Property", "Comfirm Deletion", JOptionPane.YES_NO_CANCEL_OPTION); if (delete == JOption...
fd890516-1fbd-4a25-826c-2a4eca7949f9
3
private void checkForBodiesToDelete() { Array<Body> bodies = new Array<Body>(); this.box2DWorld.getBodies(bodies); for (Body body : bodies) { Entity data = (Entity) body.getUserData(); if (data != null && data.isFlaggedForDelete()) { this.box2DWorld.destroyBody(body); } } // for(int i = 0; i<lette...