method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1363fd0d-93a0-4b87-a9f3-02d64a80a883
6
private static void merge(Comparable[] a, Comparable[] tmp, int left, int right, int rightEnd) { int leftEnd = right - 1; int k = left; int num = rightEnd - left + 1; while (left <= leftEnd && right <= rightEnd) { if (a[left].compareTo(a[right]) <= 0) { tmp[k...
8a1b674d-4b25-4a0c-9e25-feb612066d82
9
public void determineValues(Instances inst) { int i; AttributeStats stats; int attIdx; int min; int max; int count; m_AttIndex.setUpper(inst.numAttributes() - 1); attIdx = m_AttIndex.getIndex(); // init names m_Values = new HashSet...
03f5d61f-21a1-4dda-94a9-4d8e8b7b9b4d
1
public void update(Observable o, Object arg) { String name, str, text, textFinal, requete; //textFinal = "<html><body style=\"font-family:Geneva,Arial,Helvetica,sans-serif;font-size:11px;\">"; textFinal = "<html><body><PRE>"; text = mldCommand.getRequests() ; for (StringTokenizer st = new StringTokeni...
ad1e9f1a-d26f-45b0-b4b8-940cb0bc2bb6
0
Destination(String whereTo) { label = whereTo; }
c339f59e-1f0f-4aae-98c6-bfb7021ae4dc
2
protected GameEngine() { // See my notes on REQUIRED_JRE about this if (Float.parseFloat(System.getProperty("java.version").substring(0, 3)) < REQUIRED_JRE) { logger.error(Helpers.concat("Invalid Java Version! ", REQUIRED_JRE, " or greater only")); Runtime.getRuntime().exit(0xDEADBEEF); } // Set up our '...
af55fe57-cea7-4308-a7bb-070caeadf65d
8
public Tile(final int x, final int y) { type = TileType.getTileType(x, y); switch (type) { case DOUBLE_LETTER: letterBonus = 2; wordBonus = 1; break; case DOUBLE_WORD: letterBonus = 1; wordBonus = 2; ...
3d7b9fe9-9d16-4b68-b58b-815ccf9a3536
9
static 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_scanpo...
49dd4086-34fa-4737-83b7-df628da13ad7
6
private void create(Color background) { final JPanel top = new JPanel(); top.setLayout(new BorderLayout()); top.setBorder(BorderFactory.createEmptyBorder(5, 5, 15, 5)); top.setBackground(background); this.add(top, BorderLayout.NORTH); JLabel info = new JLabel(); ...
490ee910-6463-4ff0-b2bf-9ee863bff8b8
8
@Override public double convertTo(int type) { switch (type) { case UnitConstants.FEET_SECOND: return getValue() * 1.466667; case UnitConstants.FEET_MINUTE: return getValue() * 88; case UnitConstants.MILES_MINUTE: return getV...
86a88424-4f43-41d7-9304-f297a678cac6
6
public void setupIndividualHex(PaintImage hexToSetup, int type) { String logo = ""; switch (type) { case -1: logo = "desertHexLogo"; break; case 0: logo = "woodHexLogo"; break; case 1: logo = "sheepHexLogo"; break; case 2: logo = "brickHexLogo"; break; case 3: logo = "rockHexLogo...
56fa3e92-fdb7-4953-86ec-6a99f77d72f8
8
public static String requestPOST(String url, String ... parameters) { try { StringBuffer paramsBuffer = new StringBuffer(); for (int i = 0; i < parameters.length; i+=2) { if (paramsBuffer.length() > 0) paramsBuffer.append("&"); paramsBuffer.append(URLEncoder.encode(parameters[i+0], "UTF-8")); p...
0b5486d5-d61e-4d39-b1d8-8844154ae045
3
private void Adicionar_Button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Adicionar_Button1ActionPerformed // TODO add your handling code here: try { if (NomeJogador_TextField2.getText().equals("")) { JOptionPane.showMessageDialog(null, "Indique o nome ...
9724b5cb-12a2-463a-98c5-6a197b34bb89
9
void setExampleWidgetState () { super.setExampleWidgetState (); boolean isSeparator = (label1.getStyle () & SWT.SEPARATOR) != 0; wrapButton.setSelection (!isSeparator && (label1.getStyle () & SWT.WRAP) != 0); leftButton.setSelection (!isSeparator && (label1.getStyle () & SWT.LEFT) != 0); centerButton.setSelec...
78d38b24-1972-41e2-a98b-6bde58b28ed8
5
private static final void method738(AbstractToolkit var_ha) { if (aClass64_1227 == null) { Model class124 = new Model(580, 1104, 1); class124.method1105(109, (byte) 0, (byte) 0, (short) 0, (short) 1024, (byte) 0, (short) 0, (short) 32767, (short) 1024, (short) 1024); class124.method1101(128, 0, ...
73141a6d-83d8-47df-a192-cd5c73195e5f
2
public void addWay(int pos, long wayId){ if (ways.size()>pos && !ways.get(pos).contains(wayId)) ways.get(pos).add(wayId); }
f51b9382-b8ec-4a75-9e73-7660472c8335
5
private void scrapeResult(String siteText) { try { Document doc = Jsoup.parse(siteText); Element detailsLink = doc.select("a:containsOwn(Details)").get(0); setId(Utility.idFromUrl(detailsLink.attr("href"))); setName(doc.select("h1").text()); setThumbUr...
9d1e6700-6b6f-454b-8e11-e43ede430df6
0
private void foo() { // it is a comment /* * block comment */ System.out.print("hello"); }
07061da3-53c3-4c75-8f37-dcfef448db9a
8
public void toggleKey(int keyCode, boolean isPressed) { if (keyCode == KeyEvent.VK_W || keyCode == KeyEvent.VK_UP) { up.toggle(isPressed); } if (keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_DOWN) { down.toggle(isPressed); } if (keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_LEFT) { l...
d8e9777e-a673-48fa-adbe-bef886520685
1
public static void resume() { Settings.setSkipFirstStartDialog(true); Settings.saveProperties(Constants.SETTINGS_PATH); model = new Model(); Error err = model.initialize(); if (err == null) { showQuickChooser(); } else { handleUnhandableProblem(e...
b87e4af3-6030-4a40-89d8-030ee552d3f6
5
public List<Method> expandIfOpsParams() { boolean optParam = false; for (Param param : this.params) { if (param.isOptional()) { optParam = true; break; } } if (optParam) { List<Method> expandedMethods = new ArrayList<Method>(); for (Param param : this.params) {...
d580f01d-22b2-4991-a542-6b4d05be15fe
4
public void haeKerrattavat(String tunniste, String osaamistaso){ kasittelija.luoLukija(); String rivi = kasittelija.lueTiedostoRiviKerrallaan(); while (!rivi.equals("TIEDOSTON LOPPU")){ if (rivi.contains(osaamistaso)){ if (!tunnisteet.contains(tunniste) || rivi.contai...
4fc4e77f-26de-417f-a3ec-170e040caadf
6
public static void writeANOVAs(File outFile, GroupedChannels data, List<String> groupNames, List<Integer> conditions, int numChunks, int precision) { // open file for writing with a nice print stream object: PrintWriter ostream = makePWriter(outFile); // OKAY VAR NAME? // get all condition-group sequences: ...
74ad7ff7-86c9-40f2-a08d-e95716ddd131
0
public VBooks() { }
931cea11-b871-4e08-b4d5-f7539c6bc862
7
public synchronized void doCharacterPhysics( WalkingCharacter c ) { if( c.walkReadyTime > currentTime ) return; boolean movedX = false, movedY = false; boolean blockedX = false; if( c.walkingX != 0 ) { movedX = attemptMove( c, c.walkingX, 0, 0 ); blockedX = !movedX; } if( c.walkingY != 0 )...
5804346a-9a1e-48a7-916b-5404ed3a7bb4
5
public boolean isCellEditable(EventObject event) { boolean returnValue = false; if (event instanceof MouseEvent) { MouseEvent mouseEvent = (MouseEvent) event; TreePath path = tree.getPathForLocation(mouseEvent.getX(), mouseEvent.getY()); if (path != null) { Object node = path...
e308b1da-f35f-44d5-9ede-5838f9a57093
5
public void asignarRespuestas(String respuesta, int numeroRespuesta){ switch(numeroRespuesta){ case 0: _jtf1.setText(respuesta); break; case 1: _jtf2.setText(respuesta); break; case 2: _jtf3.setText(respuesta); break; ...
e4fc8b4e-f068-4867-b4a3-04557fd47eef
8
public void comprovaMort() { int tir = (int)(Math.random()*2); switch (tir) { case 0: for (int i=0; i < exerc1.size(); i++) { for (int a=0; a < exerc2.size(); a++) { if (exerc1.get(i).ComprovaMort(exerc2.get(a))) { pantalla.remove(exerc2.get(a).getImatge()); exerc2.remove(a); ...
63af18b2-0eee-4db2-a3da-2385097599cf
9
public static void main(String args[]) { String[] new_args = null; String chromosome = ""; boolean train = false; if (args.length > 0) { for (int i = 0; i < args.length; i+=2) { if(args[i].contentEquals("-chromosome")) { chromosome = args[i...
3460a948-729a-4c88-97d1-8145db7f49cf
2
public final LogoParser.varref_return varref() throws RecognitionException { LogoParser.varref_return retval = new LogoParser.varref_return(); retval.start = input.LT(1); Object root_0 = null; Token COLON59=null; Token ID60=null; Object COLON59_tree=null; Obje...
7eed4b77-1bf5-49ae-aa9b-80fa4ef9e66e
5
boolean checkData (CTableItem item, boolean redraw) { if (item.cached) return true; if ((getStyle () & SWT.VIRTUAL) != 0) { item.cached = true; Event event = new Event (); event.item = item; event.index = indexOf (item); notifyListeners (SWT.SetData, event); if (isDisposed () || item.isDisposed ()) return...
82602598-44c4-4584-b76e-3e6be51b6d24
9
public void promote(Player player, String group, PROMOTIONTYPE type) { PlayerPromoteEvent event = new PlayerPromoteEvent(player, group, type, activePermissions); Bukkit.getPluginManager().callEvent(event); if(event.isCanceled()) { sUtil.log("PlayerPromotionEvent has been canceled"); return; } Console...
899da6f7-71f7-4e47-aabe-0c16840ac56a
3
private static void initRoots() { String roots = System.getProperty("fconn.listenroots"); if(roots == null){ System.err.println("Please specify the file system roots in VM variable fconn.listenroots. Example -Dfconn.listenroots=C:\\;D:\\"); roots= File.separatorChar == '\\' ? "c:" : "/"; } StringToke...
983fb395-01d2-4e94-a225-4bf37e2d0442
8
@Override public void keyRelease(int key) { // TODO Auto-generated method stub if (key == CharData.A&&this.rot == -1) this.rot = 0; if (key == CharData.D&&this.rot == 1) this.rot = 0; if(key == CharData.W&&ship.thrustX == 100) ship.thrustX = 0; if(key == CharData.S&&ship.thrustX == -100) ship.thrustX =...
0ee70040-9ed5-4515-840a-cfd55bb09095
7
private void test3() throws UtilityException, SocketException, UnknownHostException, IOException, MessageAttributeParsingException, MessageAttributeException, MessageHeaderParsingException { int timeSinceFirstTransmission = 0; int timeout = timeoutInitValue; while (true) { try { // Test 3 including respons...
08de8828-b35e-4303-b1d8-ffd9fa1f2a50
9
public void changeElements( ObjectSet set, SystemObject[] addElements, SystemObject[] removeElements ) throws RequestException, ConfigurationException, ConfigurationChangeException { int requestIndex; // Der erwartete Antworttyp. Bei der Änderung einer dynamischen Menge wird eine andere antwort verschickt als ...
a14c63c7-41aa-4d69-b63e-d276c5ef11a1
5
public int GetGroundItemID(int ItemID, int itemX, int itemY) { for (int i = 0; i < 9999; i++) { if (server.itemHandler.globalItemID[i] > -1) { if (server.itemHandler.globalItemID[i] == ItemID && server.itemHandler.globalItemX[i] == itemX && server.itemHandler.globalItemY[i] == itemY) { return i; } ...
c5a990ee-5d08-495e-b38a-01db7070d64e
0
public BibleContentTest() { }
5f1eebee-617d-418d-b8c5-1ee232205a29
6
public static void main(String[] args) { int students = 0; int mark = 0; int distinctions = 0; int passes = 0; int fails = 0; int invalids = 0; Scanner sc = new Scanner(System.in); do { System.out.print("Input a mark: "); m...
00da7ac1-ed5c-4118-bd4b-51d99c25f9a7
9
public TAFPSClient(String server, boolean undecorated) { super("TAFPS"); try { robot = new Robot(); } catch (AWTException e) { e.printStackTrace(); } this.host = server; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setUndecorated(undecorated); if (isUndecorated()) { setBackground(new Color(0...
99c0168c-397b-4159-9652-a625eab8b981
2
public int checkExpectedResults(String sql) throws SQLException { Statement stmt = null; ResultSet rs = null; try { if (connection == null) { connection = getConnection(); } stmt = connection.createStatement(); log.info("Running: " + sql); long startTime = System.currentTi...
be734fd9-8345-46aa-9d44-96351d303f21
9
@Override public void calculate(List<Connections> connections, ValuesProvider valuesProvider, Layer targetLayer) { if (connections.size() > 0) { List<Connections> notBias = new ArrayList<>(); Connections bias = null; for (Connections c : connections) { // bias layer scenarios if (Util.isBias(c....
49816b6a-3be3-4396-bcd6-4b0a59152af8
8
public void draw(Graphics2D g, Color color) { drawHandle(g); if (ndFrom == null || ndTo == null || ndTo.getFrom() == null) { drawLine(g, from.getXY(), from.getDirectP()); drawLine(g, to.getDirectP(), to.getXY()); drawLine(g, from.getDirectP(), to.getDirectP()); return; } drawLine(g, from.getXY(), fr...
7bb7c3f6-dfff-4b01-a459-03406acb7574
8
public void testFormat_weekyearOfEra_twoDigit() { DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC); DateTimeFormatter f = DateTimeFormat.forPattern("xx").withLocale(Locale.UK); assertEquals(dt.toString(), "04", f.print(dt)); dt = new DateTime(-123, 6, 9, 10, 20, 30, 4...
389476d7-e6a0-4a58-9b50-cfcbd94156f7
4
/* */ @EventHandler /* */ public void onCommandPreprocess(PlayerCommandPreprocessEvent event) /* */ { /* 441 */ if (Main.getAPI().isSpectating(event.getPlayer())) /* */ { /* 443 */ if (this.plugin.disable_commands) /* */ { /* 445 */ if ((!event.getMessage().startsWi...
697d687d-c326-4757-9b7a-5cc454cb9617
0
public AlgoCryptType getSymmetricAlgo() { return symmAlgo; }
53dc22b3-c1b6-4237-8924-10a7d3b9a616
3
private void parse_authName( String line, String keyword, String[] split, int lineNumber, boolean strictMode ) throws ParseException { // Line has the format: // "AuthName" <Name> if( split.length != 2 ) { throw new ParseException( "Invalid '"+keyword+"' declaration at line " + lineNumbe...
bc9ab38c-7a17-4a9b-82a6-bac81b908825
3
public void copyToArray(int[] destination, int startIndex, int length) { if (startIndex < 0 || (startIndex + length) > size || (length) > destination.length) throw new IndexOutOfBoundsException(); long startAddress = address + startIndex * SIZE_OF_INT; $.copyMemory(null, startAddress, destination, SIZE_OF_INT,...
417ab108-e533-419c-9548-9a3bf778a42e
2
public void add(Card card) { if (card.isAce()) { int currentScore = score; if (currentScore + ACE_HIGH > BLACKJACK) { card.setValue(ACE_LOW); } } score += card.getValue(); cards.add(card); }
eef72330-033c-40fe-b88e-31df62d1dafd
3
public static final void exampleAsynchronousQueries() { System.out.println("Starting Cyc asynchronous query examples."); try { ELMt inferencePSC = access.makeELMt("InferencePSC"); CycFormulaSentence query = CycLParserUtil.parseCycLSentence("(isa ?X Dog)", true, access); final InferenceWorker w...
7e603623-e7d7-4173-ab18-c17e977695e0
9
public GuideUserAction predict(DependencyStructure gold, ParserConfiguration config) throws MaltChainedException { CovingtonConfig covingtonConfig = (CovingtonConfig)config; DependencyNode leftTarget = covingtonConfig.getLeftTarget(); int leftTargetIndex = leftTarget.getIndex(); int rightTargetIndex = covington...
13b6f5ae-019e-45d2-b8eb-8c14c80c21d5
5
@Override public void updateState() { int currentTime = Controller.getInstance().getTime(); int cost = 0; /* This washing machine will only start washing between 2 pm and 5 pm * and will take 2 hours to finish. */ if (this.state == State.ON) this.remainingTime -= Controller.getInstance().getInterva...
5a9e9e6f-d7f8-4c09-b9e5-8185c600d6c2
4
@Override public long[] getBinnedDistribution(long min, long max, int numBins) { Set<T> data = freqTable.keySet(); long[] result = new long[numBins]; long delta = max - min; double binSize = (double) delta / numBins; for (T d : data) { int bin = (int) ((d.doubleValue() - min) / binSize); if (bin < 0)...
5b9c7505-7d49-4532-aee5-5adf57644c98
3
public final LogoParser.repeat_return repeat() throws RecognitionException { LogoParser.repeat_return retval = new LogoParser.repeat_return(); retval.start = input.LT(1); Object root_0 = null; Token REPEAT24=null; LogoParser.expression_return expression25 =null; LogoP...
d8f75202-85b9-4662-8409-b7b6ad8d6de8
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Copy)) { return false; } Copy other = (Copy) obj; if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { ...
d48f5c47-d5e5-46bc-9efc-3ecdc2baa1be
0
public MySqlDatabaseHelper() { }
50a502f8-c5dc-415e-85b9-76cb30783d3f
3
@Override public void paint( Graphics2D g ) { if( selection != null && selection.isSelected() ){ Path2D path = connection.getOpenConnectionPath(); if( stroke != null ){ g.setStroke( stroke ); } g.setColor( color ); g.draw( path ); } }
4e04f043-b958-4eee-8608-54f74c490a2f
5
private static int runToInputHiOrLoLimit(int joypadInputAdd, int limit) { int initialSteps = curGb.stepCount; int lastVframe; int add = runToAddressLimit(0, 0, limit, joypadInputAdd); while (true) { if (add == 0 || curGb.stepCount - initialSteps > limit) return 0; lastVframe = curGb...
03771fb1-9b65-4006-a878-129289040832
5
protected Element createTransitionElement(Document document, Transition transition) { Element te = super.createTransitionElement(document, transition); TMTransition t = (TMTransition) transition; TuringMachine tm = (TuringMachine) t.getFromState().getAutomaton(); // Add the characterizing strings for this tr...
5088a341-15da-4783-802a-50fd78de7615
9
public JFreeChart MakeChart() { DefaultCategoryDataset lineDataset = new DefaultCategoryDataset(); Object[] column1Data = super.getDataset().GetColumnData( super.getAttribute1()); Object[] column2Data = super.getDataset().GetColumnData( super.getAttribute2()); String column2Header = super.getData...
91c698a1-e296-4519-9ed2-6fd353bff444
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); for (int i = 0; i < n; i++) { String[] in = br.readLine().split(" "); int x = Integer.parseInt(in[0]); int y = Integer.parseInt(in[1...
d95a53e3-0563-472f-b0ca-a680bd6bbb3f
5
public void mousePressed(MouseEvent e) { int row = e.getY() / 20 + 1; int col = e.getX() / 20 + 1; int tt = row * (y + 2) + col; if (row > x || col > y || (map[tt] & VISIT) != 0) { // 超出邊界或已經翻過就不必處理 return; } if (e.isMetaDown()) { // 按右鍵, 作個標記就好了 map[tt] ^= MARK; } else if ((map[tt] & BOMB) != 0) { ...
72af9752-0221-4a9f-a8dd-9f691ce41c58
4
@Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(getClass().getSimpleName()); buffer.append('['); if (mRow % 2 == 1 || mColumn % 2 == 1) { buffer.append('g'); } buffer.append(formatRowColumn(mRow / 2, mColumn / 2, false)); if (mRowSpan > 1 || mColumnSpan >...
d34cea10-20eb-4bcb-a8fb-dcb4a6bfa0d3
8
public void paintComponent(Graphics g) { g.drawImage(bg, 0, 0, null); Font title = new Font("Courier", Font.BOLD, 30); Font defaultFont = new Font("Courier", Font.PLAIN, 11); Font bold = new Font("Courier", Font.BOLD, 12); g.setColor(Color.WHITE); g.fillRect(20, 70, 450, 400); g.fillRect(500, 70, 250...
6721a6c6-d7ac-4efb-be67-b045958ed702
6
public static boolean systemNeedsTranslationP(String systemname, Keyword language) { { Object old$Currentsystemdefinition$000 = Stella.$CURRENTSYSTEMDEFINITION$.get(); Object old$Currentsystemdefinitionsubdirectory$000 = Stella.$CURRENTSYSTEMDEFINITIONSUBDIRECTORY$.get(); try { Native.setSpecia...
c0a1069c-af76-4627-890e-beaaccbed22c
6
public void keyPressed(KeyEvent e) { int keycode = e.getKeyCode(); System.out.println("key pressed: "); switch(keycode) { case KeyEvent.VK_UP: System.out.println("up"); Sounds.move.play(); ShipShopHullsMenu.moveSelectionOvalUp(); break; case KeyEvent.VK_DOWN: System.out.println("down")...
2e3db233-7a38-45d4-9115-5071647abebd
7
protected void refresh() { // New dataRows dataRows = new ArrayList(mainU.getRowCount()); for (int i=0; i<mainU.getRowCount(); ++i) dataRows.add(newDataRow()); // Map the rows in mainU HashMap<HKey, int[]> mainMap = new HashMap();; for (int row=0; row<mainU.getRowCount(); ++row) { HKey hkey = new HKey(keyCols...
a0a1a10d-9713-4b25-b02b-02a41f377e21
2
@Override public void setCourseName(String courseName) { if(courseName == null || courseName.length() == 0) { JOptionPane.showMessageDialog(null, "Error: courseName cannot be null of empty string"); System.exit(0); } this.courseName = courseName; ...
d3d2c2db-87ea-4983-baea-b04d7c9f23c7
7
private List<Row> extractRows(Report report, ResultSet rs) throws SQLException { ResultSetMetaData metaData = rs.getMetaData(); int numColumns = metaData.getColumnCount(); List<Row> rows = new ArrayList<Row>(); while (rs.next()) { Object obj[] = new Object[numCol...
c5d1b06e-862b-4997-859a-2dbbbb5b49ca
1
private boolean jj_3_18() { if (jj_3R_36()) return true; return false; }
775de1ac-4e6e-4978-ad92-4f6a6045f67b
1
public long read8bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); long b4 = read(); long b5 = read(); long b6 = read(); long b7 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56); ...
da319c85-5cbd-4e7a-b7f4-56128e482200
8
private static int compareInts(long[] first, long[] second) { int i; if (second.length > first.length) { for (i = second.length - 1; i >= first.length; i--) { if (second[i] != 0) { return -1; } } } else { for (i = first.length - 1; i >= second.length; i--) { if (first[i] != 0) { r...
0951436d-103f-482c-b5f7-0aa355da2d9b
2
private ListNode sort(ListNode head){ if(head == null || head.next == null){ return head; } ListNode mid = findMid(head); ListNode right = mid.next; mid.next = null; ListNode left = head; left = sort(left); right = sort(right); ...
259ceabf-416e-4085-bbc7-8cf03d030e49
7
@Override public double timeToReach(Node startNode, Node endNode, Message msg) { // TODO Auto-generated method stub double dist = startNode.getPosition().distanceTo(endNode.getPosition()); /* Link rate | time arrive mSec | dist * ---------------------------------------------------- * 11 | 2542 | 399 ...
b04f7fe0-f3cd-4d58-a3e8-8042da9ead1e
9
private void changeFoodItem() { this.dispenser = null; this.item = null; boolean check = false; outer:for (int i = 0; i < this.currentMachine.getDispensers().size(); i++) { if (!this.currentMachine.getDispensers().get(i).getDispenserContents().isEmpty()) { check = true; break outer; } } if ...
ca9db6f4-6200-405c-ada5-4cacae95b8b0
2
private LineMetrics lm() { if(lm == null) { Font f; if((f = (Font)attrs.get(TextAttribute.FONT)) != null) { } else { f = new Font(attrs); } lm = f.getLineMetrics("", rs.frc); } return(lm); }
96fbee34-0acf-45b4-9a82-33a7c03c4a10
5
public CourseListFrame(CourseModel model, Settings settings) { super("Courses", model); model.addListener(this); Dimension dim = new Dimension(400, 200); this.setMinimumSize(dim); this.setSize(dim); final CourseTableModel tableModel = new CourseTableModel(); table = new JTable(tableModel); table.setAu...
e0d78704-a62c-4216-9150-9b989b5843ce
1
public boolean fileMove(ObjectInputStream input, ObjectOutputStream output) throws IOException { ArrayList<String> listeChemins = new ArrayList<String>(); try { Object object = input.readObject(); listeChemins = (ArrayList<String>) object; ...
f1eeed6c-7a43-406d-8f4d-248af2cdaab5
3
private void updateDeleteIssueButtonState() { boolean disable = true; if (deleteIssue != null && table != null) { final boolean nothingSelected = table.getSelectionModel().getSelectedItems().isEmpty(); disable = nothingSelected; } if (deleteIssue != null) { ...
18c903f1-e178-4eab-9d7e-05f7b75c7efa
2
@RequestMapping("selecionaProduto") public ModelAndView selecionaProduto(Destaque destaque) { ModelAndView mav = new ModelAndView("loginAdmin"); if (adminController.isLogado()) { Produto produto = produtoDao.findById(destaque.getProduto()); try { Destaque destaqueCadastrado = destaqueDAO.findDestaqu...
eba64b43-ae10-4c35-a3dc-cc1cb9039e94
5
private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: a.AgregarProceso(txtNombre.getText(), Integer.parseInt(txtRafaga.getText())); if (a.getSizeArray() < 15) { for (int i = 0;...
c631204b-fa62-46d2-8095-8c7c06c665b3
9
public static void runEffect(JPanel panel, String mode, String speed, int time) { int x = (int) panel.getLocation().getX(); int y = (int) panel.getLocation().getY(); int period = 150; if (speed.equals("fast")) { period = 50; } else if (speed.equals("moderate")) { period = 150; } else if (speed.equal...
d0deb01c-6230-4e61-a325-beab486c0e9f
2
@Override public void onBlockFromTo(BlockFromToEvent event) { if (event.isCancelled()) { return; } PlanArea area = BuildingPlanner.plugin.areaManager.getAffectedArea(event.getBlock()); if (area == null) { return; } event.setCancelled(true); }
707b8f8d-d4ad-45fe-bf3e-f05927cfa670
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(msg.source()==invoker) return true; if(msg.source()!=affected) return true; if((!msg.sourceMajor(CMMsg.MASK_ALWAYS)) &&((msg.targetMinor()==CMMsg.TYP_STAND)||(msg....
e2cc6519-bccc-42e0-9692-0559f75e9684
7
private void LanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LanceActionPerformed // double tab = Tabela.getSelectedColumn(); // System.out.println(tab); String n = Tabela.getValueAt(Tabela.getSelectedRow(), 0).toString(); System.out.println(n); if (Uaux !...
62bd3742-c443-46bb-9436-14fe57b3c732
1
public JPanel paneStrategy(){ JPanel paneStrategy = new JPanel(); paneStrategy.setLayout(new GridBagLayout()); gbc.gridx = gbc.gridy = 0; paneStrategy.add(new JLabel("plant number"), gbc); gbc.gridy++; paneStrategy.add(new JLabel("damage over time rate"), gbc); gbc.gridy++; paneStrategy.add(new JL...
64884ad8-a361-4a0c-ac5e-8f98d18d4a51
5
public Rectangular hsplit(Rectangular other) { if (this.intersects(other)) { Rectangular a = new Rectangular(this); Rectangular b = new Rectangular(this); if (a.x2 > other.x1 - 1) a.x2 = other.x1 - 1; if (b.x1 < other.x2 + 1) b.x1 = other.x2 + 1; ...
dd4d05c0-7a43-4f2b-952e-a200e760126e
5
static String db(final HashMap preexists) { if (preexists == null) { return ("\n null?\n"); } final StringBuffer sb = new StringBuffer("\n"); final Iterator vars = preexists.keySet().iterator(); while (vars.hasNext()) { final LocalVariable var = (LocalVariable) vars.next(); final Set set = (Set) pr...
0a871cd8-492c-4f51-9211-ba22f5c9a62b
9
public void doAction() { if ((urls != null) && (saveLocation != null)) { for (int i = 0; i < urls.length; i++) { URL url = urls[i]; if (progressMonitor != null) { if (progressMonitor.isCanceled()) { break; ...
c2beb7f3-4936-430e-9a75-d48eed3c7847
9
@Override public void paint(Graphics g) { super.paint(g); Graphics2D g2D = (Graphics2D) g; textDrawer.drawPortalDescription(g2D, null == contextualString ? "" : contextualString); textDrawer.drawQuestion(g2D, null == questionString ? "" : questionString); textDrawer.drawExpo...
3d472f89-2fbb-4779-8c72-f07e15bb01a6
2
private void isLessThanDate(Date param, Object value) { if (value instanceof Date) { if (!param.after((Date) value)) { throw new IllegalStateException("Given Date does not lie after the supplied date."); } } else { throw new IllegalArgumentException(); } }
58b7fe00-749e-4c35-bb8f-b27a6e4e7371
0
protected Color getNodeColor(TreeNode node) { return Color.yellow; }
a6f2d78f-3668-40c0-ba72-6e000ef0b719
5
private void processEvent(Event event) { switch (event.getType()) { case NEW_PROCESS: createProcess(); break; case SWITCH_PROCESS: switchProcess(); break; case END_PROCESS: endProcess(); break; case IO_REQUEST: processIoRequest(); break; case END_IO: endIoOperation()...
caa222d3-0663-45e5-aaec-5a7acfe1f682
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...
29b398ab-90e8-40fe-9b9d-62d46b3581bd
6
final void method664(int i) { anInt5483++; if (aClass290_5520 != null) aClass290_5520.method2195(false); if (aClass290_5460 != null) aClass290_5460.method2195(false); if (aClass290_5482 != null) aClass290_5482.method2195(false); if (i != -23755) aBoolean5477 = false; if (aClass290_5424 != null...
1481b022-eeab-44aa-b2ab-da055a71529f
9
public /*static*/ boolean canLandOn(int pointNum, int playerColor) { if (pointNum == ILLEGAL_MOVE) { return false; } // hmmm, if (onBar(playerColor)) and this isn't about a point leaving the bar then false ?? */ if (! legitEndLoc(pointNum, playerColor)) { /* checks legitPlaye...
5c1ba349-0ce6-40fb-86ff-b13083db3c44
7
protected void inAttribValue(final char c) { switch(c) { case ' ': case '\t': case '\r': case '\n': assignAttrib(bufDex); changedTagState(State.BEFOREATTRIB); return; case '<': assignAttrib(bufDex); piece.innerStart = bufDex; abandonTagState(State.BEFORETAG); return; case '>': assignA...
6f82a23a-d249-4e45-9d2f-786e21b41196
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BookType other = (BookType) obj; if (maxReservation != other.maxReservation) return false; if (overdueFee != other.overdueFee) return fal...
8ed3e2db-0375-4c7e-9311-47cca8fd21bc
8
@Override public String toString() { String str = ""; if (_name != null) { str = _name; } if (_personId != null) { str += " " + _personId; } if (_person != null) { str += " " + _person; } if (_date != null) { str += " " + _date; } if (_response != null) { str += " " + _response; } ...
ba36294c-29a0-48e1-937d-a3ba54ddccb2
7
final public void ClickOrKey(final WaitForAction wait) throws ParseException { Cells cells; Expression e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CLICK: jj_consume_token(CLICK); ClickEvent event1 = new ClickEvent(p.getVariable("$lastClick"), p.getVariable("$lastCli...
1e49a1fe-4c43-4d9e-991d-abd587361d73
7
public void updateScriptFile(File f, Vector<String> actions) { BufferedWriter writer = null; Iterator it = actions.iterator(); try { if (f.canRead() && !it.equals(null)) { writer = new BufferedWriter(new PrintWriter(new FileWriter(f))); while (it.hasNext()) { writer.write(it.next().toString()); ...