method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
23b83723-6ea5-403b-8c1a-f69566aa5544
1
private static void npe() throws MyException, IOException { // Object obj = null; Object obj = new Object(); try { obj.toString(); } catch (Throwable e) { System.out.println(e); throw new MyException(e); } finally { System.out.println("finally block"); } System.out.println("After try/catch"...
62ea668b-b899-4c05-a2cc-846a505b2cf8
1
private void uniform(int nfruits) { int unit = nfruits / 12; dist[0] = nfruits - unit * 11; for (int i = 1; i < 12; i++) dist[i] = unit; }
ce9e1d7e-6ad3-48a8-bf17-977879b959b5
4
public String getRandomDate() { Random rn = new Random(); String day; String month; String date; day = Integer.toString(rn.nextInt(28)); month = Integer.toString(rn.nextInt(12)); if (day.length() < 2) { if (day.equalsIgnoreCase("0")) { day = "1"; } day = "0" + day; } if (month.length() ...
0b51e2d9-f987-4457-b4b7-ac369f3a8278
7
private void parseFile(String filename) { int wordCount = 0; int numberCount = 0; // use character based reader as inputstream try (FileReader reader = new FileReader(filename);) { StreamTokenizer tokenizer = new StreamTokenizer(reader); // set constraints // these will ignore tokens inside comments ...
142d5243-3d58-4280-8a24-131e8f1e3e9b
3
public void visitTableSwitchInsn( final int min, final int max, final Label dflt, final Label[] labels) { buf.setLength(0); for (int i = 0; i < labels.length; ++i) { declareLabel(labels[i]); } declareLabel(dflt); buf.append("mv.vis...
1381cf29-53ce-4e53-bbfb-bcb469b5fce8
2
public boolean hasMultiworldBypassPermission() { return this.multiworldBypassPermission != null && !this.multiworldBypassPermission.equals("*") && !this.multiworldBypassPermission.equals(""); }
33c2971c-80d1-4e7c-b8f8-307f6cd3c216
3
public static void showMessage(String message, String title, String exception, boolean fatal) { JOptionPane.showMessageDialog( null, message, title, exception != null ? JOptionPane.ERROR_MESSAGE : JOptionPane.INFORMATION_MESSAGE); if (excep...
b6bbfe34-fa16-4995-a6ff-f8858f472029
9
public void refreshList() { this.dialogList = new Vector<ClientDialog>(this.client.getDialogs()); this.simpleDialogtList = new Vector<JListData>(); JListData sauvDialog = this.jDialogList.getSelectedValue(); int indiceClient = -1; int cpt = 0; for (ClientDialog dialog : this.dialogList) { if (dialog.i...
98ce60a2-36eb-48ca-88e3-b21823a81821
5
private void bindItemToInformationSystemModel() { informationSystemModel .addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals( InformationSystemModel.PROFILE_ID_PROPERTY) || evt.getPropert...
255499f3-2a7e-492c-8b9f-038958ffda2f
3
@Override public int pulse() { if (game.getGameState() == GameState.LOGIN) { if (!clicked) { mouse.click(userRect.x, userRect.y, userRect.x + userRect.width, userRect.y + userRect.height); clicked = true; sleep(1000, 1500); } else { ...
300dc619-b885-4b94-9927-3bf9d2f018b7
8
void drawBackbone(Graphics g, Rectangle r, boolean upperPart, boolean inRNA, boolean codonBorder) { if (g == null) return; Rectangle backboneTipRect = null; Color oldColor = g.getColor(); Color rColor = getBackboneColor(inRNA); if (rBackBone == null) rBackBone = new Rectangle(r.x, 0, r.width, 4); if (...
38bc1b4a-7bab-4ff0-87c9-d32e9c1ade09
8
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextTitle)) { return false; } if (!super.equals(obj)) { return false; } TextTitle that = (TextTitle) obj; if (!ObjectUtilities.eq...
5f87b982-df89-4f82-a585-7a3236250145
3
private static boolean checkSpecial(String n){ if(Long.parseLong(n)<1e9) return false; int[] p = {2, 3, 5, 7, 11, 13, 17}; String ns = n; for(int i=1;i<8;i++){ // System.out.println(ns.substring(i, i+3)); if(Integer.parseInt(ns.substring(i, i+3)) % p[i-1] != 0) return false; } return true; }
54d2dbc1-f53d-4a2f-b80e-911ed67fe4d9
1
protected boolean write(Script script) throws IOException, InterruptedException { if (script == null) { IllegalArgumentException iae = new IllegalArgumentException("The script object is null!"); Main.handleUnhandableProblem(iae); } assert FileUtil.control(script.scriptPa...
bc469686-8c21-4d71-814b-f0eef163a15d
3
public boolean hasStore(Player player){ if(player==null) return false; Iterator<Chest> itr = stores.keySet().iterator(); while(itr.hasNext()){ if(stores.get(itr.next()).getOwner().equals(player)) return true; } return false; }
8d46a534-6ca9-48e6-9344-9b1a0ee08bd8
0
public int getAge() { return age; }
75c25a69-684e-48e4-8bff-74feb3294184
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 64 // do, line 66 v_1 = cursor; lab0: do { // call mark_regions, line 66 ...
2623e485-fe1f-4243-970a-f6cec6b4eab0
1
public void mouseReleased(MouseEvent e) { //if (e.isPopupTrigger()) Ne marche pas avec le JDK d'IBM if (e.getButton() == MouseEvent.BUTTON3) popupTable.show(e.getComponent(), e.getX(), e.getY()); }
9f981ee9-1842-4bfc-adc5-412609fdaa8f
5
public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please enter three integer numbers"); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); System.out.println("The numbers in descending order are: "); if (a > b) { if (a > c) { if (c > ...
10b89017-18cd-4e98-b53a-3ab18028733e
9
public void create(Eventos eventos) throws PreexistingEntityException, Exception { if (eventos.getHistoricoPrecioList() == null) { eventos.setHistoricoPrecioList(new ArrayList<HistoricoPrecio>()); } EntityManager em = null; try { em = getEntityManager(); ...
96e6bdc8-7e9e-481e-90e3-21f1c2e1897b
7
@Override public List<Curso> Buscar(Curso obj) { String sql = "select a from Curso a"; String filtros = ""; if(obj != null){ if(obj.getId() != null){ filtros += "a.id = " + obj.getId(); } if(obj.getNome() != null){ ...
edea10d2-90d1-47a6-b455-72d9d1fc0be9
9
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AlienFXProfileSetting other = (AlienFXProfileSetting) obj; if (powermode == null) { if (other.powermode != null) return false; } else if (!powermod...
d80a471b-aeb1-446d-b6a7-38c95b6d4f73
8
public String[] getPropertyNames() { if (names != null) return names; String propString = (String) p.get("names"); if (propString == null) return null; names = new String[Aminoacid.NUMB_AMINO_PARAM + 3]; try { StringTokenizer parser = new StringTokenizer(propString, ","); if (parser.hasMoreTokens(...
cc5fff38-5a2c-438d-a7c9-aebd50b4c3b9
9
private void doScanPackageClassesByFile(Set<Class<?>> classes, String packageName, String packagePath, final boolean recursive) { File dir = new File(packagePath); if (!dir.exists() || !dir.isDirectory()) { return; } File[] dirfiles = dir.listFiles(new FileFilter() { // 自定义文件过滤规则 public boolean accept...
01fe263e-5723-4805-9da0-f46a84cbbf55
4
public boolean equals(Object obj) { if (obj instanceof Item) { Item rValue = (Item) obj; if (title.equals(rValue.title) && link.equals(rValue.link) && description.equals(rValue.description)) { return (true); } } return (false...
05a7fedf-1a50-4a72-bea4-d561a916e520
3
public static double[] circle_circle_p(double cx0, double cy0, double r0, double cx1, double cy1, double r1){ double[] result = NONE; double dx = cx1 - cx0; double dy = cy1 - cy0; double distSQ = dx*dx + dy*dy; if(distSQ > ACCY){ double r0SQ = r0 * r0; double r1SQ = r1 * r1; double diffRSQ = (r1SQ -...
f6bb4366-8090-4e89-a796-53c7685aef49
7
private void erasePartitionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_erasePartitionsButtonActionPerformed if (jList2.getSelectedValuesList() == null || jList2.getSelectedValuesList().isEmpty()) { logger.log(Level.ERROR, "No partition was selected! Please select a part...
a3d2a447-82c1-434c-ac69-65c5678cfd96
6
final int[] toPixelArray() { int widthTotal = getSpriteWidth(); int[] pixels = new int[widthTotal * getIndexHeightTotal()]; if (((ImageSprite) this).alphaIndex != null) { for (int y = 0; y < ((ImageSprite) this).indexHeight; y++) { int srcOff = y * ((ImageSprite) this).indexWidth; int destOff = (((ImageSpri...
c49f7067-53db-4928-b964-4a071bfd815f
9
@Override public STATUS run(Context context) { pcContext = (PacManContext)context; ArrayList<Integer> targets = new ArrayList<Integer>(); boolean powerPillActive = false; int ghostCounter = 0, ghostSpawnTimeTotal = 0; int[] ghostPositions = new int[4]; int[] activePowerPills = pcContext.activePowe...
870949ec-3f13-4517-b720-ce33600aa036
2
private void load() { ProgramState curr = StateMachine.getState(); if (curr == ProgramState.EDITING) loadSong(); else if (curr == ProgramState.ARR_EDITING) loadArrangement(); }
7df377d7-313a-464d-b8cc-6b22741985c3
8
protected boolean orderConnections(NeuralNetwork neuralNetwork, Layer currentLayer, Set<Layer> calculatedLayers, Set<Layer> inProgressLayers, List<ConnectionCandidate> calculateCandidates) { boolean result = false; if (calculatedLayers.contains(currentLayer) || Util.isBias(currentLayer)) { result = true; } els...
49388486-9b81-4a1e-9916-5760ffcaeb53
7
private void possibleAddEntryToCache(final String fileName, final FileCacheEntry entry, final String[] eTag) throws HTTPException { synchronized(cache) { if(entry.buf[CompressionType.NONE.ordinal()] == null) { cache.put(fileName, entry); return; } final long targetBytes = cacheMaxBytes-entry.bu...
69bcaacd-213b-4b47-97e2-6dcd1149a3b6
5
@Override public void run() { // Clone to avoid concurrent modification. for (Player p : (List<Player>) this.game.players.clone()) { Location l = p.getLocation(); l.setY(l.getY() + 3); if (this.arena.contains(l)) { if (this.game.players.size() > 1...
4af88d05-8706-4a0d-a271-ae348e22986d
6
@Override public void process(PlayerConnection pc, Object data) { Boolean getCardFromDeck = (Boolean) data; Card card = null; if (getCardFromDeck) { if (deck.isEmpty()) { Card lastCard = pile.getCard(); deck = pile; ((Deck)deck).shuffle(); ((Pile)pile).putCard(lastCard); } card = d...
a09be4af-a1b9-466e-b62b-460dfcc839e1
1
public void addUserIfNotExist(String uid) { if (getUserNode(uid) == null) { Element newUser = doc.createElement("user"); newUser.setAttribute("id", uid); newUser.setAttribute("balance", "1000"); Element root = doc.getDocumentElement(); root.appendChild...
01511f1c-e9f3-40bb-8351-f67cc12826c9
3
public void inint(int n) { d = new int[n][n]; for (int i = 0; i < n; i++) for (int k = 0; k < n; k++) if (i != k) d[i][k] = INF; }
5b175570-d878-440a-966e-ecfb008ffe84
7
public boolean checkBST (TreeNode n,Integer min, Integer max) { if(n == null) return true; if( (min != null&& n.val<=min) || (max != null&& n.val > min)) return false; if( (!checkBST(n.left,min, n.val)) || (!checkBST(n.right,n.val, max))) return false; return true; }
21eda606-85cd-4383-8843-c8ef389a8d75
2
public void notifyListeners(PropertyChangeEvent stateChange) { if (stateChange == null) { throw new IllegalArgumentException("Cannot notify listeners with a null PropertyChangeEvent!"); } for (PropertyChangeListener listener : changeListeners) { listener.property...
f4f867b9-f9b9-49ac-84c4-1347a3a90993
7
public static void main(String[] args) throws SQLException, ClassNotFoundException, Exception { String dbName = "resources/data.sqlite"; String qName = "resources/data.sql"; double[] alphas; if(args.length == 0) { /** * Запилить...
67c655e9-ec95-4328-b060-e115dab6013b
5
public static void rightTime(String time) { Matcher m = TIME.matcher(time); List<Long> list = new ArrayList<Long>(); while (m.find()) { list.add(TimeUnit.HOURS.toMinutes(Long.parseLong(m.group(1))) + Long.parseLong(m.group(2))); } List<Long> normalizedTimes = generat...
9853f1c7-329d-47da-a14b-6b7f538274fa
0
public void setjSeparator1(JSeparator jSeparator1) { this.jSeparatorTitre = jSeparator1; }
5dc44a07-3918-493b-9a8e-056e7a97ec29
9
@Override public void leftShoulder(boolean pressed) { if(enabled) { if(ses2 != null) { setFlagsFalse(); if(future != null) { future.cancel(true); } } if(pressed == true) { lbFlag = true; dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetLBAssignedKeyCode()); ...
4b5d1e7f-d4c8-4448-b2a2-b0b01cc4c7af
6
public void posteriorDistribution() { double tiC1 = 0, tiC2 = 0, tiC3 = 0, pTi = 0, pC1Ti, pC2Ti, pC3Ti; System.out.println(testNum); for (int i = 0; i < testNum; i++) { System.out.println(i); tiC1 = getPTiCi(pXiC1Map, testData.get(i)); tiC2 = getPTiCi(pXiC2Map, testData.get(i)); tiC3 = getPTiCi(pXiC3...
63a8bf4d-580f-45bf-ab06-d8ccb81fb5f2
3
private void LogarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogarActionPerformed //vish for(Usuario u: CadUsuario.usuarios){ if(u.getEmail().equalsIgnoreCase(Femail.getText())&& u.getSenha().equalsIgnoreCase(Femail.getText())){ Uaux = u; ...
a3efbf51-d58b-47ff-be1f-f1da66d3d1a5
1
public static void main(String args[]){ int[] input={4,6,1,2,7,3,1}; C2Dot2FindDupinArr c=new C2Dot2FindDupinArr(); // for(int k=0;k<c.findOddPair(input).length;k++){ // System.out.println(c.findOddPair(input)[k]); // } //c.insertionSort1(input); //c.mergeSort1(input); //for(int i=0;i<input.le...
6fcae0dc-850a-448e-bde0-3d97bbb9dffb
4
private ArrayList<String> parse(String inputLine) { ArrayList<String> chaine = new ArrayList<String>(); String art = ""; Pattern p = Pattern .compile("(::[^:]+::)"); Matcher m = p.matcher(inputLine); while (m.find()){ //lecture du fichier texte try{ art=""; InputStream ips=new Fil...
2d43a748-1e85-4ffd-b694-475e2b457bf3
2
private String munecoAvanzado(){ String muneco = ""; if(intentos == 1){ muneco = muneco + " O <BR>"+ " /|\\ <BR>"; } if(intentos == 0){ muneco = muneco + " O <BR>"+ " /|\\ <BR>"+ " / \\ "; } return muneco; }
00c516ad-d2f9-4e0a-ad3b-a4dfadf851ba
7
public static void writeTabluarTaxa(File inFile, File outFile) throws Exception { List<NewRDPParserFileLine> list = NewRDPParserFileLine.getRdpList(inFile); BufferedWriter writer = new BufferedWriter(new FileWriter(outFile)); for(int x=1; x < TAXA_ARRAY.length; x++) writer.write( TAXA_ARRAY[x] + (x == ...
6d8f2087-abd1-4297-ae00-c9c0cf673c56
8
private void parseFile() throws CheckedException{ Scanner _fileScanner; String _parseLine; StringBuffer _tempBuffer; boolean _hasNextLine; boolean _temp; int _patternIndex; String _skipLineSeparator; String _nextLine; try{ _fileScanner = new Scan...
96fab4e9-ab58-4798-a304-5a46fd4eac0a
9
static boolean isEncodingSupported(final AudioFormat targetFormat) { final FFAudioFormat.FFEncoding ffEncoding = FFAudioFormat.FFEncoding.getInstance(targetFormat.getEncoding().toString()); boolean supported; if (PCM_UNSIGNED.getEncoding().equals(ffEncoding) && targetFormat.getSampleSizeInBits()...
07bd00de-a413-4973-9968-ae0b5eb3fbae
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++) { ...
1f500921-5d9a-4a80-9cc5-0955cd4b2bb0
1
public void cancelCommunication(SubLWorker worker) throws java.io.IOException { Integer id = worker.getId(); if (id.intValue() < 0) { //@note serial communications cannot be canceled right now return; } String command = "(fif (" + "terminate-active-task-process" + " " + worker.getId() + " \"...
a6371431-34b1-4ce2-91b8-eab52659238b
3
public void grade(Course[][] courses) { System.out.print("Enter semester to enter grade: "); int semester = scan.nextInt(); System.out.print("Enter course number to enter grade: "); int course = scan.nextInt(); if( semester > courses.length || course > courses[semester].length || courses[semester][course]...
f3f80aac-4f70-468c-a9d6-53d084480345
6
public void setClassPath(String classpath) { if (classpath == null || classpath.length() == 0) classpath = "."; currentClassPath = classpath; alterrs.jode.bytecode.ClassInfo.setClassPath(classpath); decompiler.setClassPath(classpath); if (classTree != null) classTree.clearSelection(); if (packModel !=...
d68c8ecd-8b33-43d2-8ec6-e75c89c1c239
7
@Override public void keyPressed(KeyEvent ke) { switch (ke.getKeyCode()) { case KeyEvent.VK_F: MainClass.getLevelManager().getPlayer().processFPress(); break; case KeyEvent.VK_D: MainClass.getLevelManager().getPlayer().processDPress(); break; case KeyEvent.VK_LEFT: ...
3cdf8330-cc9b-4288-8c7e-4e22ae17ec36
2
private void setModelName(String PremierDeclaration){ int i = 0; String NomModel =""; PremierDeclaration = PremierDeclaration.trim().substring(i+5).trim(); PremierDeclaration = PremierDeclaration.trim(); while(PremierDeclaration.charAt(i) != ' '){ NomModel += PremierDeclaration.charAt(i); i++; } whi...
86f69e2f-18f0-4d43-9890-421f60cea534
0
public void setCode(String code) { this.code = code; }
c533a594-b405-4aa6-af19-f80e15ebdb40
1
public List<String> read(String fileName) throws IOException { List<String> csvStrings = new ArrayList<String>(); FileReader fileReader = new FileReader(fileName); BufferedReader bufReader = new BufferedReader(fileReader); String line; while ((line = bufReader.readLine()) != null) { csvString...
f3a4da78-9085-4df0-be8d-53881bb64462
3
protected static boolean diff(final int c1, final int c2, final int trY, final int trU, final int trV, final int trA) { final int YUV1 = RgbYuv.getYuv(c1); final int YUV2 = RgbYuv.getYuv(c2); return ( (Math.abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) || (Math.abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) |...
ca88384e-ef2a-4c0f-90ef-249a451d27f9
9
public static BaseEntity get(String name) { /*for (Entry e: gameEntityMap.entrySet()) { if (e.getKey().equals(name)) { return new GameEntity() } }*/ //System.out.println(name); BaseEntity b = gameEntityMap.get(name); if (b != null) { //TODO: Fix this so that it doesn't return a generic Ga...
90ff4692-5cb0-4735-abda-1192c6a604e1
3
public static int findNumDays(String fileName) { int lineNumber = 0; String line; try { BufferedReader br = new BufferedReader( new FileReader(fileName)); while( (line = br.readLine()) != null) { lineNumber++; ...
c742689d-9e02-4151-b6ef-73b046c76e52
7
private void setCharacterImage(String characterDirection, String teamCode) { if(teamCode.equals("r")) { if(characterDirection.equals("n")){ character=rmlnorth;} else if(characterDirection.equals("e")){character = rmleast;} else if(characterDirection.equals("w")){character = rmlwest;} ...
13314155-8844-4c30-ae1c-6707d09ebbe0
3
public void addToGraph(ArrayList<String> conceptRoleCollection, String shape, Object parent, mxGraph graph, int startPos, ArrayList<Constructs> collections, int index) { int ant = 0; int newPos = 0; String conRole = ""; String conname = collections.get(index).getConstructName(); while (ant < conceptRo...
116a4afa-a2c4-4a1e-be02-e8b2546811bf
7
public void fusionWithSoftLightFullAlpha(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...
4ff5b055-496a-4a43-b7fc-3e70f8f2ce0f
9
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[39]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 19; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { i...
7140d96d-7fab-4ce9-8c9e-4e0e1428b5db
9
public int [][] loadInferData (String modelFolder, String fileName) { System.out.println ("Load Infer Data Start!"); int inferData [][] = null; BufferedReader reader = null; if (null == wordMapping) { loadWordMapping (modelFolder + "/wordMapping.txt"); ...
ebdfa4f7-3d53-4a1c-95ef-3bae421e32ee
3
public void setHeuristic(ChocoHeuristic heuristic) { switch (heuristic) { case MIN_DOMAIN: { solver.setVarIntSelector(new MinDomain(solver, solver.getVar(model.getVariables()))); break; } case DOM_OVER_WDEG: { solver...
0785d9b9-fb4d-46ab-844e-ca507206c634
6
public static HashMap<String, String> stMakeData(int dataId,String shname) { try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse (new File(".//Data//Data.XML")); ...
a9784bc3-fe74-4284-8abe-c87edc05be1a
2
public LinkedList<Stock> getCheapestStocks(int quantity){ LinkedList<Stock> sorted = qs.qsort(stocks, 1); LinkedList<Stock> ret = new LinkedList<Stock>(); if (quantity > sorted.size()) quantity = sorted.size(); for (int i = 0; i < quantity; i++) ret.add(sorted.get(i)); return ret; }
d7601857-bef3-45f0-8542-a20b417a95c6
6
public static Chemin plusCourtChemin(ZoneGeographique zone, LivraisonGraphVertex depart, LivraisonGraphVertex arrivee) { final Map<Noeud, Float> distances = new HashMap<Noeud, Float>(); float maxArcCost = getMaxArcCost(zone); Noeud arriveeNoeud = zone.getNoeudById(arrivee.getIdNoeud()); ...
0a2743d5-575a-4b67-bc0b-0a49f53e165e
3
private static boolean preguntaReintentar( String pregunta) { char caracter = 0; do { try { System.out.print( pregunta + " (s/n): "); caracter = Character.toLowerCase(scanner.nextLine().charAt(0)); } catch (Exception e) {} } while ((caracter != 's') && (caracter != 'n')); return caracte...
053677c4-d523-4794-bb29-5b4148dd126e
7
@Override public void receivePacket(Packet p_temp){ if(p_temp instanceof ARPPacket){ ARPPacket p=(ARPPacket)p_temp; if (p.operation == ARPPacket.ARP_REPLY){ String srcip = p.getSenderProtocolAddress().toString().split("/")[1]; if (ip_mac_list.containsKey(srcip)) return; if(gatewayip == nu...
86ea8d3c-7de7-4617-879a-059168004617
2
@Override public void addElement(String anObject) { Debugger.debug(() -> { System.out.println("my add Element working."); }); if (-1 == super.getIndexOf(anObject)) { allElems.add(anObject); super.addElement(anObject); if (!ComboElemPersistence....
8aab2c27-3af7-4d0e-a46f-d1c97ad4e495
8
public static Point commandToDir(Command command) { Point p = new Point(0, 0); if (command == LEFT) { p.x = -1; } else if (command == LEFT_UP) { p.x = -1; p.y = -1; } else if (command == UP) { p.y = -1; } else if (command == RIGHT_...
95e867c2-0eb5-43ff-8434-08437636521d
8
public static Cons clTranslateArefTree(Cons tree) { { Symbol operator = null; Surrogate owner = null; Cons arguments = null; { Object [] caller_MV_returnarray = new Object[2]; operator = Cons.destructureCallTree(tree, caller_MV_returnarray); owner = ((Surrogate)(caller_MV_returna...
c1e07ecf-d71e-4faa-b43b-8a247fc9b1f6
5
public void analyse() throws UnsupportedAudioFileException, IOException, ParserConfigurationException, SAXException { File[] filearray = getAllFiles(); for(File f : filearray) { Load loader = new Load(config); Map<String,String>contentfolder1 = loader.loadFilenameToContentMap(config.getTestordnerPath() + "...
ea3a3296-5091-4e1b-9dc4-9bb38d518284
8
public static void main(String[]args){ Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int h=0,s=0; for (int i = 0 ; i < n ; i++){ int value = in.nextInt(); String status = in.next(); if...
17258940-5710-4320-96c4-71fc4d893903
4
private void setRow(int row, Item i, int number, long worth) { Craftable placeHolder = null; if (i.getType() == ItemType.CRAFTABLE) { placeHolder = (Craftable) i; ingredientProfitRatio[row].setEnabled(true); ingredientProfitRatio[row].setText(numberFormatter.format(placeHolder.getProfitRatio())); if ...
209b49d4-5546-455c-89ea-a4600848e6a1
5
private ArrayList<Bar> createBars(){ //arrange data lowest to highest Arrays.sort(data); int intervalSize = 0; if(numOfBars > 0) { intervalSize = (getMaxNumber(data) / numOfBars); } int lowerLimit = 0; int upperLimit = lowerLimit + intervalSize; int count; ArrayList<Bar> bars = new ArrayList<Bar...
e814dc87-6bfc-4e0f-9781-2135070224c9
2
static public boolean checkFileCreate(String path, String filename) { File file = new File("plugins" + path, filename); if (!(file.exists())) { try { File dir = new File("plugins/", path); dir.mkdirs(); file.createNewFile(); return false; } catch (IOException e) { e.printStackTrace(); }...
5c3fb446-ad3f-444e-866c-4bd375442eaa
0
public void destroy() { doc = null; group.remove(this); }
f91715e7-b4cb-4660-b291-808c599191de
1
public static Punto[] predictorCorrector(double epsilon, double x0, double y0, double xn, double h, Funcion fun){ final Punto[] rkPuntos = rungeKuttaOrden4(x0, x0 + 4 * h, h, y0, fun); //calcula los primeros 5 puntos con RKOrden4 double aux = ((((xn-(x0 + 5*h)) / h) + 1)); //cuenta para sacar el n ...
6be47734-b314-4521-b1fd-61104bf095eb
3
public static int totalNumberOfPieces(Board b) { int sum = 0; for (int i = 0; i < b.board.length; i++) { for (int j = 0; j < b.board[i].length; j++) { if (b.board[i][j] != Board.empty) { sum++; } } } return sum; }
954dd36f-1ef1-4bb6-9178-072304d005a6
4
public boolean addEdge(E e) { V a = e.getVertexA(); if (a == null) { return false; } V b = e.getVertexB(); if (b == null) { return false; } int idA = a.getId(); int idB = a.getId(); /* Ueberpruefen, ob Knoten in Graph */ Integer idxA = vertexIndex.get(idA); Intege...
f791d837-3d0f-4be0-82a4-8daae50c3859
6
@Test public void placeFiguresOnBoardSize7() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(KING.toString(), 2); figureQuantityMap.put(QUEEN.toString(), 3); figureQuantityMap.put(BISHOP.toString(), 4); figureQuantityMap.put(ROOK.toString(), ...
427b3a9d-4bf0-41d9-9e17-28cea46b1288
9
int insertKeyRehash(short val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
b84b6b22-8723-414e-a155-00c37b4a1504
4
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative"); if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative"); double xs = s...
bf8ba596-40ad-4d88-ac97-3b612528aee6
3
public void compare() { // already found differences (e.g. different page count) if(!pdfInfoHolder.isDifferent()) { PDFHolder pdfHolder1 = pdfInfoHolder.getPDFStructure1(); PDFHolder pdfHolder2 = pdfInfoHolder.getPDFStructure2(); // missing the counter part if(pdfHolder1 == null || pdfHolder2 == n...
dcbe4291-ce80-4443-9a62-4a25db00ceb1
7
@Override public List<Hospede> Buscar(Hospede obj) { String consulta = "select h from Hospede h"; String filtro = ""; HashMap<String, Object> parametros = new HashMap<String, Object>(); if (obj != null) { if (obj.getIdHospede()!= null) { ...
604d9a59-8b60-4661-935e-9ddb2cbf5af9
8
public void actionPerformed(ActionEvent ae) { Command c = ae.getCommand(); int selectedIndex = transactionTable.getSelectedRow(); Log.log("selected index " + selectedIndex); if (c == backCommand) { AccountsWindow accountWindow = new AccountsWindow(); accountWindow...
b3b8080f-8641-4317-b85f-fe99449fbe9c
9
public static Map<String, Object> copyConfigMap(Object obj) { if (obj == null || obj instanceof Map == false) return null; Map<?, ?> map = (Map<?, ?>) obj; Map<String, Object> stringMap = new LinkedHashMap<String, Object>(); for (Entry<?, ?> e : map.entrySet()) { stringMap.put(e.getKey().toStr...
76c291fc-0d1f-4e98-a3c3-467706c0ca2d
1
@Override protected void onPart(String channel, String sender, String login, String hostname) { ChannelEventsListener listener = getChannelEventsListener(channel); if (listener != null) listener.userLeft(sender); }
7dc79128-c480-4af7-8790-4397ffe8a085
7
public void reduce(int siz){ if(siz>len)return; reduced = true; double[] array = new double[siz]; PossibleHand[] result = new PossibleHand[siz]; for(int i=0;i<siz;i++){ array[i] = generator.nextDouble(); } Arrays.sort(array); int index = 0; double aggr = 0.0; for(int i=0;i<len;i++){ aggr+=hand...
36723689-f7ce-4257-bcd4-133a025900a0
7
public static Command getUserInput() { System.out.println("Enter commmand: "); String input = System.console().readLine().toLowerCase(); // FOR DEBUGGING START// TODO:REMOVE WHEN DONE //String input = ""; // FOR DEBUGGING END// TODO:REMOVE WHEN DONE String[] args = input.split(" "); switch (args[0]) ...
5b15ae5d-f3aa-4288-8f17-a50098ba621d
7
private String startSetToString() { StringBuffer FString = new StringBuffer(); boolean didPrint; if (m_starting == null) { return getStartSet(); } for (int i = 0; i < m_starting.length; i++) { didPrint = false; if ((m_hasClass == false) || ((m_hasClass == true) && (i !...
61be16a4-410f-4b99-b9e1-952da659a863
0
public void refreshRoutes() { this.fireTableDataChanged(); }
e1fe9645-818f-4988-ad13-e0cefd39183d
8
public static void get(String name,HttpServletRequest request, HttpServletResponse response) { // lets check if the request is signed String spw = request.getParameter("spw"); if (spw==null || spw.equals("")) { response.setContentType("text/xml; charset=UTF-8"); response.setStatus(410); return; } tr...
f9196385-4b69-4bde-bd30-828bab83e37d
5
public static boolean collision(Board board, FallingBlock fallingBlock, Action action) { switch (action) { case MOVE_LEFT: return checkSide(board, fallingBlock, Side.LEFT); case MOVE_RIGHT: return checkSide(board, fallingBlock, Side.RIGHT); cas...
75d1ead9-1cdc-41ec-8d5e-9db4f3600028
5
public static boolean openFile(File file) { BufferedReader input = null; try { input = new BufferedReader(new FileReader(file)); } catch (Exception e) { e.printStackTrace(); System.err.println("Unable to open file "+file.getPath()); } try { String line = input.readLine(); double version = D...
289b1e42-43fe-41d0-a636-2876820a19ba
7
@Override public void run() { try { if((parameters.length()==0)||(parameters.equalsIgnoreCase("STATUS"))) req.sendMsg("[OK "+CMProps.getVar(CMProps.Str.MUDSTATUS)+"]"); else if(parameters.equalsIgnoreCase("PORTS")) req.sendMsg("[OK "+CMProps.getVar(CMProps.Str.MUDPORTS)+"]"); else if(parame...