method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5a094523-38a8-49dd-8050-f80ce79b7025
5
private void createDropTypes(Composite parent) { parent.setLayout(new RowLayout(SWT.VERTICAL)); Button textButton = new Button(parent, SWT.CHECK); textButton.setText("Text Transfer"); textButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button b = (Button)e.wi...
6c4eb383-0d5e-4309-8d57-c4b1eedb5c29
8
protected String getAction(String xml) { if (xml == null) return null; Document document; try { document = DocumentBuilderFactory .newInstance() .newDocumentBuilder() .parse(new ByteArrayInputStream(xml.getBytes())); ...
3f05af4c-d7a2-433c-9622-3bd7d04cbc7e
2
public static int readFileToArray(int[] array, int array_len, String filename) throws IOException { File file = new File(filename); BufferedReader br = new BufferedReader(new FileReader(file)); String line = br.readLine(); int i = 0; while (line != null && i<array_len) { array[i] = Integer.parseInt(line.t...
bc425a58-6ce4-4c74-a5e0-03aad0870681
8
public void gradient(double x[], double g[]) { double f,sq1,sq2,sq3,f1,f2,f3,f4,fac,c1,c2,s1,s2; double theta,x1,x2,x3,x4; double f1d1,f1d2,f1d3; double f2d1,f2d2,f2d3; double f3d1,f3d2,f3d3; double thd1,thd2; if (id_f_to_min == 0) { g[1] = 2.0*x[1]; } else i...
65e7d30b-ec6c-4710-a563-7a5b941e01c9
9
public void run() { long fps = 0; long frames = 0; long updateTimer = 0; long framesPerSecondTimer = 0; long timestamp = 0; long sleepTime = 0; firstGame = true; long t1=0; while(true) { System.out.print(""); if(menu) continue; if(!initialized) { if(!firstGame) { re...
5b8b124b-b290-4612-a65c-9440762d575e
3
void AppendTable() { responseContent.append("<html>\n" + "<head>\n" + "<title></title>\n" + "<body>\n" + "<h3> Total requests number: " + controller.getCount() + "</h3>" + "<h3> Number of the unique requests: " + controller.get...
14233bfc-aa7e-40fd-911f-b273f345cd67
3
public void lookForUpdates() { System.out.println("Searching for updates ...."); String cmds[] = checkForNewVersion(); if (cmds.length > 1) { System.out.println("New version found : " + cmds[0]); System.out.println("Downloading FabFileBot.jar ..."); String loadPath = settings.get("updateServer", defaultB...
e4796b8d-239a-4099-b50e-5aa9399adcce
7
private void adminGeneral(){ userList = new JList(); userList.setBackground(Color.white); updateuserList(); JScrollPane scroll= new JScrollPane(userList); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scroll.setViewportView(userList); s...
6215355f-09c8-421f-a72b-b099f0da3dc6
2
private Map<String, Object> getDefaultFileProperties() { Map<String, Object> properties = new HashMap<String, Object>(); if (repositoryType == REP_TYPE_ALFRESCO) { properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:loc:readiness,P:notification:notified"); ...
0ec881b2-485a-4ffd-8480-cf1209287c7e
2
private void makeBehaviorCache(CtMember.Cache cache) { List list = getClassFile2().getMethods(); int n = list.size(); for (int i = 0; i < n; ++i) { MethodInfo minfo = (MethodInfo)list.get(i); if (minfo.isMethod()) { CtMethod newMethod = new CtMethod(minfo,...
c2f995f9-9d16-4ddf-a995-ee394ca85eaa
6
public String searchImage(int rawId, int action) { int Action=action/32;//0-3 int Direction=(action/4)%8; int FrameId=action%4; if(Action==0){ int newActionId=this.generateActionId(0, Direction, 1); return image_table.get(this.processID(rawId)).get(newActionId); } if(Action==1){ return image_table....
261ac962-0f7c-4ed3-886c-c56676652fd6
6
public boolean inInterval(double value) { boolean returnValue = true; if(boundLeft <= value && value <= boundRight) { if(isOpenedLeft && value == boundLeft) returnValue = false; if(isOpenedRight && value == boundRight) returnValue = fal...
b3564ecd-9722-4841-8046-8789aaf1922e
4
@Override public void deserialize(Buffer buf) { worldX = buf.readShort(); if (worldX < -255 || worldX > 255) throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"); worldY = buf.readShor...
e086509f-a48c-4bf3-aece-f5e76197426e
1
public void testWithField3() { TimeOfDay test = new TimeOfDay(10, 20, 30, 40); try { test.withField(DateTimeFieldType.dayOfMonth(), 6); fail(); } catch (IllegalArgumentException ex) {} }
cd99d7db-9779-499c-88bc-20d0a63b668c
2
public void testPropertySetMonthOfYear() { DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0); DateTime copy = test.monthOfYear().setCopy(12); assertEquals("2004-06-09T00:00:00.000+01:00", test.toString()); assertEquals("2004-12-09T00:00:00.000Z", copy.toString()); tes...
4995be0b-c258-449f-9416-8e5499917736
0
public String getMatch() {return match;}
9b818798-7f21-44db-a7f8-719445917dc8
7
private JPanel createIconDialogBox() { JButton showItButton = null; final int numButtons = 6; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); final String plainCommand = "plain"; final String infoCommand = "info"; final String questionCommand = "q...
eeb879ef-7fd5-40b5-866d-29b8828a55d4
7
public static String doubleToString(double d) { if(Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if(string.indexOf('.') > 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) { while...
50a885a0-7c6a-4bd2-b337-059323ff098f
3
void setExampleWidgetState () { super.setExampleWidgetState (); if (!instance.startup) { setWidgetMinimum (); setWidgetMaximum (); setWidgetSelection (); } Widget [] widgets = getExampleWidgets (); if (widgets.length != 0) { if (orientationButtons) { horizontalButton.setSelection ((widgets [0]...
e15abf51-4db0-4b71-8abb-c1b4453fbd73
6
private boolean userIsStillAbleToWin(Card userCard) { if (cardStack.size() > 0) { return true; } int userCardValue = userCard.getValue(); int cardValue; int diff; for (int i = 0; i < NUMBER_OF_ROWS; i++) { for (int j = 0; j < NUMBER_OF_COLS; j++) { if (cards[i][j] != null) { cardValue = car...
b4de9db4-2663-4e63-b18e-01d3a7184f0b
3
public String needlessReplacement(String s){ List<Character> list = new ArrayList<Character>(); for(int i=0; i<s.length(); i++){ if(s.charAt(i) == ' '){ list.add('%'); list.add('2'); list.add('0'); } else{ list.add(s.charAt(i)); }...
5db6ca68-9614-4b72-968e-bc3cd95f5a00
6
public static void main(String args) { /* Если аргументы отсутствуют, порт принимает значение поумолчанию */ int port = 20143; /* Создаем серверный сокет на полученном порту */ ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(port); Service.WriteLog...
224473fa-8a4a-49e9-a6f9-b9ba9d352742
5
public static String ccase(String str)//for capitalized each word(title) { mystr=""; boolean status=true; for(int k=0;k<str.length();k++) { my=str.charAt(k)+""; if(status==true) mystr=mystr+my.toUpperCase(); else mystr=mystr+my.toLowerCase(); if(str.charAt(k)==32 || str.charAt(k)==9 || str.charAt(k...
2c092383-b104-4e08-8480-7fddaf7729f0
3
public void loadSupplier(){ supplierDataAccessor dataAccessObject=new supplierDataAccessor(); List<supplier> supList=new ArrayList(); DefaultTableModel patientDataTable=new DefaultTableModel(); Object[ ] columnNames=new Object[5]; Object[ ] fieldValues=new Object[5]; ...
5ea6c164-1222-494f-bf41-6529fddb8ba6
5
private void openWebPage(String urlName) { try { URL u = new URL(urlName); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) desktop.browse(u.toURI()); } catch (IOException e) { e.printStackTrace(); } ca...
fccceeb2-e801-4141-858a-f1221b9a484b
5
public static int partition (int[] array, int start, int end) { int pValue = array[start]; while (start < end) { while (start < end && array[end] >= pValue) { end--; } array[start] = array[end]; while (start < end && array[start] <= pValue) { start++; } array[end] = array[start]; } ...
8f9eee4b-b3ad-477d-a18c-070424b50132
0
public void actionPerformed(ActionEvent event) { Date now = new Date(); System.out.println("At the tone, the time is " + now); Toolkit.getDefaultToolkit().beep(); }
9dabc0e8-84f5-4fc5-988d-d65a34de1345
7
@Override @SuppressWarnings("UnnecessaryReturnStatement") public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { switch (evt.getPropertyName()) { case "value": { throw new PropertyVetoException("cannot set value directly", evt); } case "components": { ...
76953371-2927-4752-b81f-840d97fe4d0b
2
@Override public boolean reachesDestination(Packet p) { // TODO Auto-generated method stub Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator(); EdgeBetEtt e; while(edgeIt.hasNext()){ e = (EdgeBetEtt) edgeIt.next(); if(e.endNode.equals(p.destination)){ etxLink = e.getEtx(); } } d...
e8f4a829-193d-47e5-b7d8-22c282d4827a
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
2e2262a6-e23f-4c5d-94cd-92c7673608a2
8
String getDrawType() { switch (drawType) { case Mesh.DRAW_MULTIPLE: return "multiple"; case Mesh.DRAW_ARROW: return "arrow"; case Mesh.DRAW_CIRCLE: return "circle"; case Mesh.DRAW_CURVE: return "curve"; case Mesh.DRAW_POINT: return "point"; case Mesh.DRAW_LINE: return "line"; case Mesh...
a3c3578f-dd89-45d6-8acc-7b84bec284c6
3
private double influenceConverter(int magnitude) { double convertedMagnitude; if (magnitude == Relationship.HIGH) convertedMagnitude = 1.0; else if (magnitude == Relationship.MEDIUM) convertedMagnitude = 0.5; else if (magnitude == Relationship.LOW) ...
a11ebbbe-b953-4ed4-b951-70722e94eca6
2
@Override public void drawSprite(SpriteSheet sheet, int index, double startX, double startY, double endX, double endY, double transparency, boolean flipX, boolean flipY, Color color) { double texMinX = ((double) sheet.getStartX(index) / ((double) sheet .getSheet().getWidth())); double texMinY = ((double)...
46abf3ce-db60-410c-aadc-1dea76501f98
9
public boolean UnlockAll(int xid) { // if any parameter is invalid, then return false if (xid < 0) { return false; } TrxnObj trxnQueryObj = new TrxnObj(xid, "", -1); // Only used in elements() call below. synchronized (this.lockTable) { Vector vect = t...
d3bbdaa7-5a26-46c5-8488-eb304d8a8087
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResponseMessage other = (ResponseMessage) obj; if (_correlationId == null) { if (other._correlationId != null) return false; } else if (...
4d4746a4-45b5-4a37-99e1-87c5ae899dd4
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
9c031943-e6b4-4a0f-956c-0e2b41a32d91
4
public void left(float a) { for (float i = 0; i < a; i++) { if (!this.touchRobotRotate()) { this.rotateRobot(-1); if (this.checkTouchBullet()) { this.onHitByBullet(); return; } ...
5f6bedfe-bf1f-4005-aa82-bad1b866043a
6
@Override public boolean deleteChild(Condition<?> n) { if (!(n instanceof BinaryBooleanOperator)) { return false; } if (children.get(0).equals(n))//left { children.set(0, ((Condition<?>) (n.randomChild()))); } else if (children.get(1).equals(n))//right...
d821001b-1b79-4a8b-9a0f-1cb0494f096a
7
public Problem validate(final Object instance, final AllowOnly annotation, final Object target, final CharSequence value) { if (value == null || value.length() < 1) { if (annotation.required()) { return new Problem(instance, annotation, target, value); } return null; } /* ...
093bdb1f-66a1-40df-9e96-15bc31b8bba8
4
public void afficher(){ for(int elem : tabMarq){ // On affiche d'abord les biens placés if(elem == 1) System.out.print("☻"); } for(int elem : tabMarq){ // On affiche les mal placés if(elem == 2) System.out.print("☺"); } ...
6a531d0b-0247-484f-a8b3-4df1d31531b8
2
private void enableMetrics() { if(config.getBoolean("Metrics.enabled")) { try { console.sendMessage(pre + "§aMetrics starting!"); new Metrics(this).start(); console.sendMessage(pre + "§aMetrics started!"); } catch(IOException e) { console.sendMessage(pre + "§cMetrics did not start!"); } ...
7316b646-59c8-4815-bbd4-182b76dce2ef
0
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }
095ad7d2-1464-4b5c-9840-07932248c0d0
4
@Override public void doCommand() { // if the player can afford the update of the tower we do nothing if (tower.getOwner().getBank().getMoney() < tower.getUpgradePrice()) { System.out.println("The player is too poor to update the tower !"); return; } if (tower instanceof GunTower) { System.out.p...
03ebf1f4-1ba1-4df5-b8e1-f92d61de25dc
5
protected AlberoBin<T> cercaNodo(T x) { if (coll == null) return null; AlberoBin<T> curr = coll; while (!curr.val().equals(x)) { if (curr.val().compareTo(x) < 0) { if (curr.des() == null) return curr; curr = curr.des(); } else { if (curr.sin() == null) return curr; curr = curr.sin(); } ...
1acf052d-cfc5-4628-80ab-f18546e19799
2
public void set(EmpresaBean oEmpresaBean) throws Exception { try { oMysql.conexion(enumTipoConexion); oMysql.initTrans(); if (oEmpresaBean.getId() == 0) { oEmpresaBean.setId(oMysql.insertOne("empresa")); } UsuarioDao oUsuarioDao = new ...
531a5f68-7684-4fb1-94e7-9748b64f1892
6
@Override public void run(int interfaceId, int componentId) { switch (stage) { case -1: stage = 0; sendEntityDialogue(Dialogue.SEND_1_TEXT_CHAT, new String[] { player.getDisplayName(), "Hello, Ozan. I'm new here. Please guide me?" }, IS_PLAYER, player.getIndex(), 9827); break; case 0: ...
7d17022d-58b6-4b09-967b-10c72ca404cc
5
static String bestimmeRichtung(Item kuchen, String richtigeRichtung, String[] moeglicheRichtungen) { if(kuchen == Item.UKuchen || kuchen == Item.IKuchen) { return richtigeRichtung; } if(kuchen == Item.UGiftkuchen || kuchen == Item.IGiftkuchen) { List<String> richtungen = new ArrayList<String>( ...
80d1d0c0-5fe8-4c4a-916d-564c468c17b4
4
public static String promptStaffStatus(){ Scanner myKey = new Scanner(System.in); String status = null; boolean successful = false; do{ System.out.println("What is the status of this StaffMember?\nPress 1 Permanent\nPress 2 for Temporary\nPress 3 Other\n"); int userEntryStatus = myKey.nextInt(); switc...
4f8722e4-7555-40bf-97e3-56a7d1bdf0cf
0
@Override public void destroy() { myProcess.destroy(); }
33736c08-9507-41e0-a07f-38ac324db763
2
public void AddStartMenuElement() { if (elementStart != null) return; elementStart = APXUtils.addResource("start_" + scrUniq, scrName, scrTooltip, scrHotkey, scrIcon, APXUtils.scriptRootNew, new MenuElemetUseListener(new String(filename)) { @Override public void use(int button) { if (info...
fa90d792-af02-4d7e-824e-8480f640ce3e
3
public boolean saveUpdateSubProcess() { try { String subProcessName = txtSubProcessName.getText(); int minTime = Integer.parseInt(txtMinTime.getText()); int idealTime = Integer.parseInt(txtIdealTime.getText()); int maxTime = Integer.parseInt(txtMaxTime.getText()); if (subProcess == null) { subProc...
e8dff447-236f-47b8-86e2-9024cbd28ae6
4
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) public void bucketEmpty(PlayerBucketEmptyEvent pbee) { Material bucket = pbee.getBucket(); if (Material.LAVA_BUCKET == bucket) { Block block = pbee.getBlockClicked(); BlockFace face = pbee.getBlockFace(); ...
09e9f906-3715-4363-b105-9b1587005f7d
1
public int newUTF8(final String value) { key.set(UTF8, value, null, null); Item result = get(key); if (result == null) { pool.putByte(UTF8).putUTF8(value); result = new Item(index++, key); put(result); } return result.index; }
c9593e98-2305-42c4-8498-5ec91b1b7ae9
5
public String formatCriteria(){ String formattedCriteria; switch(operand){ case RIGHTLIKE: formattedCriteria = "`" + field + "` like '" + value + "%' " ; break; case LEFTLIKE: formattedCriteria = "`" + field + "` like '...
1c252545-0cf3-4118-9f29-78da6151a759
4
private void readParameterAnnotations(int v, final String desc, final char[] buf, final boolean visible, final MethodVisitor mv) { int i; int n = b[v++] & 0xFF; // workaround for a bug in javac (javac compiler generates a parameter // annotation array whose size is equal to the number of parameters in // t...
d103cd9b-f4a0-4558-9d77-fdbf97bbd451
3
private void numberStart() { startTokenPos = pos; while (pos < numRead) { if (isDelimiter(buf[pos])) { break; } pos++; } if (pos < numRead) { // push the number stack.push(Float.parseFloat(new String(buf, startTo...
5a327aa3-cfe0-4044-93fd-1ff13a50f2dd
6
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onExplode(final EntityExplodeEvent event) { final Location loc = event.getLocation(); if (Variables.prevent_block_damage) { for (final Location location : locations) { if (location.getX() =...
b500e568-de8c-4334-a112-2badaf07f6e3
3
private synchronized void winner (String v) throws JMSException { QueueConnection qc =null; QueueSession qs =null; ///prova mess try { qc = qcf.createQueueConnection(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { qs = qc.createQueue...
2b316a87-7d94-4820-b9fc-8f86c5c02bd6
9
public static void main(String[] args) { for(int i=0; i<10; i++){ if(i==2 || i==4){ System.out.println("Now i = " + i); }else{ System.out.println("Value of i : " + i); } } for(int i=10; i>=0; i--){ if(i!=0){ System.out.println("i is NOT equal to 0, value of i : " + i); }else{ Sys...
94a67508-bc69-4470-8ca0-683ed79785b6
7
public Symbol parse() throws java.lang.Exception { /* the current action code */ int act; /* the Symbol/stack element returned by a reduce */ Symbol lhs_sym = null; /* information about production being reduced with */ short handle_size, lhs_sym_num; /* set up direct ref...
46f3ef58-b2e8-40b6-96cf-5b1e3613e5a0
8
final boolean method733(int i, int i_11_, int i_12_, int i_13_) { int i_14_; int i_15_; int i_16_; if (!aBoolean1223) { i_14_ = anInt1225 - i; i_15_ = anInt1216 - i_11_; i_16_ = anInt1229 - i_12_; ((Class72) this).anInt1232 = (int) Math.sqrt((double) (i_14_ * i_14_ + i_15_ * i_15_ + i...
a18e25de-ef09-441e-a3d7-6e48a05b4442
4
public void setBorderStyle(Side side, Border style) { switch (side) { case TOP: topBorder = new Border(style); break; case LEFT: leftBorder = new Border(style); break; case BOTTOM: bot...
899ab8aa-6ccd-47fe-9d32-28730cef22be
1
public void clearInformations() { for (Iterator<String> e = informations.iterator(); e.hasNext();) { data.setUse((String) e.next(), false); } informations.clear(); notifyZElement(); }
8ddcd7a8-ce9d-4058-add6-148075b4e159
4
@Override public boolean equals(Object ob) { if(ob instanceof Genotipo) { Genotipo g = (Genotipo)ob; if(g.numGenes!=this.numGenes) { return false; } for(int i=0; i<this.numGenes; i++) { if(this.getGen(i)!=g.getGen(i)) { ...
56817054-8c56-430b-aaaa-cdb7abe6eb49
9
@Override public void mousePressed(MouseEvent event) { if (!this.mainGUI.isDraggingFiguresEnabled()) { return; } int x = event.getPoint().x; int y = event.getPoint().y; for (int i = this.guiFigures.size()-1; i >= 0; i--) { FigureGUI f...
5395c1a2-24a9-41db-872f-783075694c52
6
public void testPerms(CommandSender sender, String[] args) { if (args.length == 1) { sender.sendMessage(pre + red + "Must specify permission and player!"); return; } if (args.length == 2) { if (sender.hasPermission(args[1])) { sender.sendMess...
ef9753f2-4e81-4fce-9cac-a0e053e35591
6
private static void shortestRep(String line) { String shortestRep = ""; int i = 1; int length = line.length(); if(length == 0) System.out.println("0"); else if(length == 1) System.out.println("1"); else{ shortestRep += line.charAt(0); while(i<length){ if(shortestRep.charAt(0) == line.charAt(...
295637a5-77de-4d52-b72d-a019b0248c08
0
public SqliteWriter(String databaseName, String tableName) { this.databaseName = databaseName; this.tableName = tableName; }
8ba818c7-f299-4c41-b821-a6737ff869f0
7
private static final int getOpenBraceCount(RSyntaxDocument doc) { int openCount = 0; Element root = doc.getDefaultRootElement(); int lineCount = root.getElementCount(); for (int i=0; i<lineCount; i++) { Token t = doc.getTokenListForLine(i); while (t!=null && t.isPaintable()) { if (t.type==Token...
1128225e-15bf-4d8c-82bb-581ccd70e488
2
public void exibir(String num){ String res = null; for(int i = 0; i < telefonesBR.size(); i++){ if( telefonesBR.get(i).equals(num)){ res = telefonesBR.get(i); } } System.out.println("(55)"+res.substring(0, 4)+"-"+res.substring(4, 8)); }
bc53af94-571b-4012-877c-3cab3a63d8b2
6
public void checkAllowedWay(){ for(int i = 0; i < currentNode.listOut.size() ; i++ ){ boolean inRoute; int j = 0; inRoute = false; int currentNodeID = currentNode .listOut .get(i) .getFinishGNode() ...
1b6cb2c2-c2e4-43f0-94ed-7db88a269dfa
5
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) { int var8 = var3.getBlockId(var4, var5, var6); int var9 = var3.getBlockId(var4, var5 + 1, var6); if((var7 == 0 || var9 != 0 || var8 != Block.grass.blockID) && var8 != Block.dirt.blockID) { ...
82e3fe86-0a8e-4823-b756-c303b68f4337
0
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed programmerThread.stop(); lastPane = programmerFrame; hidePanels(lastPane); }//GEN-LAST:event_jButton10ActionPerformed
a411f814-e7eb-4c6d-9d14-c8b329337328
9
public static Method getAsMethodOfPublicBase(Class c, Method m){ for(Class iface : c.getInterfaces()) { for(Method im : iface.getMethods()) { if(im.getName().equals(m.getName()) && Arrays.equals(m.getParameterTypes(), im.getParameterTypes())) { return im; } } } Class sc = c.getSupercl...
9148f18d-d7ab-4179-b551-12a68330b47e
4
public void validateFile() throws FileNotFoundException, IOException, InvalidPropertiesFormatException { String extension = fileForValidationPath.substring(fileForValidationPath.lastIndexOf(".") + 1); if(!extension.equals(ALLOWED_EXTENSION)) throw new FileSystemException("Invalid file extension\n" + "Onl...
9862074f-0cec-4b71-b99a-bf57b71ea451
8
static void ProcessWorkload(String filename, WeightedGraph g){ String t = null; int blocked = 0; float time = 0; int passed = 0; int total = 0; int totalHoc = 0; int totalprob = 0; try{ FileInputStream tempfile = new FileInputStream(filename); DataInputStre...
a06ce9ae-5001-4ce4-aa00-474f30a57ca6
3
public void setPersonDeletionPercentage(double perCent){ this.personDeletionPercentage = perCent; this.personDeletionPercentageSet = true; if(this.itemDeletionPercentageSet && this.replacementOptionSet){ this.allNoResponseOptionsSet = true; if(this.dataEntered){ ...
81b23aaf-fd4f-417b-8f6d-60e6f0e8376f
4
public static String recognizeConfiguration(String cfgPath) { for(String t : registeredGameTypes.keySet()) { try{ Game g = getGameFactory(t).buildGame(cfgPath); if(g.validate() && !g.usesInternalBoard()) { return t; } }catch(Exception ex) {} } return null; }
de11cecc-e576-4200-bb3c-f666a66633bf
9
public static void main(String[] args) { //declaração de variáveis int i, j, k, rep = 0, temp, tamA = 10, tamB = 6, tamC = 16; int[] listaA = {2, -5, -121, 102, -35, -2, 0, -125, 802, -10}, listaB = {6, 99, -1, 12, 102, -2}, listaC = new int[tamC]; //unir os arrays ...
8bd86daa-b994-443f-8676-1ba1e5ccc2e4
9
@Override protected void done() { try { model = (MarketTableModel) get(); jTableMarketPrice.setModel(model); sorter = new TableRowSorter<>(model); jTableMarketPrice.setRowSorter(sorter); TableColumnModel columnModel = jT...
fe233963-7e02-4dab-9796-bdf0328a0894
0
public void putRawFile(File file) throws InterruptedException { queue.put(file); LOG.info(StringUtil.concatenateStrings( "A new entity was successfully added to Raw Entity Store. Total size of store now is - ", new Integer( queue.size()).toString())); // LOG.info("Failed to put a new entity to the Raw E...
0eba1897-5160-4504-9b5e-13362a1754bd
1
public SearchResponse(String request, WordIndex wordIndex) { this.request = request; this.wordIndex = wordIndex; try { tryCreateAmbits(); } catch (IOException e) { e.printStackTrace(); } }
fcd6fb15-4c94-4cc8-a617-63713606c6dd
9
private GamePiece alphaBetaDestroy(GameBoard board, Team other){ GamePiece destroy = null; //piece to destroy Team cloneOther = new Team(other); ArrayList<GamePiece> canBeDestroyed = board.getAllDestroyable(cloneOther); for(GamePiece p : canBeDestroyed){ if (!board.setupMode) { //move phase GameBo...
885b8b65-212c-4ba7-824e-e66d78f0b7fe
7
public Object invoke(final Map<String, ?> context) throws EvalError { final NameSpace nameSpace = new NameSpace(_interpreter.getClassManager(), "BeanshellExecutable"); nameSpace.setParent(_interpreter.getNameSpace()); final BshMethod method = new BshMethod(_method.getName(), _method.getReturnType(), _method.getPa...
da66e40e-18ad-4da5-9f6d-865dfb95a84b
1
public void layoutContainer(Container parent) { preferredLayoutSize(parent); // sets left, right Component[] components = parent.getComponents(); Insets insets = parent.getInsets(); int xcenter = insets.left + left; int y = insets.top; for (int i = 0; i < components.length; i += 2...
35db7e12-6c68-4aa4-9452-70f4f672cb1e
1
@Override public List<Integer> delete(Criteria criteria, GenericDeleteQuery deleteGeneric, Connection conn) throws DaoQueryException { List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(DELETE_QUERY); String queryStr = new QueryMapper() { @Override ...
4b1ef534-8814-49af-a34e-96aa63485948
0
public AlgorithmParametersType getAlgorithmParameters() { return algorithmParameters; }
6d466e81-532f-4cec-aaff-aaf518c7e434
8
public void setGameboard(Gameboard gameboard) { Field[][] fields = gameboard.getFields(); if (DEBUG) { System.out.println("\n---- turn " + turn++ +"--------"); printFields(fields); } //reset destination information, "direction" variable remembers the last state distToDest = distToDestX = distToDest...
61d85dfc-848b-451a-832f-c2b3f30a0076
1
public void pokemonExperience() { expGain = experienceGain(); GameFile.pokemonExp[0] = GameFile.pokemonExp[0] + expGain; while (GameFile.pokemonExp[0] >= expReq) { GameFile.pokemonLevels[0] = GameFile.pokemonLevels[0] + 1; } }
46e29d36-6377-4d90-b0f8-8a97304f4250
9
public int tryHit(Coordinate c) { // Ensure coordinates are within grid if (c.x < 0 || c.y < 0 || c.x >= 10 || c.y >= 10) { return -1; // Invalid coordinates } // Ensure board hasn't been shot at these coordinates if (boardHits[c.x][c.y] == null) { // Ite...
67a073b6-1974-49c3-b377-960055a7b9f6
5
protected void extract_pvalue_list(ArrayList<String> argv) { ArrayList<Double> pvalues_tmp = new ArrayList<Double>(); try { while (!argv.isEmpty()) { pvalues_tmp.add(Double.valueOf(argv.get(0))); argv.remove(0); } } catch (NumberFormatException e) { } if (IOExtensions.h...
a2d5a342-938e-4c2d-8f2b-b467998c0866
9
public int[] kmeans(double[] data, double dataMin, double dataMax, int max_itr) {//kϖ@Bef[^_ŏɑNX^̃CfbNXlƂϔzԂB int size = data.length; int[] cluster = new int[size]; //NX^S double[] centers = new double[clusterMax]; for (int k=0; k<clusterMax; k++) { centers[k] = dataMin + (dataMax - dataMin)*Math.rando...
2f521c16-0cd4-4e75-8a4f-e8a26d289788
9
public static void sort3(int x) throws FileNotFoundException, IOException { RandomAccessFile a = new RandomAccessFile("C:/Users/Tom/Documents/Code/Java/Ticks/1B/tick 0/test-suite/test"+x+"a.dat","rw"); RandomAccessFile a2 = new RandomAccessFile("C:/Users/Tom/Documents/Code/Java/Ticks/1B/tick 0/test-suite/test"+x+"a...
622d6733-3367-4fc4-820d-5a3523639463
0
public static void writePCData(StringBuffer buf, String text) { buf.append(escapeXMLText(text)); }
4232f7a9-77ae-4000-8e85-d31d7a4b5d01
4
public static String Md5(String plainText) { StringBuilder sb = new StringBuilder(); try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; for (int offset = 0; offset < b.le...
3f3c6a1c-aa07-4893-8f75-698b413fc9a5
7
private void moveChicken() { if (model.getChicken().isMoveRight()) { //Is the user attempting to move the chicken outside the right boundary? if (model.getChicken().getLocation().x >= Constants.FRAME_WIDTH - view.getChickenImage().getWidth(null)) { model.getChicken().setMoveRight(false); return; } ...
b9170693-e2a7-4ae0-bb3a-f7e095f5bd58
1
public Integer call() throws InterruptedException { int sum = 0; for (int i = 0; i < 100000; i++) { sum += i; } System.out.println(numberOfThread); return numberOfThread; }
de5ccdd5-39ee-417d-8247-8f83dc5e9c80
5
public static void unregisterDirectory(File directory) { if ((pathToWatchKey.containsKey(directory.toPath()) && !pathToWatchKey.containsKey(directory.getParentFile().toPath())) || !directory.exists()) { // stop watching this directory WatchKey key = pathToWatchKey.get(directory.toPath())...
61c972c2-4458-4b02-9742-7f72064aa800
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
736ba08e-2883-4768-bb57-9684d6e8b45a
6
public static void displayProgress(Graphics g, GameController gc, ImageLoader il, int x, int y, int progress, String displayText) { int xPos, yPos; int progressWidth; BufferedImage bi; x = x - (PROGRESS_CONTAINER_WIDTH / 2); y = y + PROGRESS_CONTAINER_HEIGHT; ...