method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b72e7745-a7af-4f61-b0ae-f4d1b25dc564
2
public void advance(long milliseconds) { // Check to make sure we are given a positive amount of time. if (milliseconds < 0) { throw new IllegalArgumentException("Time interval cannot be less than 1."); } else if (milliseconds == 0) { return; } else { /* Critical Region */ synchronized (this)...
45cbb719-3c57-48e7-9755-982fed2f7013
2
public static Transformer newTransformer(String xsltFileName) throws TransformerConfigurationException { File xsltFile = new File(xsltFileName); Templates template = cache.get(xsltFileName); if (template == null) { lock.writeLock().lock(); try { ...
34f24124-83c6-496b-86e0-eafd58fab591
2
@Override public void run(final String... args) { final CommandLine line = parseArguments(args); final String configFile = getConfigFile(line); final SyncConfig config = readConfig(configFile); for (final FolderConfig folderConfig : config.getConfigs()) { if (!folderConfig.isSyncOn()) { System.out.prin...
2d4db090-7595-4e43-8252-3f493b533d38
0
@Override public void gameRenderObjects() { }
0ea3cf19-e163-4e67-9fd8-2c0896656a7a
2
public ResultSet read(String query){ try { ResultSet result = this.statement.executeQuery(query); result.last(); int rows = result.getRow(); if(rows < 1){ return null; } result.beforeFirst(); return result; ...
53d1c6c7-c018-4a70-8964-ac4d7776dca3
6
public static void main(String[] args)throws IOException { File directory = new File("/home/garth/Desktop/stock"); //directory of program files File[] files = directory.listFiles(); List<String> allMatches = new ArrayList<String>(); for(int i=...
16a72edc-7577-4ae1-be52-4e1d779325db
6
* @return Returns true if the cell is a valid drop target for the given * cells. */ public boolean isValidDropTarget(Object cell, Object[] cells) { return cell != null && ((isSplitEnabled() && isSplitTarget(cell, cells)) || (!model .isEdge(cell) && (isSwimlane(cell) || (model .getChildCount(cell...
e57f1e30-1413-4dd4-92c1-4bd481343cf0
4
@Override public void process(Map<String, Object> jsonrpc2Params) throws Exception { if(method.equals(Constants.Method.LOGIN)){ login(jsonrpc2Params); } else if(method.equals(Constants.Method.GET_ACCOUNT)){ getAccount(jsonrpc2Params); } else if(method....
9d2d3732-0e99-4c0b-bdd8-6c9cb02757a2
3
public Font(Library library, Hashtable entries) { super(library, entries); // name of object "Font" name = library.getName(entries, "Name"); // Type of the font, type 0, 1, 2, 3 etc. subtype = library.getName(entries, "Subtype"); // figure out type subTypeForm...
1a50d86f-2728-4df8-b2e6-b415c8c448e5
9
public double[] distributionForInstance(BayesNet bayesNet, Instance instance) throws Exception { Instances instances = bayesNet.m_Instances; int nNumClasses = instances.numClasses(); double[] fProbs = new double[nNumClasses]; for (int iClass = 0; iClass < nNumClasses; iClass++) { ...
f2d4708e-12fc-4f0e-b03d-651379e6b9f6
3
public void saveConfig() { if (config == null || configFile == null) { return; } try { getConfig().save(configFile); } catch (final IOException ex) { plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex); } }
f5218381-1d96-43bd-a42c-eae772a1b77c
4
public Team getTeam(int teamID, Connection con) { Team t = null; String SQLString = "SELECT * " + "FROM TEAMS " + "WHERE teamID = ?"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString); statemen...
0e75e1b4-829f-4405-99a5-67d30242a780
5
public double computeMax(){ double max_revenue = 0; for(int switch2 = 2; switch2 <= no_weeks+1; switch2++){ for(int switch3 =2; switch3 <= no_weeks+1; switch3++){ for(int switch4=2; switch4 <= no_weeks+1; switch4++){ if(switch4>=switch3 && switch3>=switch2){ double thisrev = getSimRevenue(sw...
689abd58-dc2b-440c-8ad8-0174c7a8f204
1
private void initComponentsNorth() { northPanel = new JPanel(); ActionListener myActionListener = new UserGUIActionListener(this, loginUser); searchLabel = new JLabel("Suchkriterium auswählen "); searchLabel.setFont(new Font(textFont, labelStyle, 14)); searchCombo = new JComboBox<String>(); searchCo...
88dc73a9-d11a-4446-9545-721fb0227395
3
public static boolean registerLog(String addr) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { e.printStackTrace(); return false; } Connection c = null; try { c = DriverManager.getConnection( ...
8d6d607f-abc4-4280-8348-71d7d1830dbd
4
public static Promotion addPromotion(Promotion p) { if (p == null) return null; // We check if the promotion doesn't still exist in the Professor List. boolean exist = false; int pos = 0; for (int i = 0; i < FileReadService.pList.size(); i++) { if (FileReadService.pList.get(i).equals(p)) { exist = ...
034f4b84-4f91-4202-8931-4edf3951051c
2
@Override public void contextInitialized(ServletContextEvent sce) { logger.info("Initialize JdbcRealm database"); Connection cnn = null; try { if (dataSource == null) { throw new IllegalStateException("DataSource not injected, verify in web.xml that 'metadata-comp...
cdef775f-603c-44fb-9d20-1606e110748a
1
public void testFormatAppend_PrinterParser_Printer_null() { PeriodPrinter printer = new PeriodFormatterBuilder().appendYears().appendLiteral("-").toPrinter(); PeriodFormatterBuilder bld = new PeriodFormatterBuilder().append(printer, null).appendMonths(); assertNotNull(bld.toPrinter()); a...
c5ea7a39-3794-4720-852a-af9e61ccbda9
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book book = (Book) o; if (id != book.id) return false; if (!author.equals(book.author)) return false; if (!genre.equals(book.genre)) re...
68ce76e8-2a5e-49a6-8aef-129a2785fd5b
4
public String constructOrder(){ StringBuffer order = new StringBuffer(); int forCommands = 0; int numberOfPersonsForCommand = 0; String mealForCommand = null; if(this.isEveryOneOrdered()==0){ for(Command command: this.commands){ if(command.isForCommand()){ forCommands ++; numberOfPersonsForComma...
0c4750b8-dc9d-4bba-839a-4f3b3f74d607
7
public void setImage(String fileName) { boolean old = true; if( image != null && ((isHovered && fileName.equals("hover" + name)) || (!isHovered && fileName.equals(name))) ) return; try { if(old) image = ImageIO.read( new File("Images\\"+ fileName +".png") ); else image = getImageResource(fil...
c56aac3c-6fa9-4667-ab0b-c146148e8451
6
void exportXmlTemplate( XmlWriter xml, String legend ) { if(yVal1 == yVal2 && xVal1 != xVal2) { // hrule xml.startTag("hrule"); xml.writeTag("value", yVal1); xml.writeTag("color", color); xml.writeTag("legend", legend); xml.writeTag("width", lineWidth); xml.closeTag(); // hrule } else if(yVal...
70ab6f9a-b00f-4712-bb56-e8c09c72f748
4
@Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } Course course = (Course) object; if (!classCode.equals(course.getClassCode())) { return false; } if (!section.equals(course.getSection())) { return false; } return...
1f9d398d-8887-4071-9820-6cc17e1c7496
5
public static String removeFormatting(String line) { int length = line.length(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < length; i++) { char ch = line.charAt(i); if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') { ...
fc28ca5d-bdc7-4c77-9a19-5accbb2920f5
3
public static void main(String args[]) { String filename = ""; String pattern = "*"; if(args.length == 2){ filename = args[0]; pattern = args[1]; } else if(args.length == 1){ filename = args[0]; } else { System.out.println("Usage: java -jar " + System.getProperty("sun.java.command") + " zipFile...
f64064f4-3e6f-458f-a547-6e9f34e5bc54
7
public static Set<PDFInfoHolder> getSimplePDFInfoHolders(File pdfs1, File pdfs2, String prefix) { Set<PDFInfoHolder> pdfInfoHolders = new HashSet<PDFInfoHolder>(); // are those valid pathes if(pdfs1 != null && pdfs2 != null && pdfs1.isDirectory() && pdfs2.isDirectory()) { // create a filter to only get p...
5365923e-3a4f-4ec4-8a57-ff6dc132fc60
7
public String tooltip(Coord c, boolean again) { if ((c.x >= 10) && (c.x < 10 + prof.hist.length) && (c.y >= 10) && (c.y < 10 + h)) { int x = c.x - 10; int y = c.y - 10; long t = (h - y) * (mt / h); Profile.Frame f = prof.hist[x]; if (f != null) { ...
95db434b-90c7-4c49-b800-082bb6a6ffc7
7
public void moveRandom() { if(getTimeStamp() == 0) // If clock is reset.. { setTimeStamp(TimeHandler.getTime()); // Set clock setActionTime(random.nextInt(1500) + 500); // Set a random duration (500-2000 ms) to move/stay switch(random.nextInt(4)) // Randomize a direction { ...
e79bd8a7-d375-4496-ad6f-8804e7f12f3e
6
public void focusGained(FocusEvent e) { if (e.getSource() == InchesInput) { InchesInput.setText(" "); } else if (e.getSource() == FeetInput) { FeetInput.setText(" "); } else if (e.getSource() == YardsInput) { YardsInput.setText(" "); } else if (e.getSource() == MillimetersInput) { ...
8032af77-c0c5-4df4-83a8-21a88f05e346
3
static double NetwonRaphson() { if (f(v, 0) == 0) return 0; double xn = 0.5, x = 0; while (true) { x = xn - f(v, xn) / ff(v, xn); if (Math.abs(x - xn) < EPS) return xn; xn = x; } }
5b54d0bd-88de-4830-83b8-b4626d4a08b9
8
public ArrayList<ZoomDataRecord> getZoomData(RPChromosomeRegion selectionRegion, boolean contained) { int chromID, chromStart, chromEnd, validCount; float minVal, maxVal, sumData, sumSquares; int itemHitValue; int recordNumber = 0; ...
da30d6ad-17d0-4b18-b67f-c232a5cce799
6
void addDevice(Device device) { // if device was in list of saved localhost devices, copy saved // preferences to this device for (Device d : model.getDevices()) { if (device.getSerialNumber().equals(d.getSerialNumber())) { device.copyProperties(d); break; } } // if user previously preferred n...
bf9187cb-b494-4bf2-8a4c-0a9d0c043ebf
4
@Override public void render(float interpolation) { Vector2 pos = Interpolator.linearInterpolate(oldPos, this.pos, interpolation); Renderer.drawRect(pos, new Vector2(dim.x,20), isSelected ? windowTopColor : windowMainColor, 1.0f); Renderer.drawRect(pos.add(new Vector2(0,20)), dim, windowMainColor, 1.0f); ...
c8bead16-9a4f-43d5-ada9-eb96524ff1db
2
private void fillInCounterParty() { for(Statement m : movementDataModel.getAllStatements()) { String name; if (newCounterParty == null) { name = null; } else { name = newCounterParty.getName(); } TmpCounterParty tmp = new TmpCounterParty(); tmp.setName(name); tm...
c1e811dd-ccc9-425b-bbaf-0c225e821853
1
public boolean SetPlayerBirthday(String player, Date bdate) { String datestr; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); datestr = sdf.format(bdate); BirthdayRecord birthday = getPlayerRecord(player); String query; if (birthday == null) { query = "INSERT INTO birthdaygift (birthdayDate,...
42ce8ffd-3702-4512-8e7f-72b9c7a6ee8a
3
public boolean havePointInBound( AABB aabb ) { Matrix4f transformation = getTransform().getTransformation(); Vector3f p1 = transformation.transform( point1 ); Vector3f p2 = transformation.transform( point2 ); Vector3f p3 = transformation.transform( point3 ); if ( p1.isInBound( aabb ) || p2.isInBound( aabb )...
bdb47cec-c526-4994-b95e-02995354b9c1
1
public void initLevel(int l) throws SlickException{ if(currentLevel <= 10){ pickables = new ArrayList<Pickable>(); mobs = new ArrayList<Mob>(); level = new Level(l); player = new Player(level.startX, level.startY); respawnCounter = 0; } }
a35520f4-b6fa-4f8e-af64-bf683e353050
4
public static boolean testerPrimalite(long n) { boolean trouve=false; int i=0; long temp=0; while(!trouve && i<NB_TESTS) { temp=(int)((Math.random()*n)); if(temp==0) { temp++; } if(calculSoloStras(temp,n)!=syJacobi(temp,n)) { trouve=true; } i++; } return !trouve; }
e5caa0b2-66a7-457e-9778-368296f667e4
6
public static String getMCTimeString(long var0, long var2) { long var4 = (long)((int)((var0 / 1000L + 6L) % 24L)); int var6 = (int)((double)(var0 % 1000L) / 1000.0D * 60.0D); boolean var7 = var4 < 12L; var4 %= var2; String var8 = ""; if (var2 == 24L) { ...
68c8832e-2718-4b88-abbd-1c68bc1fa9db
6
public void refreshCaches() throws RegistryErrorException { if(isCachingActive()) { if(caches != null && caches.size() > 0) { List tmpCache = (List) caches.clone(); caches = new ArrayList(); for (int x = 0; tmpCache != null && x != tmpCache.size(); x++) { ...
239e2c3c-1485-4926-ab63-f1ac8acd9ecd
5
public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message) throws GranException { SecuredTaskBean task = message.getTask(); String text = message.getDescription(); EggBasket<SecuredUDFValueBean, SecuredTaskBean> refs = AdapterManager.getInstance().getSecuredIndexAda...
5ee570e8-2f22-42b3-be3f-6563dd2f7042
8
public void update(String msg) { if (msg.startsWith("CUL:")) { String[] users = msg.substring(4).split("\\|"); userListPanel.removeAll(); userListPanel.add(userLabel); JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); separator.setMaximumSize(new Dimension(32767, 2)); sepa...
87565570-0733-4ae4-ad5e-ffc6ba294812
3
private void setPiece(int row, int col, Piece p) { if (p == EMP && get(col, row) != EMP) { Piece n = get(col, row); numPiecesRow[row - 1] -= 1; numPiecesCol[col - 1] -= 1; numPiecesDownDiag[row + col - 2] -= 1; numPiecesUpDiag[col - row + 7] -= 1; ...
d4d832f4-00d3-4fab-bd0d-e4dd51cc4300
6
void print(Node t, int n, boolean p) { if (p) { t.print(n, true); } else { if (n > 0) { for (int i = 0; i < n; i++) System.out.print(" "); } System.out.print("("); if ...
c05e7561-42a5-448b-89f5-fe62614bc427
9
public static Map<String, String> uriToMap(String uri) { if (StringUtils.isBlank(uri)) { return null; } try { // LinkedHashMap is our impl choice, because order of params is awesome sometimes Map<String, String> params = new LinkedHashMap<String, String>(); ...
22132022-0d05-436c-9061-aae98f27d073
0
public String getCp() { return cp; }
1f4be285-a3d5-4ecf-8bd3-8cacd6b5fffc
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...
df7a5d36-ee64-4bed-a2ac-f17a0e6e7786
7
private void jTable8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable8MouseClicked System.out.println("Count:" + evt.getClickCount()); if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) { System.out.println("Right Click"); int r = jTable8.rowAtPoint(e...
3c4db87f-e0f0-4a48-b8ad-5d8319666838
8
@Override public void setValueAt(Object valor, int rowIndex, int columnIndex) { // Pega o contato referente a linha especificada. Contato contato = linhas.get(rowIndex); switch (columnIndex) { case ID: contato.setId((String) valor); case NOME: contato.setNome((String) valor); ...
04bd1fae-c214-4d5e-b3a0-3bbe9aaeda0d
2
protected void processPreBlocks(List<String> preBlocks) { if(generateStatistics) { for(String block : preBlocks) { statistics.setPreservedSize(statistics.getPreservedSize() + block.length()); } } }
d0aef274-1496-42d9-94af-f82fce1dc4f0
6
@Override public void onEnable() { instance = this; c = new Config(this); if (Config.defaultConfig) { getLogger().warning("RoyalIRC is disabled until the config is edited."); setEnabled(false); return; } version = getDescription().getVersio...
e5457f33-940c-4887-9f46-e284421a64c2
1
public long getLong(Object key) { Number n = get(key); if (n == null) { return (long) 0; } return n.longValue(); }
95b1da57-b2ff-4015-be26-61d234698a8d
0
public void IncrementLeftByBus() { this.leftByBus += 1; }
a24f8d8f-dc33-4469-8e0c-b7352320fd51
1
public static void main(String[] args) { try { Window fenetre = new Window(); } catch (Exception e) { e.printStackTrace(); } }
0624451a-4d83-446d-8357-aa59caa3196d
5
private ArrayList addCustomer(HttpServletRequest request) { ArrayList al = new ArrayList(); String passport = request.getParameter("passport"); String name = request.getParameter("name"); String password = request.getParameter("password"); String postal = request.getParameter("po...
0439f6ab-7c7f-45ce-9309-df4779878c40
5
@Override public void run() { logger.info("Starting announce thread for " + torrent.getName() + " to " + torrent.getAnnounceUrl() + "..."); // Set an initial announce interval to 5 seconds. This will be updated // in real-time by the tracker's responses to our announce requests. this.interval = 5; t...
ba669dca-04da-42ef-9e03-03397df88495
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; this.mode = this.top == 0 ? 'd' : this.stack[this.top...
5266186c-faee-4439-a929-93f88d7d05d4
9
@Override public void unInvoke() { if((pit!=null) &&(canBeUninvoked()) &&(pit.size()>1)) { final Room R1=pit.get(0); final Room R2=pit.get(pit.size()-1); while(R1.numInhabitants()>0) { final MOB M=R1.fetchInhabitant(0); if(M!=null) { M.killMeDead(false); R1.delInhabitant(M); ...
b4614eeb-0886-47f1-9ed7-7f874a128162
5
public static int getY(RSInterface parent, RSInterface child) { if (parent == null || parent.children == null || child == null) { return -1; } for (int index = 0; index < parent.children.size(); index++) { if (parent.children.get(index) == child.id) { return parent.childY.get(index); } } return -...
c97169cd-8619-40b4-a0c5-f96760d48c75
1
public void setStackDepth(int depth) { stackDepth = depth; if (stackDepth > maxStack) maxStack = stackDepth; }
3fab7113-bff3-4c68-8a0c-2a291793a35b
7
public void dragDropEnd(DragSourceDropEvent dsde) { Canvas canvas = (Canvas) dsde.getDragSourceContext().getComponent(); CanvasModel canvasModel = canvas.getCanvasModel(); Rectangle bounds = null; try { bounds = (Rectangle) dsde.getDragSourceContext().getTransferable().getTransferData(widgetFlavor);...
22688f2c-8138-4647-874f-d55f789e8365
2
@Test public void testPlayerUsesTeleport() throws InvalidActionException { factory.addFlagOfPlayerToPlayerOneInventory(); ElementInfo flag = game.getActivePlayerInfo().getInventoryItems().get(0); game.moveAction(Direction.RIGHTUP); boolean containsFlag = false; for (Position pos : grid.getPositionsArou...
53af492b-de38-4a97-a019-6827c2a37f88
8
@SuppressWarnings("unchecked") private void writeData(Collection<T> data) { try { Set<Col> columnsToAdd = Sets.newTreeSet(); for (T t : data) { if (anyColumn != null) { appendAnyColumns(t, columnsToAdd); } } addColumns(columnsToAdd, true); for (T t : data) {...
5e352271-8a53-4928-88f5-9ee6b23614d0
1
public void testStoreRawData() { DataSet ds; final String cols = "column1,column2,column3\r\nVAL1,VAL2,VAL3"; Parser p = DefaultParserFactory.getInstance().newDelimitedParser(new StringReader(cols), ',', FPConstants.NO_QUALIFIER); p.setStoreRawDataToDataSet(true); ds = p.parse();...
40cec72d-bb3c-4122-93a5-681559c6a6b8
4
public static boolean borarr(String cod){ try { //creación de un fichero auxiliar donde iremos colocando todos los productos excepto el que queramos borrar BufferedWriter escribe=Files.newBufferedWriter(path2, java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.CREATE); //abr...
86656032-e0c5-40db-aa9e-c1af6f38424a
8
protected double distance(Instance first, Instance second) { double distance = 0; int firstI, secondI; for (int p1 = 0, p2 = 0; p1 < first.numValues() || p2 < second.numValues();) { if (p1 >= first.numValues()) { firstI = m_instances.numAttributes(); } else { firstI = first.index(p1); ...
1469d472-78c9-4677-90f9-9e9f3e02e50e
9
private void switchActvLabelTxtFieldVisibility(final Component comp, final boolean saveLabelChange){ final boolean visible = true; if( comp instanceof JLabel ){ JLabel jl = (JLabel)comp; jl.setVisible( !visible ); final JTextField jtf = jTextFieldsArr[ Integer.parse...
863d4d48-ced8-4000-bcdc-89807f4131a5
1
public APacket copy() { log.finer("Copying a Packet!"); APacket p = null; try { p = this.getClass().newInstance(); DataOut dataOut = DataOut.newInstance(); writeToData(dataOut); byte[] b = dataOut.getBytes(); p.readFromData(DataIn.newInstance(b)); } catch(InstantiationException | IllegalAccessExc...
62db64fb-dba6-4154-ab48-4a4fc4dd68f6
5
public Display() { System.out.println("Display::Display();"); setForeground(UIManager.getColor("Button.highlight")); setBackground(Color.WHITE); setTitle("Modelowanie Wielkoskalowe - Rozrost ziaren"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 1100, 700); JMenuBar menuBar = ...
f7d28b0e-0378-4043-95f8-d4f906feecbb
3
public void perform(Action a) { try { //System.out.println(this + " " + a + " go"); a.go(); } catch (NoSuchMethodException impossible) { } catch (InvocationTargetException impossible) { } catch (IllegalAccessException impossible) { } }
f87c8757-bc0f-4ff2-abc4-3906e1214da2
0
public void setjButtonSuiv(JButton jButtonSuiv) { this.jButtonSuiv = jButtonSuiv; }
3615a876-d1af-46fe-9058-e3d19afc831a
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...
a9ca624c-32dc-4f4d-8f6a-37380bbbb3bd
5
public int getWidth(String text) { if (text == null) { return 0; } int width = 0; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '@' && i + 4 < text.length() && text.charAt(i + 4) == '@') { i += 4; } else { width += charWidths[text.charAt(i)]; } } return width; }
aa1c9935-0cbd-4400-b295-e02299b7077d
2
@Override public void display(Boolean showCorrect) { System.out.println(prompt); if (answer!=null && showCorrect){ System.out.println("The answer is: " + answer); } }
55791db1-52a1-4b94-906e-f4a4d29c5db2
2
public void testWithers() { DateTime test = new DateTime(1970, 6, 9, 10, 20, 30, 40, GJ_DEFAULT); check(test.withYear(2000), 2000, 6, 9, 10, 20, 30, 40); check(test.withMonthOfYear(2), 1970, 2, 9, 10, 20, 30, 40); check(test.withDayOfMonth(2), 1970, 6, 2, 10, 20, 30, 40); check(t...
e9ad05bb-2387-4d31-9960-139c34d805f1
9
public void AIMove(){ if (this._winGFX != null) return; int numAI = this.currPlayers - 1; try { Thread.sleep(1500); } catch (Exception e){ //do nothing } for (int i = 0; i < numAI; i++){ this.diceRoll(); //wait for 1500 try { Thread...
12e50a83-dc5c-4336-8fa1-8b573dca710c
0
private int method1() { return value; }
90e91ef2-fd09-4d03-bf0a-e2c3ea186a76
6
public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = ...
d1338e81-0748-4f4a-a3ef-6a7df356d166
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Contacts)) { return false; } Contacts other = (Contacts) obj; if (emails == null) { if (other.emails != null) { return false; } } else if (!emails...
84ce4467-a306-42eb-9582-4ff5cd6d800a
4
public void loadGame(File file) { FileInputStream fileStream; ObjectInputStream objectStream; try { fileStream = new FileInputStream(file); objectStream = new ObjectInputStream(fileStream); // read IGame object from file game = (IGame) objectStream.readObject(); objectStream.close(); } catch (...
7a4a8e71-7b06-47e8-9ff5-35ce623b030c
9
public boolean containsTx(){ if(len<2) return false; for (int i = 0; i < len-1; i++) { if(array[i]==84 && array[i+1]==58) return true; } //look for T0: if(len<3) return false; for (int i = 0; i < len-1; i++) { if(array[i]==84 && array[i+1]==48 && array[i+2]==58) return true; } return false; //ASCI...
bfdc015f-8815-4fbe-a0b3-0c1f31738801
7
private void packFields() { // Method Instances DiagramFieldPanel fieldPanel; boolean changed; changed = false; if(isPack()) { for(int i = 0; i < fieldsPanel.getComponentCount(); i++) { fieldPanel = (DiagramFieldPanel) fieldsPanel....
b3535717-69e4-4ed9-b024-cc88b42fba38
2
@Override public boolean update(Object item) { conn = SQLconnect.getConnection(); String sql = "UPDATE `worlds` SET `name`='%s', `time_headnode`='%s' WHERE `id`='%s'"; if (item instanceof Worldnode) { Worldnode newitem = (Worldnode) item; try { sql = String.format(sql, newitem.getName(), newitem...
717d958c-ff2a-49db-8661-ee169bfb76d8
0
public void push(Object e) { ensureCapacity(); elements[size++] = e; }
61a74600-6215-4f51-9be7-391e6a2000ca
4
public <T extends Component> List<T> getAllComponentsOnEntity(UUID entity) { synchronized (componentStores) { LinkedList<T> components = new LinkedList<>(); for (HashMap<UUID, ? extends Component> store : componentStores.values()) { if (store == null) { ...
e3121441-16f6-4d63-88d4-523e7d3c2f90
8
private void initQuery(QueryType queryType) { switch (queryType) { case DELETE: if (this.deleteQuery == null) { this.deleteQuery = new DeleteQuery(_db); } break; case SELECT: if (this.selectQuery == null) { this.selectQuery = new SelectQuery(_db); } break; case UP...
e0455879-c65c-470a-a8f1-4ad8d21c5e44
3
private boolean userInputChecker(String input) { boolean matchesInput = false; if(userInputList.size() > 0) { for(int loopCount = 0; loopCount < userInputList.size(); loopCount++) { if(input.equalsIgnoreCase(userInputList.get(loopCount))) { matchesInput = true; userInputList.remove(loo...
7c3bc3c3-523a-4d95-bc24-b0065aff2fb9
5
private final synchronized void method2846(boolean bool, boolean bool_34_, MidiLoader class348_sub2, boolean bool_35_) { do { try { method2840(bool_34_, (byte) -127); anInt8889++; aClass204_8944.initialize(((MidiLoader) class348_sub2) .aByteArray6564); aLong8959 = 0L; aBoo...
32e0bd98-c721-411c-aad8-03f402ec1379
2
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html");//设置服务器响应的内容格式 // response.setCharacterEncoding("gb2312");//设置服务器响应的字符编码格式。 DButil ab = new DButil(); try { PrintWriter pw = response.getWriter(); // S...
48726cff-6e2c-4924-b2d7-c20857840f5a
8
public static void main(String[] args) { String action = args[0]; Properties props = new Properties(); try { props.load(new FileInputStream(new File("migrator.properties"))); } catch (FileNotFoundException e) { throw new RuntimeException( "No migrator.properties file found. Make sure it's in the s...
d674c876-b3cf-4cf5-8f1e-ef2fa0eaee2c
6
@EventHandler public void EndermanFastDigging(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEndermanConfig().getDouble("Enderm...
0d12ce21-2d00-4de1-a4b3-91a23b381db6
5
@Override public <T> T processLine2D(int x0, int y0, int x1, int y1, PointHandler2D<T> handler) { int x = x0; int y = y0; T result = handler.handlePoint(x, y); if (result != null) return result; final int dx = x1 - x0; final int dy = y1 - y0; final int sign...
075521ae-b3c8-4b45-bc53-c4e0ac2fbbbe
7
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...
66e0bd0a-549c-4359-b787-3834b5483e06
3
public void evaluate() { List<Thread> threads = new ArrayList<>(); Input input = parser.getData(Input.class, "example1.xml"); Masterdata masterData = parser.getData(Masterdata.class, "metadata.xml"); Flight flight = input.getFlight(); Aircraft aircraft = new Finder().inList(masterData.getAircrafts().getAirc...
bfb0a150-e4f2-41fd-b077-66fd4b1bef6a
7
public static void habilitaCampos(Container container) { for (Component component : container.getComponents()) { if (component instanceof JTextComponent) habilitaTextField((JTextComponent) component); else if (component instanceof JComboBox) habilitaCompon...
70dc93a4-1f96-4b0f-acb5-023b278a6f61
2
public void run() { try { while (true) { String message = producer.getMessage(); System.out.println("Got message: " + message); Thread.sleep(1500); } } catch (InterruptedException e) { } }
96cb5607-6e1d-406c-a16d-174ee768a2dd
7
public static void main(String[] args) throws Throwable { Scanner in = new Scanner( new InputStreamReader( System.in ) ); StringBuilder sb = new StringBuilder(); sb.append("SHIPPING ROUTES OUTPUT\n\n"); int tc = Integer.parseInt(in.nextLine()); for (int t = 0; t < tc; t++) { sb.append("DATA SET "+(t+1)+"\...
61296c3c-384b-4a30-9e7a-d93ec39914bb
9
public static List<Class<?>> getTypes(final String str) throws IOException { List<Class<?>> result = new ArrayList<>(); byte[] s = str.trim().getBytes(); if (!(s[0] == '(' && s[str.length() - 1] == ')')) { throw new IOException("wrong type (no brackets)"); } for (int ...
248ddbb0-3e90-45e5-92c6-55a44706f919
9
@Override public String toString() { String returnVal = ""; switch(suit) { case CLUBS: returnVal = "C"; break; case SPADES: returnVal = "S"; break; case DIAMONDS: returnVal = "D"; ...
195e4905-f8bc-478a-b14b-a7a45be87653
3
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { List<Category> categories = null; Hashtable<Long, Boolean> canDelete = null; HttpSession session = req.getSession(true); User user = (User)session.getAttribute("currentSessionUser"); // Checks if th...