method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5271b4c3-0d86-4085-b0cb-dee1a6cbea8b
5
private void addAllAttributes(String shaderText) { final String ATTRIBUTE_KEYWORD = "attrib"; int attributeStartLocation = shaderText.indexOf(ATTRIBUTE_KEYWORD); int attribNumber = 0; while(attributeStartLocation != -1) { if(!(attributeStartLocation != 0 && Character.isWhitespace(shaderText.charAt(attribu...
7cf58855-c8fb-4f9e-9481-23e8670fe489
9
@Override public void execute(Runnable command) { if (!_shutdown.get()) { Object serializeCheck; DistributedFuture<?> distFuture = null; // If it is wrapped by our future, then we have to make sure to // check the actual callable/runnable given to us for seri...
b8e0f498-cdbe-415b-a7e1-1cc047195c19
3
private void fillInventoryPoniesPanel(SimpleEditorTab inventoryPoniesTab, final List<String> ponies) { for(String pony : ponies) { // Sorry, no Derpy allowed here if(!("Pony_Derpy".equals(pony))) { // Princess Luna needs special treatment if("Pony_Princess_Lu...
cedfcf91-9640-49f9-a3d0-346436853fda
3
@Override public List<T> sort(List<T> list) { int innerIndex; // The first element starts sorted (it may move later). // Iterate one by one up the list. for (int sortedIndex = 1; sortedIndex < list.size(); sortedIndex++) { innerIndex = sortedIndex; // At each phase as we move up the list, ...
d9e026bc-07fc-421b-bd95-6f8a043c9fe5
3
public static void save(HashMap<Player, Boolean> map, String path) { try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path)); oos.writeObject(UVampires.vampires); oos.flush(); oos.close(); } catch(Exception e) { e.printStackTrace(); for (Player p : Bukkit.getServ...
f4cab549-5d7a-4597-8f49-41c336efb574
4
private static void dfs(Integer startNode) { // increment SCC size sccSize ++; // mark node i as explored nodes[startNode.intValue()] = 1; // find edges with start node as tail and another node as head in G List<Integer> heads = edges.get(startNode); if(heads != null) { Iterator<Integer> headsIterat...
cb08affb-ce74-4aed-a9e6-4b90a3db3555
2
public DatabaseConfiguration(String filePath) { try { configuration = new Properties(); InputStream input = DatabaseConfiguration.class .getResourceAsStream(filePath); configuration.load(input); } catch (IOException e) { throw new RuntimeException(e); } catch (NullPointerException e) { ...
c78299cd-9857-443c-a45a-2fa62998cd54
1
private int lataaPelaajanTallennustiedosto() { try { Tiedostonlukija lukija = new Tiedostonlukija("src/tasot/save.txt"); TallennuksenKasittelija kasittelija = new TallennuksenKasittelija(); return kasittelija.etsiTasonNumero(lukija.getRivit()); } catch (Exception ex) ...
3a66470a-9dfe-4821-b8d7-28e70b793e18
7
private String getBooleanString(boolean booleanValue) { switch (format) { case ONE_ZERO: return booleanValue?"1":"0"; case TRUE_FALSE: return booleanValue?"True":"False"; case YES_NO: return booleanValue?"Yes":"No"; ...
bd5e3161-57ee-438c-8c62-8d9665be2295
0
public void addResult(FindReplaceResult result) { results.add(result); }
aea43c0b-7e7d-4f8f-add4-4b1d887335b3
0
public void close() { button.setEnabled(true); progressBar.setValue(0); dialog.setVisible(false); }
25ad1c18-9f4a-4b41-85cc-b4905002b511
3
public int numOnLine(Move m) { int n, row0 = m.getRow0(), col0 = m.getCol0(), row1 = m.getRow1(), col1 = m.getCol1(); if (row0 + col0 == col1 + row1) { return numPiecesDownDiag[col0 + row0 - 2]; } else if (col1 - col0 == 0) { return numPiecesCol[col0 - 1];...
e406788a-ee81-4d6d-9989-b387a7b8167e
2
public UDPServer(Lobby lobbyPtr, boolean broadcastServer) { this.lobbyPtr = lobbyPtr; try { if(broadcastServer) socket = new DatagramSocket(udpServerPortNb); else socket = new DatagramSocket(); } catch(Exception e) { System.out....
52a5cbaa-6366-41fb-b0f2-2fa1cc5a87be
2
private void modifyObjectClass(SootClass cl) { // TODO Auto-generated method stub //add 'implements' relation // cl.addInterface(poolObj); //add finalizePoolObject() method /* SootMethod finalize = new SootMethod("finalizePoolObject", new ArrayList<Type>(), VoidType.v(), Modifier.PUBLIC); cl.addMethod(fin...
2714fff1-07f8-410d-81da-578fc1935da7
6
private void buy(String[] commandString, Player player) throws CommandException { if (commandString.length >= 3) { CargoEnum cargoEnum = CargoEnum.toCargoEnum(commandString[2]); if (cargoEnum != null) { Station station = player.getCurrentStar().getStation(); ...
82c6079b-d91b-4c83-a34c-24cf3e6e5473
4
public void checkObjectSpawn(int objectId, int objectX, int objectY, int face, int objectType) { if (c.distanceToPoint(objectX, objectY) > 60) return; //synchronized(c) { if(c.getOutStream() != null && c != null) { c.getOutStream().createFrame(85); c.getOutStream().writeByteC(objectY - (c.getMapRegion...
54edf294-01c5-4fbd-88a1-e15da83085f9
8
public byte[] serialize(int size) throws IOException { ByteArrayOutputStream ba = new ByteArrayOutputStream(size); DataOutputStream index = new DataOutputStream(ba); index.writeShort(size); index.writeShort(MAGIC); index.writeInt(nodeWeight); if (subNodes != null) { ...
14cc3215-7014-4ec8-885f-a89efd24a63c
9
public static void main(String[] params) { String cp = System.getProperty("java.class.path", ""); cp = cp.replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar); String bootClassPath = System.getProperty("sun.boot.class.path"); if (bootClassPath != null) cp += Decompiler.altPathSeparatorChar +...
280a065a-55f2-4486-8581-2bafd4ea5ba6
6
@Override public X509Certificate[] getAcceptedIssuers() { if (bootstrap) { // if bootstrap accept all issuers return null; } X509Certificate[] arrayOfX509Certificate = null; String str = MyProxyLogon.getExistingTrustRootPath(); if (st...
7ebbee88-1f5b-4ec0-9874-0d85bea7ecde
2
public static int solve(int[] power, int minimum, boolean[] used, int total) { if (total >= minimum) return 1; int sum = 0; for (int i = 0; i < power.length; ++i) sum += solve(power, minimum, used, power[i] + total); return sum; }
b8c36d07-d930-4dd3-b82a-424ae02b09ea
9
public void run(JGraphFacade graph) { // Set the facade to be non-directed, directed graphs produce incorrect // results. Store the directed state to reset it after this method boolean directed = graph.isDirected(); graph.setDirected(false); // Allocate memory for local cached arrays vertexArray = graph.ge...
80cadd3e-0b43-4982-adcd-cb61ef9d7b21
4
public void removeDataFromEntity( final long someEntityId, Class<? extends Data> someDataType ) throws NoSuchEntityException, NoSuchDataException, NoSuchDataOnEntityException { // DataCore db = _dataCenter.getDataCore(); //check...
1677d18c-1394-43a1-ad32-cdd7007ec87f
4
public static String escapeArgument(String argument) { logger.trace("Escaping argument: " + argument); String result = argument; if (result.contains("\"")) { Matcher matcher = escapePattern.matcher(result); int longestFound = 0; while (matcher.find()) ...
536b1555-8b92-4921-a08f-f6acbfe4b455
1
private void addStatus(UnitStatus.Type status, int remainingDuration) { JLabel statusLabel = new JLabel(); statusLabel.setText(status.toString()+" ("+remainingDuration+")"); statusLabel.setToolTipText(status.getDescription()); if (status.isPositive()) { statusLabel.setForeground(PropertiesLoader.getColo...
547d77b9-4d7f-45d0-a1da-4320c3f3a826
5
public void sbtAlgorithm() throws Exception { if (_isFirstAgent()) { // create cpa CPA cpa = generate_CPA(); // Assign CPA this._assign(cpa); } while (!this._done) { Message msg = this._mailer.receive_msg(this._id); switch (msg.type()) { case "Stop": this._done = true; break; case ...
c08ccb42-acb7-4197-ba35-9a7c2f3084cc
3
public void prettyPrint() { for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[i].length; j++) { System.out.print(matrix[i][j]); if (j < matrix[i].length - 1) { System.out.print('\t'); } else { ...
88451dd0-1511-4088-802a-d6d1f4419e1d
9
private void doEnum(TextScanner sc, Writer output) throws IOException { parseHeaderArgs(sc); StringBuilder cs = null; int csc = 0; if (combinedStringsLabel != null) { cs = new StringBuilder(); cs.append(" "); cs.append(vis()); cs.append("static final String "); cs...
e95abb35-a5bd-496e-9f6b-bf804e958a55
1
public String checkString(String s) { if(new File(Main.loc + "/Saves/Shortcuts/" + s).exists()) { return "Load"; } else { return "Save"; } }
d0c20f66-9e6f-4729-ba22-8db17ae48564
1
public void testWithField_DateTimeFieldType_int_2() { LocalDate test = new LocalDate(2004, 6, 9); try { test.withField(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
2424bd38-b53e-4bb5-8d44-e74f713d830c
1
public void test_constructor() { BaseDateTimeField field = new MockBaseDateTimeField(); assertEquals(DateTimeFieldType.secondOfMinute(), field.getType()); try { field = new MockBaseDateTimeField(null); fail(); } catch (IllegalArgumentException ex) {} }
ffa41531-f16f-48f1-90a6-a6ca04170abe
2
public void addObject(Placeable obj) { if (isValidPositions(obj)) { allObjects.add(0, obj); if (obj.isTower()) { allTowers.add(0, (Tower) obj); setPriority(obj); } } }
cd369a6d-c989-4ba0-b70c-ec2b3c06727e
3
public static String trimLeadingCharacter(String str, char leadingCharacter) { if (!hasLength(str)) { return str; } StringBuilder sb = new StringBuilder(str); while (sb.length() > 0 && sb.charAt(0) == leadingCharacter) { sb.deleteCharAt(0); } return sb.toString(); ...
2653d3d6-20ba-4a22-9564-09fcf5699820
5
public String getNextStationName(int ID){ Block b; if(getLineColor() == 0) b = trackObject.getBlock((int)trainDistRed[ID-1][2]); else b = trackObject.getBlock((int)trainDistGreen[ID-1][2]); Block s, next; ...
da77264b-deaf-4010-a11c-febc009cd17b
4
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfCases = sc.nextInt(); for(int i = 0; i < numOfCases;i++) { //Calculate the various variables we need int numerator = sc.nextInt(); int denominator = sc.nextInt(); int wholeValue = numerator / denominator; int...
48500ec0-0f59-40b6-90c0-c60417d6b8d0
9
@Override public boolean MoveDown() { undodata.addLast(dataClone()); undoscore.addLast(scoreClone()); initFlag(); win = false; noMoreMoves = false; boolean flag = true; int count = 0; while (flag == true) { flag = false; for(int i=N-2; i>-1; i--) { for(int j=0; j<N; j++) { if (d...
edf4b71a-080d-4ab6-8e3a-ff35d4a470d9
8
public String[] getOptions() { String [] options = new String [11]; int current = 0; if (!getResultsetKeyColumns().getRanges().equals("")) { options[current++] = "-G"; options[current++] = getResultsetKeyColumns().getRanges(); } if (!getDatasetKeyColumns().getRanges().equals("")) { ...
618f134b-ff25-452a-89fa-5365752e8a66
2
public void reloadPlayerInventoryConfig() { if (playerInventoryConfigFile == null) { playerInventoryConfigFile = new File(getDataFolder(), "PlayerInventory.yml"); } playerInventoryConfig = YamlConfiguration.loadConfiguration(playerInventoryConfigFile); // Look for defaults in t...
11ddfa3e-2dbe-4725-a5d3-17ede72b704c
2
public Boolean createTable(String query) { try { if (query == null) { core.writeError("SQL Create Table query empty.", true); return false; } Statement statement = connection.createStatement(); statement.execute(query); return true; } catch (SQLException ex){ core.writeError(ex.getMessag...
c8305aad-f8de-45a8-b232-9e31f04a8fc9
3
private int fillFromStream() throws IOException { int oldVirtualSize = virtualSize; // If the physical buffer isn't full if (virtualSize < physicalSize) { // If the virtual buffer doesn't wrap if (head + virtualSize < physicalSize) { // streamIn.read may ...
da1ec057-caaa-425d-8287-ad8c5c6018bf
3
public void launch(String[] args, String outArchive) { try ( FileOutputStream fOutStream = new FileOutputStream(new File(outArchive), false); ZipOutputStream zOutStream = new ZipOutputStream(fOutStream); ) { for (int a = 1; a <= Integer.parseInt(args[2]); a++)...
1ba74419-0151-479a-be30-f46e46e10969
3
public Socket open() { EventThread.exec(new Runnable() { @Override public void run() { String transportName; if (Socket.this.rememberUpgrade && Socket.priorWebsocketSuccess && Socket.this.transports.contains(WebSocket.NAME)) { transport...
5a6e9834-f3ef-4ef3-bc30-a8bea9add029
1
private void initialiseLabels() throws Exception { Collection<Object[]> parameterArrays = getParameterArrays(); labels = new ArrayList<String>(); for (Object[] parameterArray : parameterArrays) { String label = StringUtils.join(parameterArray, ", "); labels.add(label); ...
c067638d-6e4c-48e7-85ed-6f82687a7a98
4
public int min(int hori, int verti, int dia) { if (hori <= verti && hori <= dia) { return hori; } else if (verti <= hori && verti <= dia) { return verti; } else { return dia; } }
e5a1813b-7962-4df2-8210-69f87118a2c6
9
private Move askAlienForMove() { // Get all possible nodes for the alien final Set<Edge> allPossibleEdges = Ship.getAll(ship.getAlienNode().getCoordinates(), ship, connectedShip); // Get the adjacent nodes for the predator final Set<Edge> adjacentEdges =...
793b722d-99df-4902-8da2-0ec3cd0fbb98
8
public static int countRoots(int[] a){ int P1 = 0; int P0 = 0; for (int i = 0; i < a.length; i++) { P1 += a[i] * 1; P0 += a[i] * ( (i==0)? 1: 0 ); } if(P0 > 1) P0 %= 2; if(P1 > 1) P1 %=2; if(P1 == 0 && P0 == 0) return 2; else if( P1 == 0 || P0 == 0 ) return 1; return 0; }
564ef5f0-311e-41af-8d7f-036b99db07ff
6
private int checkThreeOfAKind(int player) { int[] hand = new int[players[player].cards.size()]; int i = 0; for (int card : players[player].cards) { hand[i++] = card % 13; } int matchCount = 0; for (int j = 0; j < hand.length; j++) { for (int k = 0; k < hand.length; k++) { if (j != k) { ...
904dcdd0-39ad-46be-852c-0b7bd6617890
3
private long computeFileSize(File file) { if (file.isFile()) { return file.length(); } else if (file.isDirectory()) { File subs[] = file.listFiles(); long s = 0; for (int i = 0; i < subs.length; i++) { s += computeFileSize(subs[i]); ...
ecd29181-70b7-458d-bfaf-cc406e824878
7
public void create(Lenguaje lenguaje) throws PreexistingEntityException, RollbackFailureException, Exception { if (lenguaje.getEmpleadoCollection() == null) { lenguaje.setEmpleadoCollection(new ArrayList<Empleado>()); } EntityManager em = null; try { em = getEntit...
329182a1-b1f7-4995-b2dd-d1ee6ebe2568
6
public SymbolDigraph(String filename, String delimiter) { st = new ST<String, Integer>(); // First pass builds the index by reading strings to associate // distinct strings with an index In in = new In(filename); while (in.hasNextLine()) { String[] a = in.readLine()....
d4178f5c-3c70-47db-b43d-23df5206b3fc
6
private void setLookAndFeel(int theme) { switch (theme) { case 0: try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception exc) { System.err.println("ERROR - Themes: M...
8f1d2adb-22c8-4908-afdb-add72978805d
6
public static void javaOutputStartupUnitsToFile(StringHashTable startupht, Cons keylist) { { String classoutputfile = null; Cons startupfunctions = null; { Object old$CurrentStream$000 = Stella.$CURRENT_STREAM$.get(); try { Native.setSpecial(Stella.$CURRENT_STREAM$, null); ...
9105a10e-9abf-4c4d-a380-5a1b6000739d
4
public int stringY(String str) { if (str == null || str.length() == 0) return 0; int y = 0; int length = str.length(); for (int i = 0; i != length; ++i) { int y0 = charY(str.charAt(i)); if (y > y0) y = y0; } return y; }
6568b6dc-d705-43fd-a2cb-f0d7cfb37a4b
5
@Override public void setType(int id, String type) { try { connection = getConnection(); ptmt = connection.prepareStatement("UPDATE User_types SET type=? WHERE id_user=?;"); ptmt.setInt(2, id); ptmt.setString(1, type); ptmt.executeUpdate(); ...
7549f023-dc48-44c2-b243-5d65253cc7ca
5
public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof TOObjectPropsId)) return false; TOObjectPropsId castOther = (TOObjectPropsId) other; return (this.getObjectPropsId() == castOther.getObjectPropsId())...
5f2946ee-24d0-4aae-9af7-7395ea10face
3
public String bubbleSort(String a) { char[] arr = a.toCharArray(); for (int i = arr.length - 1; i > 0; i--) { for (int j = 1; j <= i; j++) { // notice if (arr[j - 1] > arr[j]) { swap(arr, j, j - 1); } } } return new String(arr); }
3678f792-ec14-49a9-a2b5-5eaf2d24bc48
6
@Override public void run() { try { DataInputStream dis = new DataInputStream(connection.getInputStream()); DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); PacketInHandshake handshake = PacketInHandshake.read(dis); if (handshake == ...
4c9193f8-23fb-4f15-a72c-ba4d1e165cb3
6
public void testKeySetAdds() { int element_count = 20; int[] keys = new int[element_count]; String[] vals = new String[element_count]; TIntObjectMap<String> map = new TIntObjectHashMap<String>(); for ( int i = 0; i < element_count; i++ ) { keys[i] = i + 1; ...
47376e9d-2e31-4bb2-9042-ddea4e7460b6
1
private static String generateNDigitStringNumber(Integer n) { StringBuilder sb = new StringBuilder(n); sb.append('1'); // 1 is already given so lets minus n by 1 n -= 1; for (int i = 0; i < n; i++) { sb.append('0'); } return sb.toString(); }
44c59196-4c28-4435-8519-18b3ce2122c9
5
public static void onVillageChanged(String newVillage) { Coord coords = villageCoords.get(newVillage); if (coords == null) return; if (!newVillage.equals(lastVillage)) { if (newVillage.length() == 0) { lastVillage = null; // Leaving } else { ...
df1af901-fb3a-4df3-8174-12f816ac8a32
4
public CardEditorScreen(Card card) { this.card = card; this.setLayout(new BorderLayout()); // URL fontURL; try { // fontURL = new URL("http://www.webpagepublicity.com/free-fonts/a/Airacobra%20Condensed.ttf"); font = Font.createFont(Font.TRUETYPE_FONT, new File("Amigo.ttf")); titleFont = Font.createFont(...
60c8dd94-42a5-4720-b97d-b66eeb0035a0
9
@Override public String stateStringSubject(Rider R) { switch(rideBasis) { case Rideable.RIDEABLE_AIR: case Rideable.RIDEABLE_LAND: case Rideable.RIDEABLE_WATER: case Rideable.RIDEABLE_WAGON: return "being ridden by"; case Rideable.RIDEABLE_TABLE: case Rideable.RIDEABLE_SIT: case Rideable.RIDEABLE...
acf1d18e-4f9f-430c-bfad-e57f17aa5c1d
6
public String getSongElementTypeAsString() { String result = "["; switch (type) { case BREAK: result += "BREAK"; break; case BRIDGE: result += "BRIDGE"; break; case CHORUS: result += "CHORUS"; break; case INTRO: result += "INTRO"; break; case OUTRO: result += "OUTR...
acdf3ca0-47e2-47ec-85f3-7cd673ac6d95
5
public int nthSuperUglyNumber(int n, int[] primes) { if(n==1) return 1; int[]ugly=new int[n]; ugly[0]=1; int[] index=new int[primes.length]; Arrays.fill(index,0); for (int pointer=1; pointer<n;pointer++){ int nextValue=Integer.MAX_VALUE,nextIndex=0; ...
7cdfd5b9-2dd5-4ee6-9cef-1ae29a08f1a2
7
public static ArrayList<UserAccount> readUserAccounts(String filename) { File file = new File(filename); if (file.exists()) { ObjectInputStream ois = null; try { // // Read the previously stored SecretKey. /...
2e9bcbd4-a0c5-4598-91f4-220c86514afa
0
protected Field getField() { return field; }
ce2f01cc-b0c7-4826-8f8f-2018d45f9f99
3
public static Map<String, BufferedImage> getDataFromDirPath(String dirPath) { Map<String, BufferedImage> res = new HashMap<>(); File dir = new File(dirPath); if (dir.isDirectory()) { try { ImagesIterator imagesIterator = new ImagesIterator(dir); while (imagesIterator.hasNext()) { File imgFile = images...
4e94ab6a-953b-4565-b762-35b9933d722d
8
public static ArrayList<String> winner(ArrayList<String> playerOne, ArrayList<String> playerTwo) throws NoSuchStrategyError { if(verifyPlay(playerOne.get(1)) || verifyPlay(playerTwo.get(1))) throw new NoSuchStrategyError("Strategy must be one of R,P,S"); if(playerOne.get(1)==playerTwo.get(1)) return player...
3997558a-024f-479d-a2ad-8d7a22ce864f
9
@Override public void stateChanged(ChangeEvent e) { switch(((JTabbedPane)e.getSource()).getSelectedIndex()){ case MY_HISTORY: if(!changed[MY_HISTORY]){ changed[MY_HISTORY] = true; } break; ...
5b968918-bc60-42c6-9db0-1f2171955c78
9
private void skipDeletedPredecessors(Node<E> x) { whileActive: do { Node<E> prev = x.prev; // assert prev != null; // assert x != NEXT_TERMINATOR; // assert x != PREV_TERMINATOR; Node<E> p = prev; findActive: for (;;) { ...
530780c9-e4b3-4c84-9f62-f641a9555eae
3
@Override public Descriptor compile(SymbolTable syms) { Descriptor descr = null; String identName = ((IdentNode)ident).getIdentName(); if (type instanceof IdentNode) { descr = syms.descriptorFor(identName); } else if (type instanceof ArrayTypeNode || type instanceof RecordTypeN...
95c796ef-1b07-4628-9971-b7f303ac1084
0
public void setFesIdPos(Integer fesIdPos) { this.fesIdPos = fesIdPos; }
004c90e2-a631-4c32-a1d9-bf9da6e7a1b7
3
private boolean outsideBorder(double lat, double lon) { return (Double.compare(lat, MAX_LAT) > 0 || Double.compare(lat, MIN_LAT) < 0 || Double.compare(lon, MAX_LON) > 0 || Double.compare(lon, MIN_LON) < 0); }
24058b71-4da7-4f15-96d3-801f37442fb0
0
public Role getRole() { return this.role; }
62c4be29-d4d7-4e78-9383-aa3afdf158c5
7
@Override public Double getElement(int row, int column) { int index = 0; boolean elementIsZero = true; if (row == column) { return diag.get(row); } else { ArrayList<String> rowInColIndexes = colIndexes.get(column); if (rowIndexes != null && colIndexes != null && rowInColIndexes != null) { for (...
f1df4d9b-02e6-4771-bf42-dbf60797f236
0
public Lemonade() { this.setName("Lemonade"); this.setPrice(new BigDecimal(15)); }
1c52d2d8-79e0-49a3-ad80-a192dbc04fd4
9
public DnDTabbedPane() { super(); final DragSourceListener dsl = new DragSourceListener() { @Override public void dragEnter(DragSourceDragEvent e) { e.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop); } @Override public void dragExit(DragSourceEvent e) { e.getDragSourceContext() ...
c6a37878-6ee5-4425-acdd-babf366674b9
7
public List<List<Integer>> zigzagLevelOrderDeque(TreeNode root) { if (root == null) { return null; } List<List<Integer>> result = new ArrayList<List<Integer>>(); Deque<TreeNode> deque = new LinkedList<TreeNode>(); deque.add(null); deque.add(root); while (deque.size() > 1) { TreeNode node = ...
7dd3c2be-79c6-4822-9379-e64aee206854
7
public static boolean isStandardErrorParam(String accession) { return INTENSITY_STD_ERR_SUBSAMPLE1.getAccession().equals(accession) || INTENSITY_STD_ERR_SUBSAMPLE2.getAccession().equals(accession) || INTENSITY_STD_ERR_SUBSAMPLE3.getAccession().equals(accession) || ...
15e9029e-a9da-4ce2-88aa-bb66c52fc2ae
3
FileVersion(final String version) { this.original = version; if (this.original == null) { this.major = null; this.minor = null; this.revision = null; this.type = null; this.build = null; return; ...
29fdc3d4-fe5b-437d-9b1e-0cd6362a139b
0
public HBox getActionBox() { return actionBox; }
33b69930-2063-4446-a301-7ff4c9476958
5
private static void copyFileFromFileSystem(String sourceFileName, File target) { try { File in = new File(sourceFileName); FileChannel inChannel = new FileInputStream(in).getChannel(); FileChannel outChannel = new FileOutputStream(target).getChannel(); try { ...
d2ae72b9-8171-4d2b-981c-fc82d55b6bf3
7
@Override public AUTOMATON initObj() { Class<AUTOMATON> classTypeDef = getClassTypeDef(); try { return classTypeDef.getConstructor(new Class[] { Class.forName("[C"), Integer.TYPE}).newInstance(new Object[] {alphabet, 2}); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printS...
b8ee8bad-3ed6-4ff0-bd33-ef1ab2a4f9aa
1
public static Node minimum(Node root){ while(root.left != null) root = root.left; return root; }
f04e1224-1922-4ee0-99bb-9ba35537a519
3
public TripDBPanel() { super (new BorderLayout ()); targetDay = Calendar.getInstance(); targetDay.setTime(new Date ()); targetDay.add(Calendar.DATE, 1); Calendar startDay = Calendar.getInstance(); startDay.setTime(MainWindow.setupData.getEventStartDate()); if (targetDay.before(startDay)) targetDay =...
9eefc374-faa9-410e-ba73-ba0cbce51da3
6
public static void main(String[] args) { FileIO loader = new FileIO(); BoardState startState=null, endState = null; if (args.length !=3) { System.out.println("Error: Invalid command line arguments." + newLine +"Arguments should be in the form of " + "< initial puzzle state file > < goal puzzle state file...
42d15f54-5816-4e90-8c18-19b8332c2388
6
void fixNeighbors(NeighborFind<T> neighborStrategy, ProxyProvider<T> proxyProvider) { Collection<T> realNeighbors = neighborStrategy.getNeighborsFor(field); this.detailedCombinations = new double[realNeighbors.size() + 1]; for (T neighbor : realNeighbors) { if (neighborStrategy.isFoundAndisMine(neighbor)) { ...
baf9d2f0-719b-4e03-b0ad-cf3792ae7c65
6
public MediaWiki.InterwikiPrefixes getInterwikiPrefixes() throws IOException { preferenceLock.readLock().lock(); try { MediaWiki.InterwikiPrefixes result; if ((interwikiPrefixCache != null) && ((result = interwikiPrefixCache.get()) != null)) return result; } finally { preferenceLock.readLock().unlock...
5318188a-b529-43da-b218-0b80ddb490a6
2
public void setFrozen(Configuration configuration) { ConfigurationButton button = (ConfigurationButton) configurationToButtonMap .get(configuration); if (button == null) return; if (button.state == ConfigurationButton.NORMAL) button.setState(ConfigurationButton.FREEZE); button.doClick(); }
aedfe705-2204-4d61-87dd-8c5345d282d5
7
@Override public void buildFloralComposition(String fileName) throws DAOException { Document doc = null; try { doc = documentBuilder.parse(fileName); Element root = doc.getDocumentElement(); NodeList cutFlowerList = root.getElementsByTagName(TagConstants.CUT_FLOWE...
1394830d-53fa-48aa-8ff5-d591094de907
4
public static void main(String[] args) throws MalformedURLException { OpenCVImageDecoder imageDecoder = new OpenCVImageDecoder(); String searchString = null; URL url = null; WebPicture picture = null; ////////////////////////////////// // BEGIN Test 1: l...
0dbda5e6-5ccc-43bf-84b7-433fb35b03db
7
public void replaceBytes(int offset, int len, byte[] bytes) { byte[] removed = null; if (len>0) { removed = new byte[len]; doc.remove(offset, len, removed); } byte[] added = null; if (bytes!=null && bytes.length>0) { doc.insertBytes(offset, bytes); added = (byte[])bytes.clone(); } if (remov...
9c5d634d-cc8f-44dc-991a-f7a9f24a2584
7
public void buttonP() { if(bNew.contains(Main.mse)) { Main.soundPlayer.menuKlick(); Main.Screen = "modeSelection"; Main.renderer.startRenderer = null; } else if(bLoad.contains(Main.mse)) { try { Main.soundPlayer.menuKlick(); JFileChooser chooser = new JFileChooser(); chooser.setFile...
49c9fd30-91cc-4307-9439-ccc45976e5d8
1
private void insert(char[] a, int i, int minIndex) {// O(n)+O(n) if (minIndex > i) { char tmp = a[minIndex]; System.arraycopy(a, i, a, i + 1, minIndex - i); a[i] = tmp; } }
55b5b38c-6aad-48e3-a166-c0c1de560d35
8
private void addValidators() { quantityoutlet.setInputVerifier(new AbstractValidator(this, quantityoutlet, "Ongeldige waarde! Verwacht formaat: x.y, groter dan 0.0") { @Override protected boolean validationCriteria(JComponent c) { if (autobox.getSelectedIndex() == 0) { ...
3be00fc7-f617-44d3-a40c-74c91dd506a2
7
public ItemStack addToItem(ItemStack item, int enchantLevel) { ItemMeta meta = item.getItemMeta(); List<String> metaLore = meta.getLore() == null ? new ArrayList<String>() : meta.getLore(); for (String lore : metaLore) { if (lore.contains(this.enchantName)) { // Con...
c3042648-d495-4a61-8dbe-c364395776cc
1
private String getUserList() { StringBuilder sb = new StringBuilder(); for (String name : clients.keySet()) { sb.append("\n\t"); sb.append(name); } return sb.toString(); }
16fc793b-719e-42c7-84be-f70c63b15b73
3
@Override public int hashCode() { int hash = 7; hash = 29 * hash + (this.type != null ? this.type.hashCode() : 0); hash = 29 * hash + (int) (this.length ^ (this.length >>> 32)); hash = 29 * hash + (int) (this.sizeof ^ (this.sizeof >>> 32)); hash = 29 * hash + (this.isCons...
605c374f-1448-4494-8ab5-b87f419e70f5
5
public void actionPerformed(ActionEvent e) { if (aliens.size()==0) { ingame = false; } ArrayList ms = craft.getMissiles(); for (int i = 0; i < ms.size(); i++) { Missile m = (Missile) ms.get(i); if (m.isVisible()) m.move(); ...
433e69c3-0826-4d1b-8d52-320a31440710
9
public static Method[] getUniqueDeclaredMethods(Class<?> leafClass) throws IllegalArgumentException { final List<Method> methods = new ArrayList<Method>(32); doWithMethods(leafClass, new MethodCallback() { public void doWith(Method method) { boolean knownSignature = false; Method methodBeingOverriddenWit...
2d983ce2-e888-4c3b-b0d2-2bf17533a271
8
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == createMatrix){ createMatrix(); } else if (e.getSource() == selectMatrix){ displayMatrix(); } else if (e.getSource() == deleteMatrix){ deleteSelectedMatrix(); } else if(e.getSource() == transposeButton){ function_transpose();...