method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7fce69bb-c750-4c83-837a-027b9cfe5158
2
public static String getSmiley(String msg) { for (Entry<String, Character> entry : index.entrySet()) { if (!msg.contains(entry.getKey())) continue; msg = msg.replace(entry.getKey(), Character.toString(entry.getValue())); } return msg; }
244446f1-091e-4b0f-8888-412a0a477d3e
6
private static void readRandomAccessFile(Path path){ SeekableByteChannel sbc=null; try { sbc = Files.newByteChannel(path, java.nio.file.StandardOpenOption.READ); ByteBuffer byteBuffer= ByteBuffer.allocate(92); int posicion =0; int stock; ...
2d2eb039-c4eb-45f4-a68d-9e329e7e7db3
2
private void run() { list = new ArrayList<Integer>(); sorted = new ArrayList<Integer>(); for (int i = 0; i < 15; i++) { sorted.add(i); list.add(i); } bogosort(list); int i = 0; while(!isSorted(list)) { bogosort(list); i++; } System.out.println(i); }
fc008bf3-3000-4002-8f53-da1631002e1f
7
public Vector<MOB> getLawMen(Area legalObject, Room room, LegalBehavior B) { if(room==null) return empty; if(room.numInhabitants()==0) return empty; if(B==null) return empty; final Vector<MOB> V=new Vector<MOB>(); for(int m=0;m<room.numInhabitants();m++) { final MOB M=room.fetchInhabitant(m); ...
767415b9-540a-4880-81f2-61c54c64bfd8
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Matrix other = (Matrix) obj; if (cols != other.cols) return false; if (rows != other.rows) return false; for(int i = 0; i < rows; i+...
35fd9095-1c77-4853-baa9-5323a90abba7
9
public static void serializeWeights(NNetwork network, File file) { try { JsonWriter writer = new JsonWriter(new FileWriter(file)); writer.setIndent(" "); writer.beginArray(); LayerIterator iter = new LayerIterator(network); List<? extends Neuron> curLayer = null; List<? extends Neuron> nextLayer = ...
e41a87ed-8fd3-4746-a003-d30e06fc10f3
8
private String buildDriversText() { String ret = "=========Drivers' Summary========\n"; ret += "Haulage Capacity:\n"; ret += " - Used/Available: = " + totalWeight + " / " + power; ret += "\n"; ret += "\n"; ret += "Train Composition:\n"; RollingStock r = theTrain.firstCarriage(); if (r != null) { ret ...
6a081a2a-cbc0-446a-9b0a-4fb1af8b04dc
6
public void generateResources(int resourceModifier){ //Resource Modifier will be the level of the player's factory. resourceModifier += Math.round(Math.random()*3); //Range time! int artifactRange = Math.round(p_Artifact*resourceMultiplier); int blueprintRange = artifactRange + Math.round(p_Blueprints*reso...
f11c1415-a1b4-49b8-9538-011bcee201d9
4
private int[][] pasaArregloAMatrizRight(int[] c0, int[] c1, int[] c2, int[] c3) { int[][] res = new int[4][4]; int m = 0; int k1 = 3; while (m < 4) { res[0][k1] = c0[m]; k1--; m++; } int n = 0; int k2 = 3; while (n < 4) { res[1][k2] = c1[n]; k2--; n++; } int o = 0; int k3 = 3; ...
ddbbf604-91db-488f-948d-3b973870317c
8
public static void main(String[] args) throws Exception { String input = null; try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); input = br.readLine(); } catch (IOException ignored) { } if (input == null) return; Stri...
51ec5506-eff0-4c5f-b086-bc0533d658c9
2
private void stackLineByLine (int[] src, double[][] dst, int frameNo, int width, int height) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { // dst[][] is a (width * height) by gopSize matrix, // with line by line of src pics stacked as columns o...
f566809a-9103-436c-bf11-a1ada953fbd1
5
<T> T[] tokens(Class<T> componentType) { T[] r = (T[]) Array.newInstance(componentType, tokens); Constructor<T> ctor; try { ctor = componentType.getConstructor(String.class); } catch (NoSuchMethodException e) { throw new RuntimeException("Cannot create an array of type [" + componentType + "] from a...
2e4720e0-fee0-4d23-ab5d-c842e0912245
1
public int compareTo(ErrorIdentity o) { int sc = jarrev.compareTo(o.jarrev); if(sc != 0) return(sc); return(thcmp(t, o.t)); }
602028d2-7713-43d2-9eb4-e16518dd4b81
5
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String user = request.getRemoteUser(); int p=0; try { p=loggedInUser.getAccess(user); } catch (SQLException e1) { response.getWriter().println("<p> Exception</p>")...
153cd00c-38ad-4232-a606-5ec73ab76fc6
9
public void computeShortestPaths() { // Make graph gPrime, which is the same as g but with an extra // vertex and 0-weight edges from the extra vertex to all // other vertices. In the text, the extra vertex s is v_0, // but here we'll make it the next available index. The // Vertex objects in g will be share...
af76fe61-7e88-416a-b769-c8a3bcbc6c81
8
@Override public List<AdminCol> getColKeyList(String tblNm) { log.debug("get column key list for table = " + tblNm); Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList<AdminCol> list = new ArrayList<AdminCol>(); StringBuilder sql = new StringBuilder(); sql.appen...
cdfafbbc-de11-4d13-97e8-72ad6bb69ebc
5
@Override public boolean equals(Object o) { if (o == null) return false; if (o == this) return true; if (!(o instanceof OpponentEntry)) return false; OpponentEntry that = (OpponentEntry) o; if (this.context.equals(that.context) && this.action.equals(that.action)) { return true; // equals } ...
07aba290-8aab-42af-8b6b-79cd617a6b27
6
public void update(){ player.update(); player.checkAttack(enemies); player.checkCoins(coins); finish.update(); finish.checkGrab(player); bg.setPosition(tileMap.getx(), tileMap.gety()); tileMap.setPosition( GamePanel.WIDTH / 2 - player.getx(), GamePanel.HEIGHT / 2 - player.gety()); ...
704540aa-6957-47a5-b5c0-9ebfd6cc6609
8
public double[] distributionForInstance(Instance instance) throws Exception { if (!m_isLeaf) { // value of split attribute is missing if (instance.isMissing(m_Attribute)) { double[] returnedDist = new double[m_ClassProbs.length]; for (int i = 0; i < m_Successors.length; i++) { double[] help = ...
329f0408-18d7-4163-a635-4e6776562023
3
public PriorityQueue<SearchResult> search(List<String> words, List<Integer> weights) { PriorityQueue<SearchResult> res = new PriorityQueue<>(docs.size(), Collections.reverseOrder()); Vector searchV = new Vector(dic.getWordCount()); // init vector for (int i = 0; i < words.size(); i++) { String w = words.get...
ea4e5dc8-154e-4890-ab8b-f5a9d4c99590
0
@Override public double access(Balance balance) { return balance.getBalance(); }
931ffd12-44d6-4c97-a091-2a1911f9d76a
6
public static boolean decrementTimer(String player) { GetLanguage modText = McJobs.getPlugin().getLanguage(); PlayerCache checkPlayer = getPlayerCache(player); boolean removePlayer = false; Iterator<Map.Entry<String, Integer>> it = checkPlayer._rejoinJobs.entrySet().iterator(); ...
84d2c64f-6e75-4476-8a60-5731a37ccd51
8
public static void writeAlignments(Graph[] g, OrderedList<Alignment> rankAlign, String pathOutput) { if(pathOutput!=null) { File f=new File(pathOutput); if(!f.exists()) f.mkdir(); } //System.out.println("\nBEST_ALIGNMENTS:"); NodeOrdList<Alignment> aux=rankAlign.getMax(); int cont=1; int i=0, j...
8386aff7-38b3-41d5-84e9-7bced9981e05
4
public static Method[] setterMethodDrilldown(Method[] getterMethods) throws NoSuchMethodException { Method[] setters = new Method[getterMethods.length]; for (int i = 0; i < setters.length; i++) { Method getter = getterMethods[i]; Class<?> parent = getter.getDeclaringC...
d30bb978-4903-4a40-8c67-7a7571ba3488
2
public FractalValue get(String id) throws FractalUnboundException { FractalValue result = frame.get(id); if (result == null) if (parent == null) throw new FractalUnboundException("Unbound variable " + id); else return parent.get(id); else return result; }
837575e6-a80e-4765-b454-66a1f913f99f
4
public static void tagger(String devDataFile, String countFile, String trainDataFile) throws IOException { HashMap<String, TreeMap<Double, String>> emissionParams = eParamsCalculator(countFile); HashMap<String, Integer> wordToCount = rareCounter("ner_0.counts", trainDataFile); FileReader in = new FileRea...
b29458a7-6deb-4176-bf54-56f2089a4e4b
0
public String getTrigger() { return trigger; }
c1f747b0-d0c4-40bb-a84d-3c6e2590320e
0
public String toString() { return diaDaSemana() + ", " + dia + " de " + nomeMes[mes] + " de " + ano; }
ea7fe2d1-b679-4880-98b9-de0d74a7b184
0
public int getId() { return id; }
eeca0c0d-2bf3-4fed-a9b0-90e476ff33ba
3
public BigDecimal harmonicMean_as_BigDecimal() { BigDecimal mean = BigDecimal.ZERO; switch (type) { case 1: case 12: BigDecimal[] bd = this.getArray_as_BigDecimal(); mean = Stat.harmonicMean(bd); bd = null; break; case 14: throw new IllegalArgumentException("Complex cannot be converted to BigD...
024e5e26-332b-4128-a5ba-2ba38dafdcd6
7
@Test public void testSetPosition() { Paddle p = new Paddle(250,90); //inbounds x and lower y try{ p.setPosition(190,90); assertArrayEquals(new int[]{190,90},p.getPosition()); } catch(IllegalArgumentException e){ fail(); } //inbounds x and upper y try{ p.setPosition(250,500); asser...
32cebfc1-436d-4056-a843-dc777faccdb0
3
public static void main(String[] args) { String context = " "; if (args.length > 0) { for (String s : args) { context += s + " "; } } else { context = SimpleNGramGenerator.DefaultContext; } NgramServiceFactory factory = NgramServiceFactory.newInstance(SimpleNGramGenerator.Key); Generati...
b2ba88da-af41-40a5-9410-0b42a4117cdc
3
public void logUserOut() { if(ChatClient.serverThread!=null && !ChatClient.serverThread.isInterrupted()){ ChatClient.serverThread.interrupt(); try { System.out.println("Stopping ClientServerCommunicator..."); ChatClient.serverThread.join(); } catch...
0a4f29ad-8061-4018-8daf-c28a8d120f0e
7
private void rotateRight( final Node node ) { final Node left = node.mLeft; if( left == null ) { return; } node.mLeft = left.mRight; left.mRight = node; if( node.mLeft != null ) { node.mLeft.mParent = node; } if( node == mRoot ) ...
d25b1f81-5e42-40c1-b834-37e715c2c895
6
public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception { HashMap<String, HashMap<String, Integer>> map = new HashMap<String, HashMap<String,Integer>>(); BufferedReader reader = filePath.toLowerCase().endsWith("gz") ? new BufferedReader(new InputStreamReader( ...
1c8f05df-ec2b-44b0-b9ff-ac94c8028371
1
public boolean createFactoryClass(SootClass cl){ String classname = cl.getName(); String fact = classname+"Factory"; Chain<SootClass> classes = Scene.v().getClasses(); if(!classCreationAllowed(classes, fact)){ return false; } SootClass c = new SootClass(fact, Modifier.PUBLIC); c.setSuperclass(Scene...
f3d36243-af3b-41a1-80ac-82fdd38eec10
5
@Override public final Label setText(String text) { if (text != null && !getText().equals(text)) { if (GenericLabel.getStringWidth(text, scale) >= width) { if (text.contains("\n")) { String[] lines = text.split("\n"); String result = ""; ...
28e88315-a45f-456b-9499-1f85e0424988
4
public int getMinimumDifference_as_int(){ int diff = 0; if(this.type==6 || this.type==7){ ArrayMaths am = this.sort(); int[] sorted = am.getArray_as_int(); diff = sorted[1] - sorted[0]; int minDiff = diff; for(int i=1; i<this.length-1; i++){ ...
79946c55-5db2-4941-a9bd-29ded6554ed2
3
public void setBody (Body body) { this.body = body; if (badguy != null && !badguyDead) { if (badguy.getBody().getUserData() == null) { createNewBadguyBody(); } } else{ badguy = null; } }
fc5aa99e-a493-4a31-991a-8de1cb7c245d
5
private final void method792(byte i) throws IOException { anInt1320 = 0; anInt1306++; if (i != -46) method785(111); if (aLong1315 != aLong1324) { fileOnDisk.method1661(-18968, aLong1324); aLong1315 = aLong1324; } aLong1319 = aLong1324; while ((aByteArray1311.length ^ 0xffffffff) < (anInt13...
d2474b1d-ad94-4adc-9103-32afb65f00ac
7
private void updateEnemies(Set<Map.Entry<Byte, byte[]>> actionSet) { for (Map.Entry<Byte, byte[]> entry : actionSet) { byte key = entry.getKey(); byte id = (byte) (key & 0x0F); MessageType option = MessageType.values()[key >> 4 & 0x0F]; if (!scoreboard.scores.con...
18ff7460-2bbd-4709-9764-148b0b194576
1
public String getData() { if (data == null) { data = ""; } return data; }
81ecf9ad-de7f-4fb6-a511-11b67867cbff
9
public void createIndexTREC(BufferedReader in) { String docid, line = null; int bytes = 0; try { while ((line = in.readLine()) != null) { bytes += line.length(); if (line.startsWith("<DOC>")) { boolean inHTML = false; words = new ArrayList<String>(); c...
a6f6e71f-fd16-48c1-af3b-5e52b99dfee0
3
private static String translate(String message) { Matcher matcher = mColorPattern.matcher(message); StringBuffer buffer = new StringBuffer(); while(matcher.find()) { if (matcher.group(1) != null) matcher.appendReplacement(buffer, "§$1"); else if (matcher.group(2) != null) matcher.appendReplace...
5f56db07-8813-48d2-8437-c2d6d1a28ab3
2
public void Tick() { for(int x = 0;x<Chunk.width;x++) { for(int y = 0;x<Chunk.height;y++) { Tile T = contents[x][y]; T.Tick(); } } }
c342531a-e471-40ed-a76a-ea4ef38e5db8
3
private String makeAcePilesMove(CardGame game) { switch (moveTypeTo) { case TO_ACE_PILES: return "Can only move to a pile of the same suit"; case TO_KING_PILES: return game.moveCardOntoKingFromAce(indexFrom, indexTo); case TO_HAND: ...
6944e85f-8ca0-4d94-a190-b479b20f3972
2
@Override public boolean execute() { Boolean val = true; try { List<Font> fonts = new ArrayList<Font>(); for (int i = this.startFrom; i <= this.endAt; i++) { Font previousFont = this.document.getChildren().get(i) .getFont(); Font newFont = new Font(previousFont.getName(), previousFont.get...
3edbd26d-2e67-49f1-b472-69c8d24e7d56
2
public int getVoorraadById(int id){ int voorraad = 0; try { this.leesDatabase(); statement = con.createStatement(); rs = statement.executeQuery("SELECT voorraad FROM voorraad where id='"+ id +"'"); while (rs.next()) { voorraad = rs.getInt("voorraad"); } } catch (SQLException e) { // ...
cd808a38-33b5-43a1-a450-03f1e62df60d
6
public void paint1(Graphics g) { g.drawImage(background, 0, 0, this); if (granada.getAnimacion() != null) { g.setColor(Color.BLACK); g.drawImage(granada.animacion.getImagen(), (int) granada.getPosX(), (int) granada.getPosY(), this); g.fillRect(0, getHeigh...
03cc8b2c-3047-4124-9a87-25be30fc9146
8
public void updateInput() { int x = Mouse.getX(); int y = GameApplication.getScreenHeight() - Mouse.getY(); theHandler.mouseMoved(x, y); if (Mouse.isButtonDown(0)) { theHandler.mousePressed(x, y, MouseHelper.LEFT_CLICK); clickedLeft = true; return; ...
274d3acf-495a-42e0-a85d-76bdbc1eaa94
1
@Override public void main() { cleanOutput(); try { Cook cookJohn = new Cook(); addOutput("cook John is going to prepare some pies for you today!"); PieBuilder cpBuilder = new ChocolatePieBuilder(); PieBuilder apBuilder = new ApplePieBuilder(); cookJohn.constructPieWithPieBuilder(cpBuilde...
f3b6f0e9-45bf-44e4-abb3-37af12f9cec9
0
public Order addOrder(Order order) { getOrders().add(order); order.setAccount(this); return order; }
e1cb1e7d-ffaf-457d-99ec-1c7c4edad12a
4
public void setSymbolForBox(int row, int column, String str) { if (str == "A") this.setVI(row, column, new ABox(row, column)); else if (str == "E") this.setVI(row, column, new EBox(row, column)); else if (str == "W") this.setVI(row, column, new WBox(row, column)); else if (str == "D") this.setVI(row...
0ea164f5-ab3f-44fc-af34-b282b7434e9a
7
public void step() throws IncorrectNodeException { super.step(); //Get the agent Object agent = m_tree.getAgent(); GEBT_MarioAgent mario = (GEBT_MarioAgent)agent; int marioPos = mario.getCellsRun(); m_detectedTrapPos = (mario.inTrap() && mario.isRightTrap(...
29a7fd4b-f0f4-4f03-9035-1625715492ce
5
public boolean isVisible(float x, float y) { for(Integer[] losTile : this.visibleTiles) { if(losTile[0] <= x && losTile[0] + MapData.LOS_TILE_SIZE >= x && losTile[1] <= y && losTile[1] + MapData.LOS_TILE_SIZE >= y) { return true; } } return false; }
3b3a9b4f-d308-4c22-8b5c-6fe7b23a406e
7
public static boolean line_circle(double x0, double y0, double x1, double y1, double cx, double cy, double r){ double f = (x1 - x0); double g = (y1 - y0); double fSQ = f*f; double gSQ = g*g; double fgSQ = fSQ + gSQ; double rSQ = r*r; double xc0 = cx - x0; double yc0 = cy - y0; double xc1 = cx - x1; ...
6b83ab80-006c-496d-b8b6-0912b9b90887
5
static String getBasePath(URL url) { if (url == null) { return null; } String s = url.toString(); if (s.startsWith(FILE_SCHEME) && !s.startsWith("file://")) { s = "file://" + s.substring(FILE_SCHEME.length()); } if (s.endsWith("/") || StrTry.isEm...
d0f3c8d2-6517-46c2-9a03-64f8bae0d578
0
public double peekOperand(){ return operandStack.peek(); }
adb18643-d4f4-4c3d-a032-d3f9cbdaec29
8
private void scanSeparator() { switch (currentChar) { case '!': { takeIt(); while ((currentChar != SourceFile.EOL) && (currentChar != SourceFile.EOT)) takeIt(); if (currentChar == SourceFile.EOL) takeIt(); } break; case ' ': case '\n': case '\r'...
d36bcf88-2e9e-4b07-9855-79a53b07190f
6
public static void queryDatabase() { String query = "SELECT recipe_num, name, description FROM recipes"; Statement statement = null; try { statement = conn.createStatement(); ResultSet resultSet = statement.executeQuery(query); while (resultSet.next()) { ...
34cf0612-5d2f-4f06-b103-7cd33c221bc4
8
static <T extends TypeT> T[] indexed(Class<T> cls) { ArrayList<T> found = new ArrayList<>(); for (Field f: cls.getDeclaredFields()) { if (cls.isAssignableFrom(f.getType())) { try { T type = (T)f.get(null); found.add(type); ...
48a20da6-fe90-4572-97b5-38c3f273d3f0
6
@Test /** * This method simply calls the getEandomQuestion() 300 times. Becuase the * setUp() method (see above) has added 3 word pairs we should be able to * get them all with 300 tries. That is what is asserted at the bottom of * this method. * * This does not test the distribution, ...
a034dd2e-2321-4d78-924d-abb5ce60761a
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AsciiImage other = (AsciiImage) o; if (!other.getCharset().equals(charset)) return false; if (other.getHeight() != getHeight() || ...
e35af73f-9b8a-4c46-b269-21aaf89a0824
5
public static String getExecDirectoryPath() { String name = SystemUtils.class.getName().replace('.', '/'); name = SystemUtils.class.getResource("/" + name + ".class").toString(); if (name.contains(".jar")) { name = name.substring(0, name.indexOf(".jar")); name...
4aaeb982-cfae-41ed-8991-8d0745ba4faa
9
public ChessCore AddFig(int Figure, int x, int y, boolean Side, int AddSpecial){ if (AddSpecial==1 || AddSpecial==2) AddFig(Figure,9-x,y,!Side,0); if (AddSpecial==2) AddFig(Figure,x,9-y,Side,1); switch(Figure){ case 0: Fig.add(new FigPawn(x,y,Side,this)); br...
5f6f8781-8032-4c64-bd74-c654014e96fc
3
private Class<?> getGeneratedComponent(URLClassLoader loader) { try { StringBuilder s1 = generateSource(); String digest = getDigest(s1.toString()); String name = "Comp_" + digest; int indexOf = s1.indexOf("$$$"); s1.replace(indexOf, indexOf + 3, name); String source = s1.toString(); if (lo...
73905796-7140-484b-8147-842f86088477
3
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { StringBuilder sb = new StringBuilder(); if (!(args.length <= 1)) { for (String s : args) { if (s.equalsIgnoreCase(args[0])) { s.equals(""); continue; } sb.append(s); sb.append(" "); ...
9e596b5b-d6bc-4d2f-bea6-420589e14ca4
2
public void buildForrest(String fileLoc){ Instances data = null; BufferedReader reader = null; System.out.println("---------------BUILDING Random Forest Classifier---------------"); try { //Read in data from the .arff file reader = new BufferedReader(new FileReader(fileLoc)); data = new Instance...
5463b09d-840a-43ed-9247-e17f329326da
3
@Override public void dragDropEnd(DragSourceDropEvent event) { if (event.getDropSuccess()) { if (!mDropReceived) { if ((event.getDropAction() & mAllowedRowDragTypes) == DnDConstants.ACTION_MOVE) { externalMoveDrop(event.getDragSourceContext().getTransferable()); } } } setSourceDragColumn(null)...
b828136c-2771-49e3-8a52-69378fc40428
4
public void fusionWithNormalNoAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha = co...
f3989a62-0d8f-4b67-be27-8c28ea37f38a
4
@Override public boolean setShip(Ship shipToPlace) { boolean canPlace = canPlaceShip(shipToPlace); // add ship if (canPlace) { // if already in list update Iterator<Ship> shipIterator = ships.iterator(); while (shipIterator.hasNext()) { ...
1a714a82-72bf-40c8-93dd-ba97f1784f16
2
public void cleanPairings() { if (invalidPairings.isEmpty()) return; boolean changed = pairings.removeAll(invalidPairings); invalidPairings.clear(); if (changed) SignalTools.packetBuilder.sendPairPacketUpdate(this); }
57d7b56f-986d-4a42-bb91-f6339dc6071d
8
@Override public boolean preInvoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel, int secondsElapsed, double actionsRemaining) { if(secondsElapsed==0) { String dir=CMParms.combine(commands,0); if(commands.size()>0) dir=commands.get(commands.size()-1); final int dirCo...
33bb4bff-d9bf-49b4-92c8-01822c968e33
3
private static void test_toString(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { int bits = (Integer) t.tests[i]; String exp = (String) t.tests[i + 1]; ...
8630ade2-b3c2-4e0c-9743-76c932b6f660
4
private void createAdjacencyMatrix(){ adjacencyMatrix=new int[numberOfNodes][numberOfNodes]; predecessors=new int [numberOfNodes][numberOfNodes]; int index=0; for(int[]row:adjacencyMatrix){//initialization Arrays.fill(row,negativeInfinity); adjacencyMatrix[index][index]=0; index++; } index=0;...
38034812-010b-4fde-9e4e-38301e3f7d8c
1
public static void releaseConnection(Connection con) { if (con != null) { closeConnection(con); } }
0d1ab69e-980b-46db-861e-a3b9af1f89d8
7
public final DirkExpParser.multiplyExpr_return multiplyExpr() throws RecognitionException { DirkExpParser.multiplyExpr_return retval = new DirkExpParser.multiplyExpr_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token set18=null; DirkExpParser.powExpr_return p...
35546328-4a6e-44e7-8bbe-25759e6f5659
4
@Override public boolean playing() { switch( channelType ) { case SoundSystemConfig.TYPE_NORMAL: if( clip == null ) return false; return clip.isActive(); case SoundSystemConfig.TYPE_STREAMING: if( sourceD...
620b64c8-ed37-4ce2-89b5-579e254a4143
9
protected Result attach (int fid, int afid, String uid, String aname, Credential cr) { // check for authentication fid if (afid != -1) { // get associated entry Entry e = assoc.get (afid); if (e instanceof AuthEntry) { // we have an authentication entry. AuthEntry auth = (AuthEntry) e; // check...
018b53c5-d0a0-4675-90a6-2002c06138eb
4
public char Kbj(int jb, double e) throws palError { /* Preset status */ Status = 0; char k; /* If prefix given expressly, use it */ if (jb == 1) { k = 'B'; } else if (jb == 2) { k = 'J'; /* If no prefix, examine the epoch */ ...
1a252bb0-4f36-4196-833a-bdf10610e44c
7
public static String convert100(int num){ String str = ""; if(num >= 100){ str += digits[num /100 -1] + " Hundred "; num %= 100; } if(num >= 11 && num <= 19){ return str + teens[num - 11] + " "; }else if(num == 10 || num >= 20){ str += tens[num /10 -1] + " "; num %= 10; } if(num >= 1 ...
42ceeddd-523b-4fc8-ad6f-7f307955cfc0
5
public boolean audioChat(String sender, String target){ //this needs to be stress-tested and bug-fixed TODO if (sender.equalsIgnoreCase(target)){ System.out.println("Audio chat failed: cause 1"); return false; } //can't do audio chat with yourself! AudioThread thread = audioRooms.get(""+sender+" "+targe...
8d7d0e88-ac30-4e19-abde-d28ab43ec088
8
public long doUpdate(Master master, UpdateRequest updateRequest) { incrementAccessAndMaybeRecalibrate(master); File f = updateRequest.getFile(); Location accessLoc = updateRequest.getLocation(); MasterMeta fm = master.map.get(f.getId()); boolean allSucceeded = true; long maxDelay = -1; Set<C...
9eaee1a3-349c-4155-afff-cb26de424204
5
public static void search(SearchNode root) { //use hash set for the fringe Set<SearchNode> fringe = new HashSet<SearchNode>(); fringe.add(root); while(!fringe.isEmpty()){ //find the min h+g for the nodes in the fringe SearchNode curr = findMinGPlusH(fringe); if(!curr.getState().isGoal()){ //genera...
70cced82-6d2a-46f6-b8f9-e51fd29ca3b3
9
private ArrayList<String> extractInputsOrOutputs (FilterBean fb, String cssSelector) throws ParserException { NodeFilter filter = new CssSelectorNodeFilter(cssSelector); fb.setFilters(new NodeFilter[] {filter}); NodeList nodeList = fb.getNodes(); if (nodeList == null || nodeList.size() =...
4828bfd0-026c-4a96-bed4-24b8beddca65
9
static void draw_chars(osd_bitmap _tmpbitmap, osd_bitmap bitmap, int scroll_cols) { int offs; /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (offs = videoram_size[0] - 1;offs >= 0;offs--) { if (dirt...
f7fa2c81-284e-404f-9fa5-dd3ca205c088
9
public Object handleCall(Method method, Object[] args) throws Exception { BaseServiceMetadata metadata = metadataHandler.getBaseServiceMetadata(method); HttpRequest request = requestFactory.newRequest(metadata.getMethod(), metadata.getUrl()); Map<String, String> pathParams = metadataHandler.getPathParams(method...
5579b68f-9abd-4aa0-aec0-609687e90169
7
@EventHandler public void SkeletonSlow(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.getZombieConfig().getDouble("Skeleton.Slow.D...
ced6ac0c-d3aa-453e-992d-e8e7fe1c342d
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Cliente)) { return false; } Cliente other = (Cliente) object; if ((this.codcliente == null && other.codcliente ...
552eeeb8-d2c8-4733-8d24-cf13353acb2d
3
public boolean isDefinite(int idx) { if (idx == 0 || size() < idx + 2) return false; if (phrases.get(idx - 1).get(0).term != "the") return false; return phrases.get(idx - 1).get(0).pos.startsWith("VB"); }
6cdd5cd0-2a19-44a5-8a49-46d73cd03e4b
9
public void setContainer(int type) { t = type; if(loaded == false){ switch(type) { case 0: setImage(bigContainerDarkImagePath); break; case 1: setImage(bigContainerLightImagePath); break; case 2: s...
7e8f5bcb-5b57-4d46-9d99-082f9da6e7e5
9
public void parseArguments(){ numberOfHashTables = getIntegerValue("-t",4); numberOfHashes = getIntegerValue("-h",4); numberOfNeighbours = getIntegerValue("-n",4); String hashFamilyType = getValue("-f", "l2"); linear = hasOption("-l"); radius = getDoubleValue("-r",0.0); printHelp = hasOption("--h...
be69ef88-8b92-408a-b51e-d2fb0fb1a8e2
7
public void appliquerEffets(Attaque attaque){ if(attaque.getNom() == "Instinct d'esquive") { protection = 3; } if((attaque.isCeleste() && !this.terrestre) || (attaque.isTerrestre() && this.terrestre)){ // vérifie si le personnage est vulnérable ou non à l'attaque, selon qu'il est terrestre ou céleste if(att...
3e983834-9139-49f0-b8aa-802c344aae55
6
public void removeDuplicates(Node node) { Node root = node; if (root == null) { return; } System.out.println("Before duplicate removal:"); print(root); while (root != null) { if (root.getData() == root.getLink().getData()) { Node ptr = root.getLink(); while (ptr != null && ptr.getLink() !...
42306bc0-e6ab-482d-b60e-5798f499081d
3
public int minCost(int i, int j) throws Exception { if (i > j) throw new Exception("Invalid Matrix sequence"); if (i > n || j > n) throw new Exception("Non existent matrix specified"); return m[i][j]; }
d863598f-8c95-48ee-a8d5-ff5dab4d7652
2
public void clearTempFiles() throws Throwable { File forgeInstaller = new File("forge-installer.jar"); if (forgeInstaller.exists()) forgeInstaller.delete(); File buildZip = new File("build.zip"); if (buildZip.exists()) buildZip.delete(); }
98cd0275-a03c-4d7e-94b0-7feb10a7b898
5
@Override public void doTask() { Set<Direction> directions = new HashSet<Direction>(); if(keyboard.isKeyPressed(upKey)) { directions.add(TOP); } if(keyboard.isKeyPressed(downKey)) { directions.add(BOTTOM); } if(keyboard.isKeyPressed(leftKey)) { directions.add(LEFT); } if(key...
2ec79fcc-ea1c-4f6d-af92-d069c03490f0
6
@Override public void perform(byte[] bytes){ if (bytes != null){ BitSet bits = BitSet.valueOf(bytes); int bitsNumber = bytes.length*8; for (int j = 0; j < bitsNumber; j++){ binary.set(processedBitsNumber, bits.get(j)); processedBitsNumber++...
5c93b384-43b6-4149-92dc-51b8cf26c30e
9
public Blocks(int n) { num = n; blocksPts = new Point2D.Double[num][4]; blockPts = new Point2D.Double[4]; isExist = new boolean[num]; heightOfX = new int[right-left]; Random random = new Random(System.currentTimeMillis()); int width, height; for(int i = left; i < right; i ++) heightOfX[i-left] = Truck...
ecb2f4ca-b1bd-4794-90a5-24788502ec70
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][5]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (5>=0){ r_con.Connection(); String campos = colum_names[0]; ...