method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b3fd66f5-8e19-465e-a140-0117f3731827
2
@WebResult(name = "GetAccountResponse", targetNamespace = "") @RequestWrapper(localName = "GetAccountDetailRequest", targetNamespace = "http://xstore.com/wsdl", className="com.xstore.services.web.model.GetAccountDetailRequest") @WebMethod(operationName = "GetAccountDetail") @ResponseWrapper(localName = "GetAccountDe...
461d64ad-61eb-4756-823d-dca66f9de209
4
public static ArrayList<Achievement> getAchievementsByUserID(int userID, int type) { ArrayList<Achievement> achievements = new ArrayList<Achievement>(); String statement = new String("SELECT * FROM " + DBTable + " WHERE userid = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(stat...
4a7767f0-01dd-45ce-b4a1-a885de1d91ed
4
public Matrix plus(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) C.data[i][j] = new DataNode((char) (A.data[i][j].value() + B.data[i][j].value()))...
32b7e144-4058-4abe-9b9c-57755b7d1b06
4
public void writeToBalance(Kunde kunde){ if(kunde != null){ Double fullPrice = 0.00; String productNames = ""; String pricelist = ""; for (model.Product product : kunde.getProducts()) { fullPrice = fullPrice + product.getPrice(); if(pricelist == ""){ pricelist = Double.toString(product.getPri...
6ef7a6ca-60ee-44f6-9bc8-02d5459013ee
1
public void actionPerformed(ActionEvent e) { if(e.getSource() == beendenButton){ System.out.println("button clicked"); spiel.getAktuellerSpieler().setZugZuende(true); lblNewLabel.setText("Aktueller Spieler: " + spiel.getAktuellerSpieler().toString()); rep...
32040896-6cd9-4db0-9c02-e62e7339563d
0
public void setEmail(String email) { this.email = email; }
cf78bcdc-4613-40a6-8cf2-2326d2f5a20d
5
public DataBuffer getBuffer(CacheFileDescriptor descriptor) throws IOException { //System.out.println("Requesting file " + descriptor); int expectedIndexID = descriptor.index().id() + 1; DataBuffer fileBuffer = new DataBuffer(); int currentBlockID = descriptor.startBlock(); int remaining = descriptor.size...
2d8f22ce-1c77-4b7b-9ace-20347a45de1f
9
private void rotate(){ if(stack.size() <= 1) return; else{ SplayNode n = stack.pop(); while(stack.size()>1){ SplayNode np = stack.pop(); SplayNode gp = stack.pop(); if((n == np.left && np == gp.left) || (n == np.right && np == gp.right)) n = zigzig(n, np, gp); else n = zi...
e9b5db9e-77d3-49ad-b388-a6fd902a2b5a
7
public int modificarOpcion(DTO.Opcion p) { try { if (con.isClosed()) { con = bd.conexion(); } Object ob = null; if (p.getdespuesDeOpcion().getCodigo() != 0) { ob = p.getdespuesDeOpcion().getCodigo(); } Strin...
d8fcac42-77a0-4e50-a3dc-1160da5e2865
7
public void close() { try { if (mResultSet != null && !mResultSet.isClosed()) { mResultSet.close(); } if (mStatement != null && !mStatement.isClosed()) { mStatement.close(); } if (mConnection != null && !mConnection.isClosed()) { mConnection.close(); } } catch (SQLException e) { ...
cc9aeebb-54d4-4eea-95b2-01a042bac6fb
2
private void setAdjacent(Node node1, Node node2) { if (node1 == null || node2 == null) { throw new IllegalArgumentException("Need two non-null Nodes"); } // Create the Adjacent Nodes Set<Node> aN = new HashSet<Node>(); ...
160b3cd4-8df5-4e4c-9afd-b5f4be2a01af
2
@Override public void mousePressed(MouseEvent e) { if (contains(e.getX(), e.getY()) && enabled) { pressed = true; } }
64df4e6a-8460-4548-b40d-4614935e1399
7
public static TOObjectProperty setPropValue(TOObjectProperty prop, Object val, Integer type) { try { prop.setPropType(type); switch (type) { case TOPropertyType.TYPE_STR: { prop.setStrval(String.valueOf(val)); } break; ...
fecb0fc6-8802-4a42-9b0b-52a0b43844bf
6
public void addActive(Component folha) { if (folha.getClass() != Job.class) { if (!folha.getState().equalsIgnoreCase("closed")) { this.addChild(folha); } } else { Job newChild = new Job(folha.getName(),folha.getDescription()); for (Componen...
50770e48-0573-4912-86d6-597da6009587
5
public void calculateMoleculeID(int level, int val, int[] parentMolID){ initMoleculeID(level); if(level>1){ for(int i=0; i<level-1; i++){ setMoleculeID(i, parentMolID[i]); } } if(level!=0){ setMoleculeID(level-1, val); // Set child[0].moleculeID[last]=...
332ae0fd-991d-48bd-95f9-7b037fa44e80
2
public void replaceWith(Node replacement){ if (parent == null) return; if (this == parent.left) parent.setLeftChild(replacement); else parent.setRightChild(replacement); }
e6507649-2355-48a3-afc5-8d4ea8d870d6
4
public static void set(Properties properties, String filePath) { if (! filePath.endsWith(".properties")) { filePath += ".properties"; } try { OutputStream output = new FileOutputStream(filePath); // Open the file we are saving to. properties.store(output, ""); // Save the properties file to the output...
304306ed-358a-4d98-8184-75eb70bf4f06
4
@Override public void process(Document doc) throws Exception { super.process(doc); this.subjects.clear(); if(doc != null) { NodeList paramNodes = Utilities.selectNodes(doc, "/dc:DCTransaction/dc:GetDataBySubjectRq/dc:SubjectIDs/dc:SubjectID", XMLLabels.STANDARD_NAMESPACES); for(int i = 0; i < paramNodes...
d1805cce-20ff-4674-a579-252e56f71b89
1
public void equip(){ isEquipped = true; window.activeLevel.thisLevelsItems.remove(this); createActionMessage(); if(this.itemType == 0){ panel.player.weapons[0] = this; }else{ panel.player.equipment.add(this); } }
07457cc4-772f-43b0-a26c-7b2dded0589e
0
public static String getUsuario() { return usuario; }
25d3fb66-21d3-41e5-af5f-1a071d9195d0
7
public void ThinkDamnYou(players.Base ply) { //TODO: Redesign it to allow the npc to grab if someone is in firing range faster and easier. if (finished) { finished = false; DoneCities = DoneUnits = false; UnitCount = CityCount = 0; if (ply.power>=ply.level2) {ply.UsePower(false);} else if (ply.power>...
4b3e9fbb-f10e-4add-b4b2-6d45cc8ad568
7
public boolean pollInput() { if ((this.discoFlag) || (checkDisconnect(System.currentTimeMillis()))) { System.out.println("client schließt verbindung"); disconnect(); return false; } int counter = 0; try { for (; counter < messagesPerUpdate; ++counter) { ByteBuffer buf = ByteBuffer ...
76c068fe-c500-408a-83fb-38d7e97c3fee
0
public void run() { carPhysics.run(); }
3b1e01ce-81c1-4a3e-8d7a-0f385ea846b5
7
public static Graph readGraph(InputStream is, int vertexNumber) { Graph result = new Graph(vertexNumber); Scanner fileScanner = new Scanner(is); int i = 0; while (fileScanner.hasNextLine() && i < vertexNumber) { String str = fileScanner.nextLine(); Scanner lineScanner = new Scanner(str);//default delimite...
81b3f4a5-ee05-44b3-b0f9-692e8ddc0a64
5
short check_data_content(String new_serial_data) { short ret = check_scg_command(new_serial_data); if (MsgAnalyzerCmnDef.CheckSuccess(ret)) { boolean highlight = false; if (scg_command_status == SCG_COMMAND_STATUS.SCG_COMMAND_COMPLETE) { new_serial_data = scg_command_buf.toString(); highlight = ...
6c74bf67-1a93-4f60-a1b2-7fefd455b20e
6
public void cancelMorphs() { final LinkedList<MapleBuffStatValueHolder> allBuffs = new LinkedList<MapleBuffStatValueHolder>(effects.values()); for (MapleBuffStatValueHolder mbsvh : allBuffs) { switch (mbsvh.effect.getSourceId()) { case 5111005: case 5121003: ...
26f8600f-6d2c-4a42-b33a-af602a85809d
5
private boolean isPlayerKingInCheckFromPieceHorizontallyRight() { for (int j=playerKingPiece.pieceColumn + 1; j<=8; j++){ BoardSquare boardSquare = chessBoard.getBoardSquare(playerKingPiece.pieceLine, j); if (boardSquare.containsBoardPiece()){ if (j==playerKingPiece.pieceColumn+1){ if (boardSquare.cont...
1b277552-d4c7-4055-b36d-18b88a57c75b
2
public void testPropertyCompareToSecond() { TimeOfDay test1 = new TimeOfDay(TEST_TIME1); TimeOfDay test2 = new TimeOfDay(TEST_TIME2); assertEquals(true, test1.secondOfMinute().compareTo(test2) < 0); assertEquals(true, test2.secondOfMinute().compareTo(test1) > 0); assertEquals(tru...
565784fe-7e7e-4ce5-b774-44c264d2dfbc
3
private static double limitM( double m ){ if( m < 0 ){ return -limitM( -m ); } if( m < 0.5 ){ return 0.5; } else if( m > 1.5 ){ return 1.5; } else{ return m; } }
59b78435-9ec5-45bb-ad37-270b7ef635f4
8
@Override public Buildable create(Object name, Object value) { if (name.equals("step")) { Step step = new Step(steps.size() + 1); steps.add(step); return step; } else if (name.equals("rounds")) { rounds = (Integer) value; if (rounds < 1) { ...
9e464988-2dfd-429e-8f75-dea6f3464a74
3
public void EliminaFinal () { if ( VaciaLista()) System.out.println ("No hay elementos"); else { if (PrimerNodo == PrimerNodo.siguiente) PrimerNodo = null; else { NodosProcesos Actual =PrimerNodo; while (Actual.siguiente.siguiente != PrimerNodo) Actual = Actual.siguiente; Actua...
6c7ffc92-d81b-4552-821d-d53106ff9b90
7
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (String line; (line = in.readLine()) != null ; ) { if(line.trim().isEmpty()) sb.append("\n"); else{ int sum = 0; String...
4a89d472-1709-4f24-bfe7-8973951b6320
1
protected void changedServerName(){ for(ModelChangeListener mcl : listeners){ mcl.changedServerName(serv_name); } }
ce997d07-ca4b-4843-bfc1-e3eb772075d1
0
public void setJournal(Journal journal) { this.journal = journal; }
7fa054a5-ead6-4b0e-989c-3690f6c0c085
2
public synchronized void printProcesses() { if (processes.size() == 0) { System.out.println("No processes running."); return; } for (int i = 0; i < processes.size(); i++) { MigratableProcessWrapper cur = processes.get(i).getMPW(); System.out.println(cur.getName()); } }
465bc5ff-a0c5-4862-b2db-e1e21672f7ad
6
public void actionPerformed(ActionEvent evt){ //receives the start button event from the startPanel if (evt.getActionCommand().equals(START_APP_EVENT)) { displayHoustonSearch(); //receives the next button event from the QuestionPanel }else if (evt.getActionCommand().equals(QUE_NEXT_EVENT)){ ((Question) questio...
30e7b79d-ff8d-4127-924b-22526ac629c7
9
public void fetchFiles() { int returnVal = this.chooser.showOpenDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) { File[] directorys = this.chooser.getSelectedFiles(); for(int i = 0; i < directorys.length;i++){ if(directorys[i].isDirectory()){ String album = directorys[i].getName(); Fi...
4260d380-e42d-4b32-841d-dcd53b9c4822
1
private void startRun() { try { Thread.currentThread().getId(); levelLoader = new XMLLevelLoader(); frame = new TopFrame(this); frame.initLWJGL(); RenderEngine.setupOpenGL(); needsResize = true; SoundStore.get().init(); gameMusic = SoundStore.get().getOgg(Res.getResourceAsStream("res/music.ogg...
b4cadfbe-6913-40c4-af2c-ab4da7d49f62
3
void parseJsonImageMap(String json) { String imageSrc = null; try { ImageMap imagemap = getImageMapFromJSON(json); createShapeList(shapeList, imagemap); if (shapeList.size() == 0) statusBar.setText("no imagemap found"); /* if (imagemap.getImagesource_id() > -1) { imageSrc = String.format("%si...
2af61314-212f-4530-b221-7d930980db60
0
public void setLayoutMatchingMode(LayoutMatchingMode mode) { this.layoutMatchingMode = mode; }
ea9d15b9-feaa-4fe3-b01e-a26507128418
1
@Test public void test_config_keys() { final StringBuffer s = new StringBuffer(); for (Iterator i = configKeys(); i.hasNext(); ) { s.append("<" + i.next().toString() + ">"); } Assert.assertEquals(s.toString(), "<b_remote_host><c_latency><b_latency><b_local_port><b_remote_port>"); }
c2d3a26a-3fb4-4fe5-9885-8d4b6e27adc9
7
public Collection<SpriteClip> getSpriteClips(BufferedImage image, BackgroundFilter filter) { int h = image.getHeight(); int w = image.getWidth(); Label[][] labelSheet = new Label[h][w]; for (int row = 0; row < h; row++) { for (int col = 0; col < w; ...
09eb271b-acf3-4592-9c81-7b726458dc62
2
private void initView(Configuration[] configs, final Environment env, boolean blockStep) { this.setLayout(new BorderLayout()); // Set up the main display. SelectionDrawer drawer = new SelectionDrawer(automaton); AutomatonPane display = new AutomatonPane(drawer, true); // Add the listener to the display. ...
97dc4c29-8c5d-4577-88e0-6f88ea2ca939
8
public static void findLongestSubPalindramic(String s) { char[] arr = s.toCharArray(); int begin = -1; int end; int temp_begin; int maxLength = -1; boolean[][] table = new boolean[1000][1000]; for (int i = 0; i < table.length; i++) { table[i][i] = true; } for (int i = 0; i < s.length() - 1; i++) {...
45ff74af-e454-4c95-87a4-892f8ae780f3
9
public HexDumpOutputStream createHexDumpOutputStream() { BasicType hexdumpFormat = this.getGlobalConfiguration().get( Constants.CKEY_HTTPCONFIG_HEXDUMP_FORMAT ); // System.out.println( "hexdumpFormat=" + hexdumpFormat ); int[] columns = null; String str_hexdumpFormat = null; if( hexdumpFormat != null && (str...
b08f3585-b854-40d4-8312-49d5be42e7e9
0
public RandomWords(int count) { this.count = count; }
73ec859d-c0c1-41a7-99e8-5adf2e6c6511
5
public boolean intersect(float i, float j, float k) { return !(i <= x || i >= x + w || j <= y || j >= y + h || k <= z || k >= z + d); }
302ae104-1968-4577-9737-8684ccf4f4e0
6
private final ArrayList<String> edits(String word) { ArrayList<String> result = new ArrayList<String>(); for(int i=0; i < word.length(); ++i) result.add(word.substring(0, i) + word.substring(i+1)); for(int i=0; i < word.length()-1; ++i) result.add(word.substring(0, i) + word.substring(i+1, i+...
5ade77d4-5897-46c3-bdd7-c8c44e5a69dc
5
public void selectLevel(){ Menu myWorld = (Menu) getWorld(); switch(state){ case 0: Greenfoot.setWorld(new Menu()); break; case 1: setImage("ShipCoordinatorInfo.png"); setLocation(500,300); myWorld.re...
ba5d407f-e045-47b6-97ed-94091f07b290
2
public void testGetValue_int() { LocalDateTime test = new LocalDateTime(ISO_UTC); assertEquals(1970, test.getValue(0)); assertEquals(6, test.getValue(1)); assertEquals(9, test.getValue(2)); assertEquals(MILLIS_OF_DAY_UTC, test.getValue(3)); try { test.getValue...
943f9c5d-7188-4a05-bf18-6b4a790a014b
2
public boolean deleteCircle(Circle circle) { if (this.next.data.equals(circle.data)) { if (circle.data.equals(start.data)) { start = next.next; this.next = start; return true; } else { this.next = next.next; return true; } } else { return this.next.deleteCircle(circle); } }
56e86ac3-bd53-4c3b-84d8-8ef427209944
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Province other = (Province) obj; if (!Objects.equals(this.nom, other.nom)) { return false; ...
a4dcd2ae-8455-4357-a781-f420e1f42daa
1
public void addToIpMap(ChannelHandlerContext ctx) { String clientIP = ((InetSocketAddress) ctx.channel().remoteAddress()).getHostString(); synchronized (ipMap){ if (!ipMap.containsKey(clientIP)) {//if IP is new --> put it in map with default count 1 and current time ipMap.put(client...
42c9ca6a-dcf8-4e98-a4d7-264c21ea3f1b
9
public void bubblesort(){ int count = 1; //To pass the first while while (count != 0){ count = 0; for (int i = 0; i < number-1; i++) { Class<? extends Object> c = objectsToSort[i].getClass(); Class[] cArg = new Class[1]; cArg[0] = objectsToSort[i].getClass(); Method lmethod; try { l...
81f37f81-470c-46ab-a74b-8c71bc027d59
9
public StructuredFloat buildByType(boolean isNegative, FloatNumberType doubleType, FloatNumberSpecialValue specialValue) { switch (doubleType) { case Nan: normalizedExp = config.MaxExp + 1; fraction = 1; negative = isNegative; break; case Infinite: { normalizedExp = config.MaxExp + 1; fractio...
1c39529e-2e68-4244-909d-2f4b23464608
0
@Override public void init(List<String> argumentList) { offset = Integer.parseInt(argumentList.get(0)); identifier = argumentList.get(1); }
8f807367-686b-4512-935c-f5bf414932f1
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BloomFilter<E> other = (BloomFilter<E>) obj; if (this.expectedNumberOfFilterElements != other.expectedNum...
31192dda-da45-4e73-8f97-4e66be8d899a
7
public void paintPattern(Graphics2D g, Page parentPage) { if (patternPaint == null) { AffineTransform matrixInv = getInvMatrix(); Rectangle2D bBoxMod = matrix.createTransformedShape(bBox).getBounds2D(); int width = (int) bBoxMod.getWidth(); int height = (int) bBo...
0b3f90c7-21d8-4db6-95cc-6e5892e933f2
1
private void resize(int capacity) { Item[] temp = (Item[]) new Object[capacity]; for (int i = 0; i < next; i++) { temp[i] = a[i]; } this.a = temp; }
af88f7b5-ec27-4ab0-9aaf-3e30722c0c21
0
@Test public void testSchemaCreation() throws SQLException { Star.setup(); }
51fde69b-5e7c-443d-8a93-6f5c76569309
0
public Upgrade getUpgrade(){ return upgrade; }
0d40cdfa-f534-4d3c-a8f6-a338d8d52637
5
public void startAnimation() { if(interval == -1) {return;} if(animation == null) { frameIndex.add(0); animation = new Timer(interval, new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { for(int i=0; i<entity.size(); i++) { if(frameIndex.get(i) < frameTo...
16e8d3cb-4cb2-49bd-9898-2a7a5e3ac0a4
4
@Override public void remove() { if(current == null) // empty iterator return; if(current.getPrev() != null) current.getPrev().setNext(current.getNext()); if(current.getNext() != null) current.getNext().setPrev(current.getPrev()); if(current.getPrev() == null) s.root = current.get...
f8dc3e9f-b7fd-409a-af82-fcdb42f06744
2
public void removeBogusLegs() { Iterator<Leg> it = legs.iterator(); while (it.hasNext()) { Leg leg = it.next(); if (leg.isBogusWalkLeg()) { it.remove(); } } }
aa405827-31bb-460d-b5fa-d188b8647567
9
private boolean salvarConfigsImpressoraCaixa() { System.out.println("Configurando Impressora do Caixa:"); usarImpressoraCaixa = checkboxAtivarImpressoraCaixa.isSelected(); System.out.println("Usar impressora do caixa: " + usarImpressoraCaixa); switch (comboboxModeloCaixa.getSelectedIndex...
a639fe9c-14bd-40f5-af75-d86401baf791
4
private void add_s(Buffer lbuf, LuaString news, int soff, int e) { int l = news.length(); for (int i = 0; i < l; ++i) { byte b = (byte) news.luaByte(i); if (b != L_ESC) { lbuf.append((byte) b); } else { ++i; // skip ESC b = (byte) news.luaByte(i); if (!Character.isDigit((char) b)) ...
5a09c14f-6fe6-4ed4-8df9-61e9a6e18772
7
public String genLargeDB() { String nextLine; URL url; URLConnection urlConn; InputStreamReader inStream; BufferedReader buff; this.largedb = ""; try { for (NEOCP neocp : neocpData) { url = new URL( "http://scul...
72130249-7866-4c37-b1bc-e9d63df0af89
9
public final void setConfigValue(final String section, final String key, final String value) { synchronized (this.configOld) { synchronized (this.configNew) { if (value == null) { if (getConfigValue(section, key, null) != null) { final Map<String, String> map0 = this.configNew .get(sectio...
45ea5025-c62e-4517-9888-1b73fa8ee76a
2
public void updateImage() { //we will update animation when delay counter reaches delay, then reset delay counter delayCounter++; if(delayCounter>delay) { delayCounter=0; frameNumber++;//updates frame to next frame //if surpass 3rd frame, back to frameNumber 0 if (frameNumber>=firstFrame+totalFrame)...
805b89e5-7fdd-4869-9c8d-08ca02cb26f8
8
public void parseString(String inputLine) { System.out.println(inputLine); String tagRegex = "(beat|accel|heartrate|eeg|pressure)=(.*)"; Pattern pattern = Pattern.compile(tagRegex); Matcher matcher = pattern.matcher(inputLine); if (matcher.matches()) { String tag = matcher.group(1), value = matcher.grou...
e5c5309b-0184-45c6-ab27-8c0142d265fc
9
public void printBoard() { System.out.print(" "); for(int c = 0; c < 8; c++) { if(flipped) System.out.print((char)('h'-c) + " "); else System.out.print((char)(c + 'a') + " "); } System.out.println(); System.out.println(" _________________ "); for(int r = 0; r < 8;...
0ea292bc-3494-4a2c-af91-49bb038ab0b7
1
public String map2QcTestSetName(ISuite suite) { return (this.qcTestSetName != null ? this.qcTestSetName : suite.getName()); }
f66cd955-96bf-46e0-a7aa-0c413f3e9b39
2
public static CustomerGroup getByNumber(final String token, final Long number) { JSONArray fetchByNumber = null; try { fetchByNumber = fetchByNumber(token, object, number); } catch (IOException e) { e.printStackTrace(); } List<CustomerGroup> formatOutputs = formatOutputs(fetchByNumber); if (formatOutp...
c75454c8-18a3-41d0-991a-ae82dc681992
9
public static List readWatchableObjects(DataInputStream var0) throws IOException { ArrayList var1 = null; for(byte var2 = var0.readByte(); var2 != 127; var2 = var0.readByte()) { if(var1 == null) { var1 = new ArrayList(); } int var3 = (var2 & 224) >> 5; int v...
ed9d85a6-a099-460d-80ab-438ca1f1a46a
2
public Object unmarshal(InputStream xml) { long start = System.currentTimeMillis(); Unmarshaller unmarshaller = unmarshallerPool.borrow(); try { BufferedInputStream bufXml = new BufferedInputStream(xml); SAXSource saxSource = new SAXSource(createNewXmlReader(), new InputSource(bufXml)); return unmarshall...
d369987b-3265-47dd-95bc-9b259a729838
7
public static ArrayList<Object[][]> floydRoyWarshall(mxAnalysisGraph aGraph) throws StructuralException { Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent()); Double[][] dist = new Double[vertices.length][vertices.length]; Object[][] paths = new Object[vertices.length][vertices.len...
484ad097-4071-44d1-bd6e-9fba302a3d91
1
private void initialSpeciate(List<Organism> organisms) { if (getSpecies().isEmpty()) { /** * In the first generation, since there are no preexisting species, * NEAT begins by creating species 1 and placing the first genome * into that species. */ ...
23eab445-15c7-4a62-af3f-e47eb9fd992d
4
public final A index(final int i) { if (i < 0) throw error("index " + i + " out of range on stream"); else { Stream<A> xs = this; for (int c = 0; c < i; c++) { if (xs.isEmpty()) throw error("index " + i + " out of range on stream"); xs = xs.tail()._1(); } ...
a99d466e-c99a-468f-a361-84e674fbe741
2
public void run() { while (true) { try { disp = mon.getDisplayData(); HW.display(disp.ticket, disp.counter); sleep(10000); } catch (InterruptedException e) { break; } } }
556d43ff-0bcd-4e88-8180-f05a239439e7
4
public boolean existsBooking(Booking booking) { List<Booking> bookings = this.getBookings(); Iterator<Booking> iter = bookings.iterator(); while (iter.hasNext()) { Booking b = iter.next(); if (b.getDate().equals(booking.getDate()) && b.getDiningHall().equals(booking.getDiningHall()) && b.getStuden...
ad7f88d4-2faa-4320-a699-dceab02601be
7
public String toString() { String compoundString = ""; for(int k = 0; k < elements.length; k++) { if(elements[k] instanceof Compound && ((Compound)elements[k]).containsCompound()) compoundString += "[" + elements[k].toString() + "]" + ((subscripts[k] == 1)? "" : "" + subscripts[k]); else if(elements...
660bd2d2-a96e-4155-a457-f4d0c8371dfd
6
public ArrayList<ArrayList<Integer>> levelOrderBottom(TreeNode root) { ArrayList<TreeNode> s = new ArrayList<TreeNode>(); if (root == null) { return null; } s.add(root); int[] cou = new int[Integer.MAX_VALUE]; int cur = 0; int curcount = 0; ...
a7d2cff3-d94d-4c4e-b4be-0f0366cebfc7
0
private void initialize() { GO = GUITreeLoader.reg.getText("goto_dialog_go"); GOTO_LINE_AND_COLUMN = GUITreeLoader.reg.getText("goto_dialog_line_and_column"); CANCEL = GUITreeLoader.reg.getText("cancel"); lineNumberTextField = new JTextField(10); columnNumberTextField = new JTextField(10); countDepthChe...
15537873-7667-47c1-bc7d-f46c4d651636
1
@Override public void updateView() { listModel.removeAllElements(); for (String s : controller.getModel().getSearchFormats()) { listModel.addElement(s); } formatList.setModel(listModel); }
493b763a-ca7e-49aa-9519-2b68098379aa
7
private FileLoaderCor() { IMyProperties mp; FileLoaderAbstract lastOne = null; boolean ok = false; try { mp = MyPropertiesFactory.getInstance().getProp(); String[] classes = mp.getProperty("FileLoaderClasses").split(","); for(int i = (classes.length-1); i > -1; --i) { String curCl = classes[i]....
1779f8e4-4140-4dc1-bca3-c539441bb73d
1
@SuppressWarnings("unchecked") public Relationship usingId(Id id) { if (this.id != null) { throw new IllegalStateException("Id already assigned!"); } this.id = id; return this; }
b2ac9995-b798-40b7-815b-17015c53a56f
2
public String toString() { Object cl = null; if (clref != null) cl = clref.get(); return cl == null ? "<null>" : cl.toString(); }
864baecd-7635-4710-a946-d9017001a880
9
private Type getCommonType(Type t1, Type t2) { if (!compatibleTypes(t1, t2)) { return BasicType.NOTYPE; } if (t1 instanceof ListType) { return t1; } if (t2 instanceof ListType ) { return t2; } if (t1 == BasicType.FLOAT || t2 ...
cd9297d3-567b-4f4d-89f1-bcc3e6c83c7f
3
private void collect(TreeNode root, String prefix, LinkedList<String> q){ if(root == null)return; if(root.value != null)q.add(prefix); for(char c = 0; c < R; c++){ collect(root.next[c], prefix + c, q); } }
9b333bd8-c7e1-4d4b-99e3-33f6619940a1
5
public static String getPrefix(final String name) { try { String s = ""; if (MonsterIRC.getHookManager() != null) { if (MonsterIRC.getHookManager().getChatHook() != null) { if (MonsterIRC.getHookManager().getChatHook().isEnabled()) { ...
b20485e5-3fe1-48f9-aa49-e11d5190a80b
1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Library library = new Library(); request.setAttribute("patronResults", library.getPatronList(0)); } catch (SQLException e) { e.printStackTrace(); } request.getRequestDispa...
632b1eee-7065-440a-a902-80f961177553
5
private void init() { try { setIconImage(new ImageIcon(AboutFrame.class.getResource("icon.png")).getImage()); } catch(NullPointerException e) { controller.displayError(bundle.getString("error"), e.getLocalizedMessage()); } setTitle(App...
7934c599-48e4-4333-98a0-5f7e63b68d7f
0
public int getValue() { return i.get(); }
68d0b91a-8e7a-456b-9a94-c9ad0f3b1972
9
public static void collectDirectSuperClasses(Stella_Class renamed_Class, List parents) { { List directsupertypes = renamed_Class.classDirectSupers; List nondirectparents = List.newList(); { Surrogate supertype = null; Cons iter000 = directsupertypes.theConsList; Cons collect000 = null; ...
93228207-abcf-40a0-9017-5686d16f47a1
9
private void exportFramedSameCatsSimStructVsMoa(String path, int level) throws Exception { SmilesParser smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance()); DrugBank db = new DrugBank("data/tmp/drugbank.ser"); Brain atc = new Brain(); System.out.println("Learning ATC..."); atc.learn("data...
58ea4c17-1b1d-4f53-aa9c-6371f58f53e2
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
856319fd-4b8e-4a35-be3a-a76a33a44155
6
public int convertShape( String shape ) { defaultShape = 0; if( shape.equals( "box" ) ) { defaultShape = 0; } if( shape.equals( "cone" ) ) // 1 1 { defaultShape = 257; } if( shape.equals( "coneToMax" ) ) // 1 2 { defaultShape = 513; } if( shape.equals( "cylinder" ) ) // 1 0 { ...
fd13edb7-24fa-46c4-8fad-578bf80108cb
0
@Test public void itShouldSerializeAPointWithAltitude() throws Exception { Point point = new Point(100, 0, 256); assertEquals("{\"coordinates\":[100.0,0.0,256.0],\"type\":\"Point\"}", mapper.toJson(point)); }
58a9f210-60b2-41e7-994c-90b2004a3924
5
private static void merge(int[] A, int left, int middle, int right) { for (int i = left; i <= right; i++) { temp[i] = A[i]; } int leftEnd = middle - 1; int k = left; while (left <= leftEnd && middle <= right) { if (temp[left] <= temp[middle]) { ...
0215f84a-7833-4780-86fb-103aa5c4ee43
3
private void executeWaitForResultsJob(WaitForResultsJob job) throws IOException, JSchException { updateable.send(new StatusUpdate("VM " + id + " waiting for mid results", id, VMState.EXECUTING, JobType.WAITRESULT)); int expected = job.getExpectedCount(); while(new File("/").listFiles((new FilenameFilter()...