method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f442f27d-736d-4980-a0f8-d77133964ba7
4
public void check() { for (RandomEvent rand : getHandlers()) { rand.getContext().setAccount(ctx.getBot().getLastAccount()); if (!ctx.getBot().isScriptStackEmpty() && ctx.getBot().peekScript() != rand && rand.init()) { ctx.getBot().pushScript(rand, true, ctx.getBot().getLastAccount()); return; } } ...
4093fdb1-7a51-434c-92b6-cb814d22e396
2
public String getPIDByLocation(Statement statement,String city,String district,String parkname)//根据地点获取PID { String result = null; sql = "select PID from Park where city = '" + city +"' and district = '"+district+"' and parkname = '"+parkname+"'"; try { ResultSet rs = statement.executeQuery(sql); while ...
c69cc8ca-bbf5-4341-94bb-161ac04fce1d
5
@Override public void update() { if (KeyHandler.isValidationKeyPressed()) select(); if (KeyHandler.isPressed(KeyHandler.UP)) { currentChoice--; if (currentChoice == -1) currentChoice = options.length - 1; } if (KeyHandler.isPressed(KeyHandler.DOWN)) { currentChoice++; if (currentChoice ==...
98d9130a-8de2-4589-9c75-389c6d90d090
1
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (debug) { log("FiltradoSesion:doFilter()"); } doBeforeProcessing(request, response); HttpServletResponse hsr = (HttpS...
9269a408-727f-452f-9584-801c61632901
0
public String pokazSzczegoly() { pokazOsobe = osoby.getRowData(); return "szczegoly"; }
8e563595-5948-4de7-bcef-804a556174f0
2
public void run() { int actPage = minPage; while (actPage <= maxPage) { try { beginTransaction(); Client.sleep(1000); write("Erster Eintrag Für Transaction " + currentTa.getTaId(), actPage); actPage++; Client.sleep(1500); write("Zweiter Eintrag Für Transaction " + currentTa....
15084e3b-3652-4c8e-aba6-106834c1bfe0
4
@Override protected void doAction(int option) { switch (option) { case 1: viewSchedule(); break; case 2: matchResults(); break; case 3: scheduleMatch(); break; ...
7c5e1158-a9f4-4e74-a08b-60116bb82083
1
private void process() { if (!GuiUtils.validUserKeyField(userKeyTextField)) { return; } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GuiUtils.getUserTests(testIdComboBox, mainPanel, cloudPanel, userKeyTextField.getT...
40b0972b-1e06-4d6c-a265-ac2f83d0b144
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
911cc708-9e92-48c9-8ac1-004263479c68
5
@Override public String generateCode() { if (constant != null) return constant.generateCode(); else if (expression != null) return expression.generateCode(); if (id != null) { List<Integer> dimensions = getVariable(id).getType().getDimensions(); if (dimensions != null) lVal...
8f850f68-bf81-49eb-b857-17dda5fcb850
8
private final void parseDispatchTable(ParseUtil.IndentableLexer lexer) throws IOException, RuntimeException { lexer.skipSpaces(); lexer.pass('('); lexer.skipSpaces(); dispatchSuboffset = lexer.readUnsignedInteger("dispatch suboffset"); lexer.skipSpaces(); lexe...
6fc56832-8c4a-4137-bf24-afc355480772
2
public void actionPerformed(ActionEvent e) { if (Integer.parseInt(e.getActionCommand()) == E5Actions.FORWARD) { currentItem++; } else if (Integer.parseInt(e.getActionCommand()) == E5Actions.BACKWARD) { currentItem--; } changePanel(); }
80af1948-6db6-430b-b914-b294741ce3f4
4
protected void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { HttpSession session = req.getSession(true); int uid = (int)((User)session.getAttribute("currentSessionUser")).getId(); List<Order> cart; try { cart = OrderDAO.list(uid); //HashMap<Product,In...
c463e3a7-dabe-43fa-9fef-2213d30b0fc7
7
long alphaBeta(Board board, long limit, long alpha, long beta) { long result; //last 1 turn -> evaluate + flip count (not exec board.put) if (board.getTurn() == Board.MAX_TURNS - 1) { CopyOnWriteArraySet<Disc> movables = board.getMovablePos(); if (!movables.isEmpty()) { Disc disc = (Dis...
72257aeb-48b0-4696-9488-7fbefac9d767
8
public static void parse(final PgDatabase database, final String statement, final boolean outputIgnoredStatements) { final Parser parser = new Parser(statement); parser.expect("ALTER", "VIEW"); final String viewName = parser.parseIdentifier(); final String schemaName = Parse...
665dd013-dbe4-4007-88c0-d0ad8d066dda
0
public JTextField getRech() { return rech; }
99ad040a-a7a5-442c-8e87-4fb68ab7d56c
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = null; request.setCharacterEncoding("UTF-8"); String name = request.getParameter("username"); String password = request.getParameter("passw...
baba3160-2b33-4e41-acf4-804a91623595
5
public ArgsParser(String[] args) { for (int i = 2; i < args.length; i++) { switch (args[i]) { case "-v": isNeedTime = true; break; case "-w": isNeedNumberWords = true; break; ...
3ef6c152-785c-435e-93ec-64671b98ab84
6
public String toString(){ String str = "\n -------- \n"; str += "Festival name: " + name + "\n"; str += "Date of festival " + date + "\n"; str += "Runs from " + startTime + " to " + endTime + "\n"; if(stages.isEmpty()) str += "No stages made. \n"; else for(Stage s : stages){ str += s.toString(); ...
766b9163-8efd-44db-8429-0b6d98bb24b1
3
@Override public void drawRect(int fbo, int texId, BlendMode mode, double startX, double startY, double endX, double endY, double texStartX, double texStartY, double texEndX, double texEndY, Color c, double transparency) { bindRenderTarget(fbo); glColor4f((float) c.getRed(), (float) c.getGreen(), (fl...
9f38060c-4e8f-49d2-856e-13e2a98f6a82
2
public Dado buscaDado(String label) { Dado dadoResultado = null; for (Dado d : listaDados) { if (d.getName().equals(label)) { dadoResultado = d; } } return dadoResultado; }
061de6db-422e-4565-a520-32c25b252459
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; return Arrays.deepEquals(m, ((Matrix) obj).m); }
5bbf6c71-676f-49e2-aad6-8647271787c3
9
public void generate(JFormatter f) { if (isConstructor && type.isArray()) { // [RESULT] new T[]{arg1,arg2,arg3,...}; f.p("new").g(type).p('{'); } else { if (isConstructor) f.p("new").g(type).p('('); else { String name = this...
35a4a99a-113e-4af9-bff4-d1f6bf96cd1a
6
public void resetVisibility(){ if(supportBackgroundPalette){ for(int i=0;i< maxBackgroundPaletteSize;i++){ if(i < visibleBackgroundPaletteSize){ imagePalette[i].setVisible(true); } else { imagePalette[i].setVisible(false); ...
d80cd224-42fd-4bf1-b1b9-391a3fb3917c
8
@Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { // Save parameters from storm this.conf = conf; this.context = context; this.collector = collector; // get cursor, where we left of, for this executor // get this task id ...
8f00700e-ce1c-4ee1-8bd3-f2f4810a1189
9
public void run() { try { String edge_id = ControllerEngine.gdb.getResourceEdgeId(resource_id, inode_id); if(edge_id != null) { String pnode_node_id = ControllerEngine.gdb.getIsAssignedParam(edge_id, "out"); if(pnode_node_id != null) { pnode_node_id = pnod...
20712f9d-6d50-48c8-a511-6589d4081046
1
private boolean jj_2_78(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_78(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(77, xla); } }
5637f193-2f5e-4bf1-b8e6-eea9a9d11d8a
4
public static byte[] encrypt(byte[] message, int k) throws Exception { byte[] ps = new byte[k - message.length - 3]; new Random().nextBytes(ps); for (int i = 0; i < ps.length; i++) if (ps[i] == 0x00) ps[i] = (byte) 0x01; byte[] encoded_message = new byte[message.length + ps.l...
3bf3545a-c1e3-4441-8f5e-f9305296077c
7
private static Entry mergeLists(Entry one, Entry two) { /* There are four cases depending on whether the lists are null or not. * We consider each separately. */ if (one == null && two == null) { // Both null, resulting list is null. return null; } else if (one != n...
95f66ac8-2f13-4038-8660-b97ec5420690
9
public boolean processa(String string){ this.string = string; QuantidadeChars = this.string.length(); for (int n = 0; n < QuantidadeChars; n++){ //logic to process each char switch (EstadoAtual) { case "q0": if (this.string.charAt(n) ==...
eaab70b1-0741-4e69-8287-a2423f475e03
7
@Override public void mousePressed(MouseEvent e) { Object sender = e.getSource(); if (sender == _redPrimeButton) { tryToPrime(_redPrimeButton, _game.getRedLauncher()); _fireButton.setOn(_game.isPrimed()); } els...
927882f6-48e3-4aa6-8290-172ff9dbd3be
3
public static void clearComment(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { clearCommentForSingl...
9dcc76ad-53c2-436f-9407-689012cf8aae
2
public static void sellStock(String uid, String id, int amount) { /* May be add IF loop here with canSell to handle the condition here */ int currAmount = stocks.get(id); UserStorageAccess xmlAccessor = new UserStorageAccess(); Stock currentStock = StockControl.queryStock(id)...
387df0be-e22a-43b1-9ed4-f55fa672b9d2
3
public String toString() { return String.format("%02d:%02d:%02d %s", (hora == 12 || hora == 0) ? 12 : hora % 12, minuto, segundo, hora < 12 ? "AM" : "PM"); }
bed31497-aec7-4da0-8583-9b6c8bb8cc89
1
private String getTimestamp() { try { final GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(new Date(startTime)); final XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar); return xmlCalendar.toString(); } catch (DatatypeConfigura...
a84fa0c2-035d-4caa-a194-f5db0b8d82d3
1
public Double extract ( String word, String pos ) { String temp = word + "#" + pos; if ( _dict.containsKey(temp) ) { return _dict.get(temp); } return -2.0; }
f0d4ba6d-378c-4e24-a6a6-4f9e0b2f6995
9
@SuppressWarnings("unchecked") private void addInlineDiffs(Delta delta) { List<String> orig = (List<String>) delta.getOriginal().getLines(); List<String> rev = (List<String>) delta.getRevised().getLines(); LinkedList<String> origList = new LinkedList<String>(); for (Character charact...
ca48e503-4612-4103-801a-bfe8c9a3bade
6
public void onPlayerMove(PlayerMoveEvent event) { if (event.isCancelled()) { return; } if (!Config.isCreativeModeEnabled()) { return; } PlanArea fromArea = BuildingPlanner.plugin.areaManager.getAffectedArea(event.getFrom()); PlanArea toArea = BuildingPlanner.plugin.areaManager.getAffectedArea(event.get...
c3eab629-0348-420c-8823-96ac534a9c35
0
public EncryptionPropertyType createEncryptionPropertyType() { return new EncryptionPropertyType(); }
caeca2f5-255a-4eab-86c2-4d38a78027a5
0
public String getCode() { return code; }
4207ba29-aae1-4c78-9a05-b6abd9111c50
5
public String getMessage() { String tmp = ""; int loop = 0; if (bot.colonSplit.length >= 2) { for (String str : bot.colonSplit) { if (str.contains("PRIVMSG")) loop = 1; else if (loop == 2) tmp = str; else if (loop > 2) tmp = tmp + ":" + str; loop++; } return tmp; } return ""...
3f4b1670-8cf7-4f82-8579-81b95f3f7a2c
8
public List<Offer> listOffer(long userid, long uprofile) { List<Offer> list = null; String listOffer; if (uprofile == 3) { listOffer = "select offer_name,offer_amount,billing_cycle from trackman.defining_offer"; } else { listOffer = "select offer_name,offer_amoun...
9c87382b-fb02-4a51-98fb-049984e1736b
5
public void actionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == btnEnterRecord) { MainGUI.this.btnEnterRecordActionPerformed(evt); } else if (evt.getSource() == btnDisplayList) { MainGUI.this.btnDisplayListActionPerformed(evt); } else ...
a13a8d95-81f9-4da4-870a-5f3073d417e1
7
@Override public void select(EdaChromosome[] edaIndividuals, EdaChromosome[] selectedIndiviuals) { Random rand = new Random(); int max = 0; int sum = 0; for (int i = 0; i < edaIndividuals.length; i++) { sum += edaIndividuals[i].getActualDuration(); if (i==0 || max < edaIndividuals[i].getActualD...
6f688e27-d8f0-4558-bbb4-8433b7d558d4
7
public boolean isPalindrome1(ListNode head) { ListNode slowp = head, fastp = head, revp = null; while (fastp!=null && fastp.next!=null){ fastp = fastp.next.next; ListNode tmp = slowp.next; slowp.next = revp; revp = slowp; slowp = tmp; } if (fastp!=null) slowp = slowp.next; if(log){ ListNo...
3a74b461-44b1-4572-97ca-da51f3438c12
5
public AffinityMatrix(PrimsMST minSpanningTree){ TunableParameters parameters = TunableParameters.getInstance(); int n = parameters.getDataSetSize(); double sigma = parameters.getSigma(); //initialize the matrix _affinityMatrix = new double[n][n]; // i know it's ridiculo...
ce0b26b4-78a7-4868-b4d5-f84402416def
1
@Override public boolean retainAll(Collection<?> c) { // TODO Auto-generated method stub return false; }
a0116b6d-8059-43e7-92d8-4a6af6ca2e00
5
private void newFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newFileButtonActionPerformed if (evt.getSource() == newFileButton) { final JFileChooser fc = new JFileChooser((baseFile != null) ? baseFile.getParent() : ""); int returnVal = fc.showOpenDialog(th...
2c486aa6-9722-46ea-a559-410fcb245172
7
public synchronized void doStep(boolean forward) { if(forward){ if(pause != 0 && inpause){ //1 step gcodepainter.interrupt(); }else if(pause == 0 ){ //10 steps setCmd(Commands.STEP50X); } }else{ if(pause != 0 && inpause){ setCmd(Commands.STEPBACK); }else if(pause == 0 ){ //10 ...
013c8f3f-4240-4819-9393-a8e48bac658f
1
public static void createWindow(int width, int height, String title, boolean resize) { Display.setTitle(title); Display.setResizable(resize); try { Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); Keyboard.create(); Mouse.create(); } catch (LWJGLExcept...
712f650e-a719-4350-bbad-1e6ae11731ac
3
public void setRelativeMouseMode(boolean mode) { if (mode == isRelativeMouseMode()) { return; } if (mode) { try { robot = new Robot(); recenterMouse(); } catch (AWTException ex) { // couldn't create ...
187c1932-0af8-4784-b4a6-7616dc5d3b7e
4
private void transferAllCitiesTo(EU3Country country) { final String tag = getTag(); final String otherTag = country.getTag(); ((EU3SaveGame)dataSource).preloadProvinces(); for (GenericObject prov : ((EU3SaveGame)dataSource).provinces) { if (prov.getString("owner").eq...
e085369f-b363-45d5-815b-1a51fb89e3bb
1
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { index.visit(visitor); array.visit(visitor); } else { array.visit(visitor); index.visit(visitor); } }
d3154f05-a154-47c4-9466-7a7905536212
2
public void addHoveringElement(PositionChangedObservable e) { if (e == null || !e.getPositions().contains(position)) throw new IllegalArgumentException("The given element is invalid!"); hoveringElements.add(e); }
6e15fa8a-1910-48ba-888a-688ad24b9557
7
public void cleanMaxRowPedinaTab(){ int min=12; //Recupero la riga dei pezzi più avanzati for(int i=0;i<desmosse.length;i++) if(desmosse[i]!=null && desmosse[i].getMossa().getStartPos().getRow()<min) min = desmosse[i].getMossa().getStartPos().getRow(); System.out.println("Il minimo valore della ri...
4e39d20b-f6ea-4f26-b6ce-6e6dd90ceb62
4
public SieveOfEratosthenes(int n) { a = new boolean[n + 1]; for (int i = 1; i <= n; i++) // n iterations a[i] = true; // An iteration marks all numbers which are multiples of i as non prime for (int i = 2; i < n; i++) { // If a number, c, is already marked prime then its multiples are // already m...
d4975c3a-35df-4831-b40c-738c23dd580a
9
private void handleFilesForReprocessing(Connection dbConnection) { logger.info("Looking for files that are set to be reprocessed."); try { // first look for files that have the reprocess flag set and process_state as 1, and update their process_state and reset the flag // if the process state is 2 (error)...
806e481f-a1f9-4cce-87eb-5d04c281e2fb
0
public String getCp() { return cp; }
5fb1f012-3030-4668-aa11-4adc52e15856
1
HeapNode(double key, V value) { this.index = 0; this.key = key; this.value = value; this.hind = null; try { hind = (HeapIndex) this.value; } catch (Exception ex) { this.hind = null; } }
5133bb10-ad4d-4a41-88c1-56659d6978a8
2
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } ...
f4e0ae3a-e6dc-4de2-b32a-43c69013d6d1
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
7815d2f1-f7d7-458e-b109-1e4c4b832acf
0
public final int getOnlsize() { return onlsize; }
06eca7fa-7081-4025-822d-06886027f3d3
2
public static void selectUpText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int currentPosition = textArea.getCaretPosition(); if (currentPosition == 0) { return; } // Update Preferred Caret Position int newCaretPosition = 0; ...
5b17c290-99ca-4e49-ade0-c195bc0a9a3c
7
public static boolean ismetabolite(PathCaseNodeRole r) { return r == PathCaseNodeRole.SUBSTRATEORPRODUCT || r == PathCaseNodeRole.REGULATOR || r == PathCaseNodeRole.INHIBITOR || r == PathCaseNodeRole.ACTIVATOR || r == PathCaseNodeRole.COFACTOR || r == PathCaseNodeRole.COFACTORIN || r == PathCaseNodeRole.COFACTO...
9aa85a68-6f3a-4130-ab15-882a69abb347
2
@Override public boolean verify() { String sol; if (getPhrase().core.reverse) sol = phr1; else sol = phr2; boolean answerCorrect = answerPanel.getAnswer().equals(sol); updatePerfData(answerCorrect); if (!answerCorrect) { answerPanel.setSolution(sol); answerPanel.highlight(); } getPhr...
e35b0842-be42-436f-803e-8943c8001d49
8
public void setSystem(StarSystem s) { // Power int powerSurplus = s.getSystemPowerSurplus(); Color powerColor = Color.BLACK; if (powerSurplus >= 0) { powerColor = Colors.SYSTEM_KPI_POSITIVE; } if (powerSurplus < 0) { powerColor = Colors.SYSTEM_KPI...
283e8631-a4d8-4c8c-9ba4-af3c4d89ec10
6
public static Credentials loadCredentials(String aFile) { Credentials cre = null; try { FileInputStream fileIn = new FileInputStream(aFile); ObjectInputStream in = new ObjectInputStream(fileIn); Object obj = in.readObject(); if (obj instanceof DBCredent...
2706db7a-a7f5-417d-99ed-e282757a82cb
8
private static BitSet getLiveStatesToAccept(Automaton a) { Automaton.Builder builder = new Automaton.Builder(); // NOTE: not quite the same thing as what SpecialOperations.reverse does: Transition t = new Transition(); int numStates = a.getNumStates(); for(int s=0;s<numStates;s++) { builder.c...
07b07820-1015-4ff3-93bc-709ac9174e9a
1
@BeforeClass public static void backupContactsTxt(){ try { Files.copy(Paths.get("contacts.txt"),Paths.get("contactsCOPY.txt")); Files.delete(Paths.get("contacts.txt")); } catch (IOException e) { e.printStackTrace(); } }
2b81c4d2-a6a7-47e8-959d-50d43d6a2cac
5
public Rennschnecke ermittleGewinner() { Rennschnecke gewinner = null; for (Rennschnecke schnecke : this.schnecken) { if (schnecke.getDist() > this.rennDist) { if (gewinner == null) { gewinner = schnecke; } else { if (schnecke.getDist() > gewinner.getDist()) { gewinner = schnecke; } ...
540df886-6053-47fe-a59a-b4f0bdb67bb3
8
public short getLength() { // start with the length of the superclass short length = super.getLength(); // add the length of the end points length += getNumContours() * 2; // add the length of the instructions length += 2 + getNumInstructions(); ...
898afed5-a46a-4148-bf52-0358f9b70e2b
7
private static String convert(String text) { StringBuffer converted = new StringBuffer(text.length()); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'))) { converted.append(c); } else { ...
35488734-ed63-40d1-9aa8-dfb81d36c214
6
public static void main(String[] args) { Rectangle rec = new Rectangle(new MyPoint(2,4), new MyPoint(4,6), new MyPoint(2,4) ,new MyPoint(4,8)); Class recClass = rec.getClass(); Field[] recFields = recClass.getDeclaredFields(); Method[] recMethods = recClass.getDeclaredMethods(); ...
5170ebc1-474f-4961-8978-e0f5606056c0
7
private String daysToString(Collection<? extends Integer> days) { StringBuilder sb = new StringBuilder(); for(int d : days) { switch(d) { case MONDAY: sb.append("M "); break; case TUESDAY: sb.append("T "); break; case WEDNESDAY: sb.append("W "); break; case THURSDAY: sb.ap...
6fbc5b21-02cd-41e3-9240-7a4cbca2b5e3
3
@Override public void deserialize(Buffer buf) { id = buf.readShort(); if (id < 0) throw new RuntimeException("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0"); int limit = buf.readUShort(); finishedObjective = new AchievementObject...
ecba3f59-3381-4358-adf7-b7a6ea808f09
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...
0119c924-0c0a-416b-8878-558dbb6991ac
0
public void setPopNombreProveedor(String popNombreProveedor) { this.popNombreProveedor = popNombreProveedor; }
0c608b8c-4ffa-4b66-86b0-ee3b4d794cdb
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Banco other = (Banco) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; ret...
a008461f-5c89-4761-8d28-02e619aaaf9f
5
public void generate() { grid = new Color[getSize()][getSize()]; // set all cells to green by default for (int i = 0; i < getSize(); i++) { for (int j = 0; j < getSize(); j++) { grid[i][j] = Color.GREEN; } } int total_cells = getSize() * getSize(); int ten_percent = (int) Math.floor(total_cells ...
a5a92f08-2412-44c7-8df9-a12f3990d47b
3
public StageFlipper runLobby() { if (saveMsg != null) { lg.lobby.setVisible(true); @SuppressWarnings("unused") StageFlipper startup = saveMsg; } while (loop) { try { String mess = receiveMessage(); int id = retrieveId(mess); decodeAndRender(id, mess); } catch (IOException | JSONExc...
3ffba832-3207-4724-b68b-69ca17194b11
3
public static final BasicGraphEditor getEditor(ActionEvent e) { if (e.getSource() instanceof Component) { Component component = (Component) e.getSource(); while (component != null && !(component instanceof BasicGraphEditor)) { component = component.getParent(); } return (BasicGraphEditor)...
4c7d459e-9d77-4c96-a18e-641e2104f50d
6
public static int insertUser(String u_name, String u_qq, String u_pwd, String u_Email, String u_dis) {// 添加用户 int uid = MstxDao.getMaxNumber("mstx_user"); MstxDao.updateMaxNumber(2);// 将该字段值加1 Connection con = DBUtil.getConnection(); Statement st = null; try { st = con.createStatement(); String sql = "i...
3fb59e21-af45-495a-87b7-d56b5ca59a4c
1
public void addSongToPlaylist(BEPlaylistSong aPlaylist) throws Exception { try { ds.addSongToPlaylist(aPlaylist); } catch (SQLException ex) { throw new Exception("Could not insert the song into the playlist" + aPlaylist.getSongid()); } }
ae8c875f-e2d4-4615-b297-cf9c76255459
6
public Brick(String name, boolean fake) throws Exception { this.name = name; this.fake = fake; if(fake){return;} String pathToExe = "control.py"; if (debug) { System.out.println(name + "(d): start with " + pathToExe); } process = new ProcessBuilder("python", path + "/control.py").start(); reader =...
eaa29beb-333a-46c4-a213-5fa88d7225c1
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (args.length == 1) { if (args[0].equalsIgnoreCase("reload")) { Seasons.instance.reloadConfig(); Seasons.instance.loadConfig(); sender.sendMessag...
390a0f73-5841-49de-9644-45549bb61d2a
8
private void populateDeclaredFields(Class<?> modelClass, HashMap<String, Field> modelFields, ArrayList<Field> idField) { if( null != modelClass) { // Fill from the top of the hierarchy. The duplicated ModelFields that will remain will be the // ones which are more specific in the hierarchy. populateDeclaredF...
a5f417b3-b99c-4a1a-9848-10c0a87e8b98
2
@Override public Graph addLink(Summit<T> start, Summit<T> end) { // TODO Auto-generated method stub if ( ! isSummitExist(start) ) addSummit(start); if ( ! isSummitExist(end) ) addSummit(end); Link<T> Link = new Link<T>(start, end); links.add(Link); return this; }
59934cd3-0462-42be-9d82-294b5b084a55
3
public void deleteElement(String value) { ListElement previous = head; ListElement current = head.next(); if (previous.getValue().equals(value)) { head = head.next(); count--; } else { while (current != tail.next()) { if (current.getVal...
a0cf27d0-c0fa-411b-8a96-7b46718f1e3f
0
public DynamicArray<Vertex> getVertices() { return vertices; }
4392b0ea-46d1-4c48-9b1a-3602ff06f13e
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 fe...
b0a92b5e-376a-4933-ad7a-78770241887a
8
public static boolean isValidName(String name) { if (name == null) return false; if (name.length() < 2) return false; if (!Character.isUpperCase(name.charAt(0))) return false; for (Character ch : name.toCharArray()) { if (!(ch == ' ' || ch == '\'' || ch == '\"' || Character.isLetterOrDigit(ch))) ...
f83effd6-ac4f-48eb-be76-75bc58c13ec1
7
private void adicionarItem() { if(limiteSelecionados < 0 || ((Collection)this.lstSelecionados.getCollection()).size() < limiteSelecionados) { System.out.print("Desselecionados: "); System.out.println(itemsDesselecionados.size()); Object it...
2468e018-bb2c-46ed-9278-0f662d7d4293
2
public void run() { /* You fill this in. */ setSize((COLS + 2) * (TILE_WIDTH + TILE_SPACE), (ROWS + 2) * (TILE_HEIGH + TILE_SPACE)); int startPointX = TILE_WIDTH + TILE_SPACE; int startPointY = TILE_HEIGH + TILE_SPACE; for (int i = 1; i <= ROWS; i++) { int yCoord = startPointY * i; for (int j ...
9cb5aec2-24e9-4582-9171-6a1c62514ada
0
public static byte[] convertUnsignedIntTo24bits(long i) { byte[] b=new byte[3]; b[0]=(byte)(((int)(i>>16))&0xFF); b[1]=(byte)(((int)(i>>8))&0xFF); b[2]=(byte)(((int)(i))&0xFF); return b; }
6b6a5afe-c737-4441-b56a-a43a974669fa
2
private static int inCircleCnt(Point root, List<Point> points){ int cnt=0; for (Point p : points) if(inCircle(root.x,root.y,p.x,p.y)){ cnt++; } System.out.println(root.x+","+root.y+" "+cnt); return cnt; }
685ac4a2-f997-4cba-9faf-458c1982c540
1
public int getHeureEnreg(){ int heure = this.dateEnreg.get(Calendar.HOUR) ; if(this.dateEnreg.get(Calendar.AM_PM) == Calendar.PM){ heure += 12 ; } return heure ; }
2fe07bfc-2777-464a-bafb-bd5fed4eead2
2
@Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_F1) { System.out.println("F1 Key Released! Toggling Debug Grid!"); if(DRAW_DEBUG_GRID == false) { this.showDebugGrid(true); } else { this.showDebugGrid(false); } } }
c062f4d5-f487-42d6-b7ac-9dae84e2d3f2
1
public Collection operands() { return new AbstractCollection() { public int size() { return cfg.preds(block).size(); } public boolean contains(final Object obj) { if (obj == null) { return operands.size() != cfg.preds(block).size(); } return operands.containsValue(obj); } ...
98d89d03-ee48-49b7-bfaa-e6c974653d2f
9
public final static Track parseParams( @SuppressWarnings("hiding") final MidiInstrumentDropTarget instrument, final String[] params) throws Exception { final Integer id; try { id = Integer.valueOf(params[0]); } catch (final Exception e) { return null; } final ParamSet paramSet = new ParamSet(); ...
428d29f5-e6cd-464e-b7e4-8d7c3a1b6251
5
@Override public void layout() { float regionWidth, regionHeight; if (animation != null) { regionWidth = animation.getKeyFrame(0).getRegionWidth(); regionHeight = animation.getKeyFrame(0).getRegionHeight(); } else return; float width = getWidth(); float height = getHeight(); Vector2 size = scali...