method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6f1bb255-c1b5-4517-9166-75bd2f06bd88
3
public final void dfs(Graph G, int v) { if (marked[v]) return; marked[v] = true; preAnyAdjacentVerticesVisit(v); for (int w : G.adj(v)) if (!marked[w]) { preAdjacentVertexVisit(v, w); dfs(G, w); postAdjacentVertexVisit(v, w); } }
3329ac44-7ef9-462c-b2e3-0947a1d7e2d9
6
@Override public String checkToPrepareQuestion() { String warning = null; // Проверим заполненость всех текстовых полей if (selectVariantPanels == null) { warning = "Создайте более одного варианта ответа, на данное задание"; return warning; } if (this....
92c1c1c1-df88-4fbf-8305-83f0033309a4
5
private static String replace(String value) { if (null == value) { return value; } String newValue = value; int openBrace = 0; if (-1 != (openBrace = value.indexOf("{", openBrace))) { int closeBrace = value.indexOf("}", openBrace); if (closeBra...
a737d288-b916-42d2-8734-89bcd34a0562
3
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (this.opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } this.put(key, value); } return this; }
25ac74eb-cd2e-46b5-98b1-5daee3f9b1ea
1
@Override public String toString() { if (tile == null) { return "p" + number + " is dead (" + cooldown + " turns remaining) with " + points + " points"; } return "p" + number + " at " + tile.x + "," + tile.y + " with " + points + " points"; ...
995818fe-c4c8-4e45-a6a1-e30e029b6fc3
0
@Override public void windowClosing(WindowEvent arg0) { }
37756873-7211-442c-a609-9950a484b20e
0
public JButton getDrawButton() { return drawButton; }
ca859593-427f-41ea-96b2-bfda1d0e151c
9
private void drawButtonInfo(Graphics2D g) { String s = null; Rectangle r = null; if (closeButton.contains(mouseMovedPoint)) { s = "Close graph"; r = closeButton; } else if (dataButton.contains(mouseMovedPoint)) { s = "View data"; r = dataButton; } else if (xExpandButton.contains(mouseMovedPoint)) ...
630f4b9b-54f3-40b8-873f-dc9faed343f3
4
protected void usePIDOutput(double output) { // Use output to drive your system, like a motor // e.g. yourMotor.set(output); if (climberMotor != null && !(getVerticalSetting() < 0)) { try { climberMotor.setX(output); } catch (CANTimeoutException ex) { ...
4717b304-b485-4503-9002-c5c6e7b91434
1
@Override public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark{ //Find the column. int boardPositionColumn = boardPosition % columns; //Mark the row. for(int i= boardPositionColumn; i < boardPositionColumn + rows * col...
2836d6e5-5bf3-48f6-9719-c19a0637e2a3
6
@Override public ArrayList<T> loadList(String filePath) { ArrayList<T> list = new ArrayList<>(); FileInputStream fileIn = null; ObjectInputStream in = null; try { fileIn = new FileInputStream(filePath); in = new ObjectInputStream(fileIn); while (t...
990cf8c8-ab1b-419c-877a-25f6bfc79cf8
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get // the ...
394ec84d-ca0d-4002-afcf-74f3b10b83ae
5
void parseSOF(int marker) throws InvalidJpegFormatException, IOException { byte[] bytes = new byte[2]; mIs.read(bytes); int num = i16(bytes)-2; bytes = new byte[num]; mIs.read(bytes); int precision = bytes[0]; if (precision != 8){ ...
d1962c7f-c3bc-4d91-812c-11f43cf05760
0
public void setName(String name) { Name = name; }
a58d47b9-161a-4e29-b56d-9b5fe667e982
8
private void readFile() { if(parameters.getPath() != null) { boolean isDirectory = false; String dir = DOCUMENT_ROOT + parameters.getPath(); File file = new File(dir); try { if (!file.getCanonicalPath().contains(DOCUMENT_ROOT)) { ...
55c764af-5de2-462a-ab1e-6e62f638a77f
9
private void cftfsub(int n, float[] a, int offa, int[] ip, int nw, float[] w) { if (n > 8) { if (n > 32) { cftf1st(n, a, offa, w, nw - (n >> 2)); if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) { ...
68b2bd1a-16ba-480e-90cc-7a78fdb67ae3
4
public void update(){ if(isRunning()){ getCurrentState().update(); } if(isVisible()){ if(sprite != null){ sprite.update(); } else if(shape != null){ updateShape(); } } }
49f3388b-5681-45aa-8c38-914e79d90e67
4
public void delete() throws ESellException { if (id == null) // Petition wurde noch nicht mit der DB abgeglichen. throw new ESellException(ESellException.ErrorCode.NO_ENTRY_ERR); makeConnection(); PreparedStatement preparedStatement = null; if (conn != null) { try { // Statement vorbereiten ...
490e758a-d7ec-42f7-b378-1e8a2640bd7b
1
public static void printInteger(Integer i, int depth) { for (int k = 0; k < depth; k++) System.out.print(" "); System.out.println("Integer: " + i); }
0ac81196-b3a9-4b69-bc77-392ddbe99622
3
private void offerNewMerge() { int response = JOptionPane.showOptionDialog(myCP, "Projects Successfully Merged. " + "Would you like to merge more projects?", "Projects Merged", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, JOptionPane.YES_OPTION); switch (response) { ...
2c5abe9e-cba3-4367-8ef5-b965854c7faf
6
public void run() { while(true){ try{ ConnectServer.UserProcessor currentProcess = cloneQueue.take(); for(int i = 0; i < queue.size(); ++i){ ConnectServer.UserProcessor innerProcess = queue.take(); if(currentProcess.userId != innerProcess.userId){ //System.out.println("X = " + current...
858f8c65-9b4c-4d9a-9562-d9b1bcbd644d
4
@Test public void increasesKey() { MyInteger[] integers = new MyInteger[30]; for (int i = 1; i < 30; i+=2) { integers[i] = new MyInteger(i); treeHeap.insert(integers[i]); } integers[5].myInt = 26; treeHeap.valueChanged(integers[5]); ...
a74cf3a4-b3c7-4fc3-a60f-3005cd29765b
8
public double calculateDunnIndex(){ double minDI = Double.MAX_VALUE; for (int i = 0; i < clusters.size(); i++) { Cluster ci = clusters.get(i); if(!ci.getIsActive()) continue; if(ci.getPointsIDs().size() < 30) continue; for (int j = 0; j < clusters.size(); j++) { Cluster cj = clusters.get(j); if...
097289c7-6444-4d2a-83e9-3083f6569f28
2
public double linearOffset(int round, double expectedValue){ this.bowlsSeen[round]++; int totalSelections = 0; double CONSTANT = 0.2; int totBowls = n_players - playerIndex + 1; if(round == 1) totBowls = playerIndex; int bowlsLeft = totBowls - bowlsSeen[round]; if(totBowls == 0) return 0; el...
6a6cdc27-3437-4dd6-b206-cf47d22f67e9
1
public void testGet_DateTimeField() { Instant test = new Instant(); // 2002-06-09 assertEquals(1, test.get(ISOChronology.getInstance().era())); assertEquals(20, test.get(ISOChronology.getInstance().centuryOfEra())); assertEquals(2, test.get(ISOChronology.getInstance().yearOfCentury()));...
1a51904a-fe6c-41e6-9cad-20a31356eb57
6
protected void invoke() { // Read from registers String xAddress = registerStore.readFrom(Register.XA); String xValue = registerStore.readFrom(Register.XV); String xType = registerStore.readFrom(Register.XAT); String yAddress = registerStore.readFrom(Register.YA); ...
1146c4e9-b9e4-435b-ae49-871efc5d8874
8
public void render(Bitmap b) { if(dir == 0) { ImageManager.renderFromImage(entityType, b, (int)x, (int)y, 0, 16, ((animation_frame == 0) ? 1 : 0)); } else if (dir == 1) { ImageManager.renderFromImage(entityType, b, (int)x, (int)y, 1, 16, ((animation_frame == 0) ? 1 : 0)); } else if (dir == 2) { ImageMana...
bf6b40ec-a1ee-44ee-b40b-767dbf6a6f49
5
public int moveScore(Coordinate xy) { boolean test = false; if (test || m_test) { System.out.println("Othello :: moveScore() BEGIN"); } // Hint to whoever implements the Hard AI - just iterate over the // grid, then pick the best moveScore result. Your AI doesn't need to // ...
30d246c8-b3fb-47d1-8854-39cbcd72b04b
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Edge edge = (Edge) o; if (vertex1 != null ? !vertex1.equals(edge.vertex1) : edge.vertex1 != null) return false; if (vertex2 != null ? !vertex2....
a161e5f7-d15f-4c29-864e-5719e1368518
0
public void update(Observable o, Object arg) { // TODO Auto-generated method stub remove(imgLecture);// removeAll(); ImageIcon icon = new ImageIcon("img//gdeFond2.jpg"); // imgLecture// = new JLabel(icon); // add(imgLecture); revalidate(); }
f36e285a-cbc3-4e5a-a2b9-03eac9814a4a
2
public void setShutdownmenuButtonBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.buttonShutdownmenu_Borderthickness = UIBorderthicknessInits.SHDMENU_BTN.getBorderthickness(); } else { this.buttonShutdownmenu_Borderthickness = border; ...
e0daceb9-fb71-4bc5-a8ca-b1741f2e1d08
4
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void handleFireSpread(BlockSpreadEvent event) { if (!WorldManager.getInstance().isFireSpreadAllowed()) { if (event.getSource().getType() == Material.FIRE || event.getSource().getType() == Material.LAVA || event.getSource().getType() == ...
08487a07-ea3f-44c1-8b62-f465abc4f184
7
public void tallyDiceTotals(Dice[] roll) { for(int i=0; i<5; i++) { if (roll[i].face == 1) {ones++;} else if (roll[i].face == 2) {twos++;} else if (roll[i].face == 3) {threes++;} else if (roll[i].face == 4) {fours++;} else if (roll[i].face == 5) {fives++;} else if (roll[i].face == 6) {si...
62997f8f-e9c8-4553-b991-b4959df3b82e
0
public void draw(PGraphics pg, float x, float y) { }
685f7996-88b5-465f-9795-c095223cfb68
7
public int maxProfit(int[] prices) { if (prices.length <= 1) return 0; int rst =0; int[] firstTime = new int[prices.length]; int min = prices[0]; firstTime[0] = 0; int max =0; for (int i =1;i< prices.length;i++) { firstTime[i] = prices[i] - min; if (firstTime[i-...
9163dcd4-cd16-4279-8847-8ded645664bc
5
public boolean validate() { NPC cat = spiceLooter.getCat(); try { if (cat != null && cat.getInteracting() != null) { int interId = cat.getInteracting().getId(); int myId = Players.getLocal().getId(); return interId == myId && !cat.isMoving() && Util.getSpice() == null; } } catch (Exception e) { ...
dd70cf19-a31d-45bf-83c6-f92fc1f67439
0
public String moveNextPawn(Direction d) throws OutOfBoardException { return this.board.getNextPawn().move(d); }
be0401e3-480c-477e-b7cb-27ca1d5aaa09
6
public void parse(String fileName) { //insert text data into db int text_id = this.dbhelper.insertText( getString(TEXT_NODE_ANNOT, doc), getString(TEXT_NODE_AUTHOR, doc), getString(TEXT_NODE_DATE, doc), getString(TEXT_NODE_EDITOR, doc), ...
1032d5d4-cc24-4000-92e9-e81927463057
1
private void unpackDiag (Iterator diagLinkedListIt, int color) { Matrix diagMat = diag.getMatrix(color); for (int i = 0; i < diagMat.getRowDimension(); i++) { diagMat.set(i, 0, (double)(int)diagLinkedListIt.next()); } }
7155a966-4d3e-4945-a153-c3f4b2a7b09a
6
private void jButtonEliminarBuscar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarBuscar2ActionPerformed if (banco.longitud() == 0) { mostrarOption("Error: No hay clientes registrados en el banco.\n Ingrese las cuentas antes de hacer esta operacion.", JOptionPane.E...
c421a4c4-fdf8-4324-8c48-5a566ce78dc6
6
@Override public Class<?> getColumnClass(int columnIndex){ Class type = String.class; switch (columnIndex){ case 0: type = Integer.class; break; case 1: type = String.class; break; case 2: type = String.class; break; case 3: type = String.class; break; case 4: typ...
8638083b-729e-4adc-9e94-8e838eb0cab3
9
* @return a map of Courses to their recommended rooms with Course.toString() as the key */ @SuppressWarnings("unchecked") private TreeMap<String,?> generateRecommendedRooms(String spreadsheetNames){ String[] names = spreadsheetNames.split(","); String[][] roomsAndProfessors=getSpreadsheet(names[0]); String[][...
62b8fca5-a2fa-4d12-8147-89bd32b2ce69
3
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed if (evt.getKeyCode() == 40) { btnSave.grabFocus(); } else if (evt.getKeyCode() == 39) { jPasswordField1.grabFocus(); } else if (evt.getKeyCode() == 38) { jCheckBox1.grabFocus(); ...
d451d7ee-6575-4bc0-b6d1-7dccea7de17d
9
int insertKeyRehash(char val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
6360bcab-28ec-4159-a198-83fc888519f5
7
public int minPathSum(int[][] grid) { if (grid == null || grid.length == 0 || grid[0].length == 0) { return 0; } int rows = grid.length, cols = grid[0].length; int[][] sum = new int[rows][cols]; sum[0][0] = grid[0][0]; for (int row = 1; row < rows; row++) { sum[row][0] = sum[row - 1][0] + grid[row][...
6a78c7a5-240c-4021-81e7-95d78923a3b6
7
public void compute4KindCategoryPoints(Dice[] roll) { if(this.ones >= 4 || this.twos >= 4 || this.threes >= 4 || this.fours >= 4 || this.fives >= 4 || this.sixes >= 4) { for(int i=0; i<5; i++) {scoreArray[FOURKIND_INDEX] += roll[i].face;} } else {scoreArray[FOURKIND_INDEX] = 0;} }
25c238d3-2254-4d06-92a0-64d60a7793b2
9
private boolean merge(int[] line) { int n = line.length; int cur = 0; int hand = -1; int zeroTail = 0; for (int i = n - 1; i >= 0; i--) { if (line[i] == 0) zeroTail++; else break; } ...
fb45e75b-591a-4d1b-a269-05dc84b2f6fe
6
@Override public boolean contains(T element) { int hashCode = element.hashCode() % hashTable.size(); int i = hashCode; int j = 0; while (hashTable.get(i) != null) { if (hashTable.get(i).equals(element)) { return true; } //special case for last hash spot if(hashTable.get(hashTable.size()-1) != n...
4bf90230-2c24-4b65-9529-f6b218a7eca2
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; if(msg.amITarget(mob) &&(amountOfShieldArmor>0) &&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK) &&(CMLib.flags().isAliveAwakeMobileUnbound(mob,true)...
5b531022-bf39-4a7d-8bab-eb0ccf862565
5
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "ok" - Data entry is complete // "cancel" - Cancel the request // "help" - Display help for accounts // try { switch (ae.getActionCommand()) { ...
d37dc09f-7a65-4efe-b158-21f4788cb90b
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if((tickID==Tickable.TICKID_MOB) &&(affected instanceof MOB) &&(((MOB)affected).location()!=null) &&(((MOB)affected).location()!=lastRoom) &&((((MOB)affected).location().domainType()&Room.INDOORS...
ad3052cc-320a-4edf-9084-cd84362cf567
4
public static void buildContact(ContactEntry contact, List<String> parameters) { for (String string : parameters) { if (!string.startsWith("--")) { throw new IllegalArgumentException("unknown argument: " + string); } String param = string.substring(2); String params[] = param....
2f1e0bcc-bbc7-4a07-b88f-dca009d0aa5d
9
public boolean[] homozygous(int c, boolean founder) { boolean[] result; Chromosome chrom = popdata.getChrom(c); if (chrom==null || chrom.getLocus()==null || chrom.getLocus().isEmpty()) { result = null; } else { result = new boolean[chrom.ge...
c90c704e-d31c-49bd-9188-66bed79b2956
7
private void calcNavigatePageNumbers(){ //当总页数小于或等于导航页码数时 if(pages<=navigatePages){ navigatePageNumbers=new int[pages]; for(int i=0;i<pages;i++){ navigatePageNumbers[i]=i+1; } }else{ //当总页数大于导航页码数时 navigatePageNumbers=new int[naviga...
d9f9dc06-17e7-45b4-9608-8d6cad653c04
3
public static void quickSort(int[] array, int start, int end){ if(end > start){ // i: end of the smaller list + 1 int i = start; int temp; int pivot = array[end]; int random = start + new Random().nextInt(end - start + 1); array[end] = array[random]; array[random] = pivot; pivot = array[end];...
4d720792-e18e-45f5-9fa6-e17efdf2f3d8
4
public static Class<?> getClassForName(String name) { try { return Class.forName(name); } catch (Exception e) { // ignore } for (int i = 0; i < packages.size(); i++) { try { String s = packages.get(i); return Class.forName(s + "." + name); } catch (Exception e) { // i...
02298ee2-3737-4b6a-8925-ada109e1ea3c
5
public static String pick(String xml) throws Exception { if (null == xml || xml.trim().isEmpty()) return EventType.NULL_EVENT; List<Element> root = WechatUtils.getXmlRootElements(xml); for (Element element : root) { if (EventType.EVENT_TAG.equals(element.getName())) { ...
9b4c91f1-df90-4ee0-9d0a-a46091b1d6db
4
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerQuit (PlayerQuitEvent event){ Player player = event.getPlayer(); World world = player.getWorld(); playeren = player; worldet = world; plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void ru...
569bc255-32e4-422e-82aa-ff406649fd32
0
public void setId(String id) { this.id = id; setDirty(); }
598e68a0-7450-4fd9-bbd2-e1f50f760db3
6
public void windowSizeListValueChanged(ActionEvent e) { int size = Integer.parseInt(windowSizes[jComboBox1.getSelectedIndex()].substring(0,1)); for(int r = 0; r < ROWS; r++) for(int c = 0; c < COLS; c++) { if( (r >= ROWS/2 - size/2) && (r <= ROWS/2 + size/2) && (c >= COLS/2 - size/2) && (c <= COLS/2 + si...
b5f9fcb6-6a90-470d-871c-7e8bf1c67c64
9
public void performMouseClick(Point thePoint) { prevMouseClick.setLocation(mouseClick.getLocation()); mouseClick.setLocation(thePoint); Point prevCell = new Point(); prevCell.setLocation(Math.floor((float)translate(prevMouseClick).x / cellWidth), Math.floor((float)translate(prevMouseClick).y / cellHeight));...
502eb2c7-be2b-4880-b287-fe93434daf28
9
public static List<ItemStack> getWrittenBooks() { List<ItemStack> list = new ArrayList<ItemStack>(); if (BungeeUtilities.getInstance().getConfig().getBoolean("server-menu.books.enabled")) { for (String file : BungeeUtilities.getInstance().getConfig().getStringList("server-menu.books.files")) { ItemStack book...
d62b5937-3b85-4a3d-8a47-d382d6dd6226
9
@Override public void run() { // Find the server using UDP broadcast try { //Open a random port to send the package c = new DatagramSocket(); c.setBroadcast(true); byte[] sendData = "DISCOVER_FUIFSERVER_REQUEST".getBytes(); //Try the 255.255.255....
5b2f41d8-28d6-4d34-968c-9b1ca072de60
4
public static int nbJoueur() { int nb = 0; boolean isNumber = false; while(!isNumber){ try{ isNumber = true; System.out.println("\nA combien de joueur voulez-vous jouer ? 2,3 ou 4"); nb = sc.nextInt(); ...
7c235267-bbd8-4e09-957b-98768fa4c10d
6
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof DatasetAttributePK)) { return false; } DatasetAttributePK other = (DatasetAttributePK) object; if ((this.datase...
9b83cab9-e8d4-4be2-b6b5-e2b0903853d9
3
public void calculate(double rate, double hours, double salary) { if (rate == 0) { rate = salary * (1 / hours) * (1 / WKS_PER_YR); rateField.setValue(rate); } if (hours == 0) { hours = (1 / rate) * salary * (1 / WKS_PER_YR); hoursField.setValue(hours); } if (salary == 0) { salary = rate * hour...
da1043b8-fa03-406c-92de-3762e69e9e77
6
public void makeSureDataDirectoryAndChestsCreated() { File dataFolder = plugin.getDataFolder(); if (!dataFolder.exists()) { dataFolder.mkdirs(); } File chests = new File(plugin.getDataFolder(), "chests"); if (dataFolder.exists()) { if (!chests.exists()) { try { chests.createNewFile...
f6ddd0a4-b494-4abd-863b-dc230c31e57d
2
private void drawRowOfCards(Graphics g, int whichRow) { for(int i = 0; i < cards[whichRow].length; i++){ if(cards[whichRow][i] != null){ cards[whichRow][i].drawCard(g, this); } } }
f200cfc1-b822-416b-b598-344c613e04e2
4
public String Farbe2String() { switch (farbe) { case KARO: return "Karo"; case HERZ: return "Herz"; case PIK: return "Pik"; case KREUZ: return "Kreuz"; } System.out.println("Farbe falsch! : "+farbe); return "-1";...
ac176ca4-19eb-4126-a34b-c673fa026425
1
@Test @Transactional public void testFullCycle() throws Exception { QuoteProvider provider = new DummyQuoteProvider(quoteEngine.registerProvider(Symbol.EURUSD)); executorService.submit((Runnable) quoteEngine); executorService.submit((Runnable) provider); long nTrials = 2; ...
daba06dd-4ba7-4f68-89e6-f6eea4674231
1
public void setSortCriteria(int sequence, boolean ascending) { if (mAllowSort) { mSortSequence = sequence; mSortAscending = ascending; } }
dd633c0b-58d7-4913-84e1-d0f42aa49183
1
private void expression0() { expression1(); if (accept(NonTerminal.OP0)) { expression1(); } }
d66c49b8-651a-4224-9c53-374311ca66c6
7
private void updateColors() { // [srk] bug -- we got a null pointer exception here // make sure node is not null if (node == null) { return ; } // end if if (node.isAncestorSelected()) { if (pApplyFontStyleForComments && node.isComment()) { setForeground(pCommentColor); } else { setForegro...
67bb1576-38cb-4c8e-859b-d84624d04178
3
public void WriteAllLND(boolean writeAlsoInHex) { System.out.println("Last numbers dialed: "); for (int i = 1; i <= DatabaseOfEF.EF_LND.getNumberOfEntries(); i++) { if (!getters.getLNDString(i, false).isEmpty()) { //print only valid data, not FF if (writeAlsoInHex) { ...
cb28176e-beaa-4af2-b1ae-121ad4761b58
7
public static boolean deleteDept(String depName) { ResultSet rs = null; Connection con = null; PreparedStatement ps = null; boolean result = true; try { String sql = "DELETE FROM department WHERE UPPER(deptName)=(?)"; con = ConnectionPool.getConnectionFromPool(); ps = con.prepareStatement(sql); ...
9d2e148e-8994-4aff-9371-a4eb697fed75
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Train train = (Train) o; if (id != train.id) return false; if (totalSeats != train.totalSeats) return false; if (departure != null ? !d...
a8467c61-0756-4814-8ee7-73c58650440a
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
7a64d0e6-18d6-4a63-ba7a-3e37d74f5360
0
public byte[] getPeerId() { return this.peerId.array(); }
d416bf15-4b34-4e2d-8a90-eff103a0a8b1
6
public static void addMetadata(String fileName) throws Exception { HashMap<String, RawDesignMatrixParser> metaMap = RawDesignMatrixParser.getByFullId(); HashMap<String, String> kitMap = PValuesByExtraction.getManualKitManufacturer(); BufferedReader reader = new BufferedReader(new FileReader(new File( ...
59a42e7d-cf8b-470c-983b-cf5918dda3ed
7
public void move(int xa, int ya) { if(xa != 0 && ya != 0) { move(xa, 0); move(0, ya); return; } if(xa > 0) dir = 1; if(xa < 0) dir = 3; if(ya > 0) dir = 2; if(ya < 0) dir = 0; if (!collision(xa, ya)) { x += xa; y += ya; } }
22968c4f-aad1-4cc8-8794-362a3c6b18dc
9
private void wypiszDaneZListy(MyArrayList_v2 listaPN, Sheet s, XSSFWorkbook wb) { //zdefiniuj styl komrek CellStyle style = getStylStandardowy(wb); CellStyle styleB = getStylWyrozniony(wb); // TODO Auto-generated method stub //dodaj pozycje z listy int rowNum = 1; for (int i = 0; i < listaPN.size();...
06765e0e-e496-41c2-b181-030ca6d6bd0a
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String[] s = sc.next().split(","); Point[] p = new Point[4]; for(int i=0;i<4;i++)p[i]=new Point(Double.parseDouble(s[i*2]),Double.parseDouble(s[i*2+1])); boolean l = true; boolean r = true; for(int i...
b50031d7-e3c2-4e6b-a588-2c8ca95f2e1d
1
private void piirraKilpienergia(Graphics graphics){ int x = (int)(getX() - vartalo.getHalkaisija()/2); int y = (int)(getY() - vartalo.getHalkaisija()*8/10); int leveys = (int)(vartalo.getHalkaisija()); int korkeus = (int)(vartalo.getHalkaisija()/5); graphics.setColor(Color.BLACK)...
ded930b3-e62a-4443-83c9-2228fe83a5cc
9
void run(){ Scanner sc = new Scanner(System.in); char[] s = sc.nextLine().toCharArray(); int c = 0; int n = s.length; for(int i=0;i<=(n%2==1?n/2:n/2-1);i++){ char c1 = s[i]; char c2 = s[n-i-1]; if(c1=='i'){ if(c2!='i')c++; } else if(c1=='w'){ if(c2!='w')c++; } else if(c1=='('){ ...
8e0e8d88-d8a8-49aa-af6e-6093e6a55aa6
5
public ClubSignupPage enterCASL(Boolean value) { try { //if (driver.findElement(By.name("termsAndConditionsForm.canadaOptIn")).size() > 0) { // System.out.println("size of tnc exist"); //if ( value == true ){ By casl = By.name("termsAndConditionsForm.canadaOptIn"); //casl.click(); //} while (1==1){ ...
2d43e1f2-5281-40e2-8218-07a26e33d306
3
public static Field getDeclaredField(Class<?> cl, String field_name) { try { Field field = cl.getDeclaredField(field_name); return field; } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); ...
0d846b5d-fe12-403b-8769-4a5b891d800b
0
public ObjectFactory() { }
2798051b-1311-407f-b794-44f98c68592c
7
public static void main(String[] args) throws Exception{ SOP("==========Chapter 2 Linked Lists==="); SOP("To run: java c2 [function name] [function arguments (i.e. node values in linked list)]"); SOP("Example: java c2 q1 1 2 3 4"); SOP(""); SOP("Possible functions:"); SOP...
447689a9-f566-4181-8d41-9e6ef420ca99
9
public AAFFMinimizer(MolecularModel m) { super(JOptionPane.getFrameForComponent(m.getView()), "Energy Minimizer", false); String s = MDContainer.getInternationalText("EnergyMinimizer"); if (s != null) setTitle(s); setDefaultCloseOperation(DISPOSE_ON_CLOSE); job = new MinimizeJob(m); JPanel panel = new...
5505d267-fbef-44ed-ba58-63a7785b14a7
9
protected void cellAdded(Object cell) { if (cell instanceof mxICell) { mxICell mxc = (mxICell) cell; if (mxc.getId() == null && isCreateIds()) { mxc.setId(createId(cell)); } if (mxc.getId() != null) { Object collision = getCell(mxc.getId()); if (collision != cell) { while ...
150be71d-9f78-4998-8cf3-54a74a0103aa
4
public static InetAddress getLocalAddress() throws SocketException { Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); while (ifaces.hasMoreElements()) { NetworkInterface iface = ifaces.nextElement(); Enumeration<InetAddress> addresses = iface.getInetAddresses(); while (addre...
109493d3-760b-4250-a1a9-87093778b81a
3
public void Woodcutting(String logName, int lvlReq, int XPamount, int log, int amount, int obj, int X, int Y, int emote) { if(WCTimer <= 0) { if(playerLevel[8] >= lvlReq) { pEmote = emote; resetanim = 999; sendMessage("You begin to cut the "+logName+" tree."); logID = log; logAmount = amount; TreeX...
f79cc741-bd9c-4d70-b226-d47efa01fe0f
3
public static void printMatrixNonZeroValues(WindMatrix matrix, String title) { System.out.println(); System.out.println(title); for(CellBase[] cols : matrix.getCells()) { for(CellBase cell : cols) { // TODO: handle obstacle cells if (cell.getWind().mag() > 0) System.out.println( "col=...
03df80c8-a43d-4010-840f-283c32484273
9
public static void main(String args[]) { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String command; Class klasses[] = {Student.class, Accessories.class, Description.class, Ins...
7df2c1b4-c613-4fff-96f4-b2345f736d64
8
private void setAttributes(TagNode node, Element element) { for (Map.Entry<String, String> entry : node.getAttributes().entrySet()) { String attrName = entry.getKey(); String attrValue = entry.getValue(); if (escapeXml) { attrValue = Utils.escapeXml(attrValue,...
8ab0f3c7-5d7a-473d-89be-693ef8279cc3
6
private Cmp relation() throws Exception { Value left = expression(); Cmp.CmpType op; // relOp switch (scan.sym) { case eq: op = Cmp.CmpType.eq; break; case neq: op = Cmp.CmpType.neq; break; case lt: o...
335cf966-e449-4d48-9417-6f6a63ed758d
5
@Override public void checkPermission(Permission perm) { if (perm instanceof FilePermission) { if ( perm.getActions().equals("read")) { return; }else if(perm.getActions().equals("write") || perm.getActions().equals("delete") && perm.getName().index...
17f79bb5-955d-4607-abcf-e72eb151bcab
8
protected void indicateStatus(NormalizedEvent nevent) { if (nevent.isClosed()) { _active = false; _status.setStatus(_ric + " Closed: " + nevent.getStatusText()); for (Enumeration<FieldRenderer> en = _fieldRenderers.elements(); en.hasMoreElements();) { ...
666a88bc-a925-4eac-b2d7-9de180638c69
1
public String toString() { int i; Object obj; String result = "[ "; SListNode cur = head; while (cur != null) { obj = cur.item; result = result + obj.toString() + " "; cur = cur.next; } result = result + "]"; return result; }
52adbfbb-f431-467d-91c1-163a80077af0
7
@Override public void update(Observable o, Object arg) { if (arg != null && arg.equals("hint")) { //the user has pressed the 'hint' button this.setBorder(BorderFactory.createLineBorder(Color.green)); //sets the border to green to display that there is no mine in that square } else if (cellModel.getExploded(...