method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
642b3c18-6bc5-453e-a2db-c85e09aaed13
3
@Override public void onServerStatusChanged() { ServerStatusController.ServerStatus serverStatus = ServerStatusController.getServerStatus(); switch (serverStatus) { case AVAILABLE: TestInfo testInfo = BmTestManager.getInstance().getTestInfo(); TestInfoController.start(testInfo.getId()); boolean testIsRunning = testInfo.getStatus() == TestStatus.Running; testPanel.enableMainPanelControls(!testIsRunning); Utils.enableElements(cloudPanel, !testPanel.getUserKey().equals(Constants.ENTER_YOUR_USER_KEY) && !testIsRunning); Utils.enableElements(jMeterPropertyPanel, !testIsRunning); break; case NOT_AVAILABLE: testPanel.enableMainPanelControls(false); Utils.enableElements(jMeterPropertyPanel, false); TestInfoController.stop(); break; } }
80e73dff-154c-4cb0-bc93-824acf168d3d
0
public BodyPart(int upgradeCount, UpgradeType type, String name){ this.upgrades = new Upgrade[upgradeCount]; this.type = type; this.name = name; }
a881a28d-7f46-477e-a075-5b60c5e09e93
1
public void testSetWeekOfWeekyear_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setWeekOfWeekyear(53); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
b80fe390-3b78-45d8-a1a9-00b7d21f23a3
2
@Override public void onEnable(){ plugin=this; pointsplugin = new BAPointsPluginManager(this); string = new StringManager(); if(user==null){ user = new BAUserManager(this); } new BukkitRunnable() { @Override public void run() { user.load(); } }.runTaskLater(plugin, 5); getServer().getPluginManager().registerEvents(new PlayerListener(this), this); if(getConfig().getString("CreationVersion")==null){ FileConfiguration c = getConfig(); c.set("CreationVersion", getDescription().getVersion()); c.set("PointsPlugin", "auto-detect"); c.set("SaveDelay", 60*20); saveConfig(); } }
0daa5c96-70fb-4a39-9598-2e41922c56ba
7
private boolean isClassBox(String owner) { if (!owner.startsWith("java/lang/")) { return false; } String className = owner.substring("java/lang/".length()); return (className.equals("Integer") || className.equals("Double") || className.equals("Long") || className.equals("Char") || className.equals("Byte") || className.equals("Boolean")) || className.endsWith("Number"); }
226e0fd3-7548-4246-b240-5df3f1600fdb
0
public static void main(String[] args) { new ConcurrentNAV().timeAndComputeValue(); }
ca0173d8-f8ae-43d0-a262-9783e1be1c97
8
private int findChromosomeID( BPTreeNode thisNode, String chromKey){ int chromID = -1; // until found // search down the tree recursively starting with the root node if(thisNode.isLeaf()) { int nLeaves = thisNode.getItemCount(); for(int index = 0; index < nLeaves; ++index){ BPTreeLeafNodeItem leaf = (BPTreeLeafNodeItem)thisNode.getItem(index); if(leaf == null){ log.error("Error finding B+ tree leaf nodes, corruption suspected"); throw new RuntimeException("Error reading B+ tree leaf nodes, corruption suspected"); } // test chromosome key match if(leaf.chromKeysMatch(chromKey)){ chromID = leaf.getChromID(); break; } // else check next leaf } } else { // check all child nodes int nNodes = thisNode.getItemCount(); for(int index = 0; index < nNodes; ++index){ BPTreeChildNodeItem childItem = (BPTreeChildNodeItem)thisNode.getItem(index); BPTreeNode childNode = childItem.getChildNode(); // check if key is in the node range String lowestKey = childNode.getLowestChromKey(); String highestKey = childNode.getHighestChromKey(); // test name key against key range if(chromKey.compareTo(lowestKey) >= 0 && chromKey.compareTo(highestKey) <= 0) { // keep going until leaf items are checked chromID = findChromosomeID(childNode, chromKey); // check for chromKey match if(chromID >= 0) break; } } } return chromID; }
f221efea-9c4a-4e5c-b44a-851a01aecc90
2
public Trail(Thing body, int length, int freq) { // Initialize a path this.path = new Vector3D[length]; this.body = body; this.freq = freq; for (int i = 0; i < path.length; i++) { path[i] = body.position.clone(); if (body.parent != null) { path[i].subtract(body.parent.position); } } }
fdc50a1d-8e78-4077-806a-22ac6707a4eb
3
private boolean HLIDGenerationTest(Object obj, CycAccess cyc) { try { String cmd = "(compact-hl-external-id-string " + DefaultCycObject.stringApiValue(obj) + ")"; String cycId = cyc.converseString(cmd); String apiId = null; if (obj instanceof String) { apiId = CompactHLIDConverter.converter().toCompactHLId((String) obj); assertTrue(CompactHLIDConverter.converter().isStringCompactHLId(apiId)); } else if (obj instanceof Number) { apiId = CompactHLIDConverter.converter().toCompactHLId((Number) obj); assertTrue(CompactHLIDConverter.converter().isNumberCompactHLId(apiId)); } assertTrue(apiId.equals(cycId)); } catch (Throwable e) { fail(e.toString()); } return true; }
79b6c23d-5daa-4e54-8bfb-518d143b2118
4
public static int getIdByIndex(int index) { int id = -1; if (index >= 0 && index < ChartData.getSize()) { for (Integer itemId : data.keySet()) { if (index == 0) { id = itemId; break; } index--; } } return id; }
9f0ddd55-8a10-46ee-ba3f-ce75dfd28ba3
4
public void add(Component e) { if (selectedOC != null) selectedOC.setSelected(false); selectedOC = null; if (enteredIC != null) enteredIC.setSelected(false); enteredIC = null; if (e instanceof Stub) { if (stubs.size() < 4) stubs.add((Stub) e); else { JOptionPane.showMessageDialog(null, "You can not add more than 4 Stubs!"); return; } } elements.add(e); e.setPanel(this); setSelected(e); changed(); repaint(); // connectablesDialog = null; }
cb3a81b6-8d79-436e-beeb-b6958b08dc6a
0
public void SetPriority(int priority) { //set the priority of the person for the stop this.priority = priority; }
3eaebd08-ca52-4068-a1b5-4aeb03901ce0
0
protected Element createTransitionElement(Document document, Transition transition) { Element te = super.createTransitionElement(document, transition); FSATransition t = (FSATransition) transition; // Add what the label is. te.appendChild(createElement(document, TRANSITION_READ_NAME, null, t .getLabel())); return te; }
2a370fc0-1d56-4af0-9dc4-643f4e391bfe
2
@Override public String toString() { String func = retType + " " + name + "("; int i; if (parameters.size() > 0) { for (i = 0; i < parameters.size() - 1; i++) { func = func + parameters.get(i) + ", "; } func = func + parameters.get(i) + ");"; } else { func = func + ");"; } return func; }
43f02da2-9a8a-4889-beda-b6fb23f666d8
6
public void validate(Evento evento){ if(evento == null || evento.equals("")){ throw new SaveException("Evento não pode ser vazio."); } else if (evento.getNome() == null || evento.getNome().equals("")){ throw new SaveException("Nome do evento não pode ser vazio."); } else { if(evento.getDataEvento() == null || evento.getDataEvento().equals("")){ throw new SaveException("Data do evento não pode ser vazia."); } } }
c43790c0-e39d-467e-9dee-027bbc5dfa39
3
public int posMax() { int MaxValue; //trakcs the maximum value int MaxValPos = -1; //tracks the position of the maximum value if(IntValues.length > 0) //if the sequence is nonempty { MaxValue = IntValues[0]; //initialize the max value as first value MaxValPos = 0; //initialize the position as the first position for(int i = 0; i < IntValues.length; i++) { if(IntValues[i] > MaxValue) //if current value > the value we've stored //as the maximum { MaxValue = IntValues[i]; //set current value to maximum MaxValPos = i; //set current position to maximum }//end if }//end for }//end if return MaxValPos; }//end posMax()
e0def507-f719-4adb-ae08-f556199490ee
6
@Override public final void run() { //Run to clean up any memory leaks we may cause by holding dead tasks if (tasks.isEmpty()) { return; // skip cleaning if there are no tasks } Iterator<Task> taskItr = tasks.keySet().iterator(); while (taskItr.hasNext()) { Task task = taskItr.next(); //Get the task if (tasks.get(task).isDone()) { // Check task for completion try { tasks.get(task).get(); // Test for execution exceptions } catch (CancellationException cex) { // Don't care if it was cancelled } catch (InterruptedException e) { // The task was probably canceled so skip this } catch (ExecutionException eex) { //This is important if an exception was caused in execution, print out the exception immediately task.printError(eex.getCause()); // Call the printError message for the proper Task name rather than the wrapper's name } taskItr.remove(); } } }
eb52321e-c3a1-4713-b40e-baacc62d966d
2
public String getAltsStr() { if (alts == null) return ""; String altsStr = ""; for (String alt : alts) altsStr += alt + " "; return altsStr.trim().replace(' ', ','); }
53fe4a5e-b29c-4c2e-b925-239cdda9aa53
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AbstractEntity other = (AbstractEntity) obj; if (!Objects.equals(this.getUuid(), other.getUuid())) { return false; } return true; }
aedea65f-e68c-4fd5-84a8-fff5a4563828
0
public String getToDate() { return toDate; }
b9ab9885-8abc-4854-bb3f-45cfc6cce126
7
@SuppressWarnings("unchecked") private T back() { boolean back_left = true, back_right = true; Comparable<T> lprev = null, rprev = null; while (true) { if (back_left) if (!left.hasPrev()) return null; else lprev = (Comparable<T>)left.prev(); if (back_right) if (!right.hasPrev()) return null; else rprev = (Comparable<T>)right.prev(); int comp = lprev.compareTo((T)rprev); if (comp == 0) return (T)lprev; else if (comp < 0) // lprev < rprev { back_left = false; back_right = true; } else { back_left = false; back_right = true; } } }
295c53e8-9f06-4fa8-b512-663ed8d45b1a
1
public void setSearch(ArrayList<Product> p) { reset(); if (p.size() > 0) { panel.setVisible(true); btnSil.setVisible(true); btnGuncelle.setVisible(true); Product p2 = p.get(0); textField_1.setText(p2.getpId() + ""); textField_2.setText(p2.getpName()); textField_3.setText(p2.getAmount() + ""); textField_4.setText(p2.getPrice() + ""); textArea.setText(p2.getpFeature()); } else { hata.setText("Sonuç bulunamadı!"); hata.setForeground(Color.red); btnrnEkle.setVisible(true); } }
9bbedbb7-3665-49e7-bc87-0a5169ec75d4
7
public static TobiiEventMap loadTobiiEvent3(File file) throws IOException { CSVReader reader = new CSVReader(new FileReader(file), '\t'); String[] line; // Get header data for this file TobiiHeader header = readHeader(reader); TobiiEventMap eventMap = new TobiiEventMap(header); // Work our way down to the info we care about---timestamped data while( (line = reader.readNext()) != null && !line[0].trim().equalsIgnoreCase("timestamp") ); if(!line[0].trim().equalsIgnoreCase("timestamp")) { throw new IOException("Couldn't find the Timestamp column in Tobii file " + file.getAbsolutePath()); } long initialTimestamp = header.getRecDateTimestamp(); // Read data in about events and their timestamps, until the end of the file int trialId = 0; while( (line = reader.readNext()) != null ) { // Timestamp is reported relative to absolute wallclock timestamp; must add this on long timestamp = Double.valueOf(line[0]).longValue(); timestamp += initialTimestamp; String eventStr = line[1].trim(); String descriptor = line[5].trim(); // Transform Tobii event string into an enum TobiiEventType type = TobiiEventType.parseTobii(eventStr); if(type == null) { System.err.println("Could not understand event type " + eventStr + " in Tobii file " + file.getAbsolutePath()); continue; } // Hacky way to grab the corresponding Trial ID # for Track-It from the filename // of the movie used in Tobii. Basically, every time the experimenter presses the Spacebar, // we assume that a new movie has started (corresponding to Frame 0) if(type == TobiiEventType.KEYPRESS && descriptor.equalsIgnoreCase("Space")) { trialId += 1; System.out.println(descriptor + " found Trial " + trialId); } eventMap.addEvent(type, timestamp, trialId, descriptor); } reader.close(); return eventMap; }
e5ead41d-2abd-4482-ac5d-3043b672ce08
5
@Override public Response handle(JsonElement data) { Response res; Fingerprint fprint = GsonFactory.getGsonInstance().fromJson(data, Fingerprint.class); if (fprint.getLocation() != null && ((Location)fprint.getLocation()).getId() != null && ((Location)fprint.getLocation()).getId().intValue() != -1) { Location l = HomeFactory.getLocationHome().getLocation(((Location)fprint.getLocation()).getId(), null); fprint = new Fingerprint(l,(Measurement)fprint.getMeasurement()); } fprint = fingerprintHome.add(fprint); if(fprint == null) { res = new Response(Status.failed, "could not add to database", null); Log.getLogger().fine("fingerpint could not be added to the database"); } else { res = new Response(Status.ok, null, fprint); Log.getLogger().finer("fingerprint set: " + fprint); Location loc = (Location)fprint.getLocation(); int count = fingerprintHome.getCount(loc); if (count < INSTANT_TRAIN_THREASHOLD) { Log.getLogger().fine("Training model (fp count for loc " + loc.getSymbolicID() + ": " + count); Thread trainer = new Thread(new Runnable() { @Override public void run() { SVMSupport.train(); } }); trainer.start(); } } return res; }
de91861e-4865-4e0f-a553-9cac5189c9d4
2
public void suivant(){ if (indiceRapportVisiteCourant == lesRapportsVisites.size()-1) { indiceRapportVisiteCourant = 0; } else { indiceRapportVisiteCourant = indiceRapportVisiteCourant + 1; } DefaultTableModel model = (DefaultTableModel) this.vue.getjTableOffre().getModel(); while(model.getRowCount() != 0){ model.removeRow(0); } afficherCompteRendu(lesRapportsVisites.get(indiceRapportVisiteCourant)); }
94f4b7c4-5f50-4c70-83f4-d5fd72ed3fc0
3
public Nodo predecessor(Nodo nodo){ if(nodo.getLeft() == null){ return maximo(nodo.getLeft()); } else{ Nodo nodoAux = pai(root, nodo.getKey()); while(nodoAux != null && nodoAux.getLeft() == nodo){ nodo = nodoAux; nodoAux = pai(root, nodoAux.getKey()); } return nodoAux; } }
e336b407-442e-444d-9213-15f0eba712c9
1
private static int charAt(String s, int d) { if (d < s.length()) return s.charAt(d); else return -1; }
5a26626b-5fdd-45fa-b681-03caeb29d52c
6
private final Class348_Sub19_Sub1 method310(int i, int i_5_, byte i_6_, int[] is) { anInt375++; int i_7_ = i ^ (0xfff0 & i_5_ << -2102985404 | i_5_ >>> -313218292); i_7_ |= i_5_ << 1075063824; int i_8_ = -113 / ((i_6_ - 16) / 34); long l = (long) i_7_ ^ 0x100000000L; Class348_Sub19_Sub1 class348_sub19_sub1 = (Class348_Sub19_Sub1) aClass356_381.get(l); if (class348_sub19_sub1 != null) return class348_sub19_sub1; if (is != null && is[0] <= 0) return null; Class348_Sub10 class348_sub10 = (Class348_Sub10) aClass356_374.get(l); if (class348_sub10 == null) { class348_sub10 = Class348_Sub10.method2795(aClass45_377, i_5_, i); if (class348_sub10 == null) return null; aClass356_374.putNode(l, class348_sub10); } class348_sub19_sub1 = class348_sub10.method2791(is); if (class348_sub19_sub1 == null) return null; class348_sub10.removeNode(); aClass356_381.putNode(l, class348_sub19_sub1); return class348_sub19_sub1; }
af7b6c27-74b7-4d5e-856e-73cab9d2c4b9
4
private void rotate() { //orient++; if (orient%4==0) { litPositions=new int[][] {{0,1,0}, {1,1,1}, {0,0,0}}; } if (orient%4==1) { litPositions=new int[][] {{0,1,0}, {0,1,1}, {0,1,0}}; } if (orient%4==2) { litPositions=new int[][] {{0,0,0}, {1,1,1}, {0,1,0}}; } if (orient%4==3) { litPositions=new int[][] {{0,1,0}, {1,1,0}, {0,1,0}}; } }
33da423b-7eb9-419c-b12a-af8d28bc77c2
4
private BackupPeriod getBackupPeriod() { BackupPeriod backupPeriod = BackupPeriod.DISABLED; // Set backupPeriod to default: DISABLED. String backupPeriodString = Controller.getProperty(ApplicationProperties.BACKUP_PERIOD); boolean backupPeriodNull = false; if (backupPeriodString != null && !"".equals(backupPeriodString)) { backupPeriodString = backupPeriodString.toUpperCase(); try { backupPeriod = BackupPeriod.valueOf(backupPeriodString); } catch (IllegalArgumentException ex) { backupPeriodNull = true; } } if (backupPeriodNull) { Controller.setProperty(ApplicationProperties.BACKUP_PERIOD, backupPeriod.toString()); AlertMessages.backupPeriodIllegalArgumentException("BackupBO.getBackupPeriod()", backupPeriodString); } return backupPeriod; }
0ceac0a8-71fb-4d41-a9f2-a90eeb473381
7
public String toString() { String retStr = "\n-----------------------------------------\n"; retStr += " "; for (int i = 1; i < 10; i ++) { retStr += i + " "; if (i % 3 == 0) { retStr += " "; } } for (int i = 0; i < 9; i++) { if ( i % 3 == 0) { retStr += "\n ---------------------------------------"; } retStr += "\n" + converter(i) + " "; for (int n = 0; n < 9; n++) { retStr += "|"; if (_board[i][n] == 0) { retStr += " "; } else { retStr += " " + _board[i][n] + " "; } if ( (n + 1) % 3 == 0) { retStr += "|"; } } } retStr += "\n ---------------------------------------"; return retStr; }
76121b7d-5883-4d27-8051-34a708a71b0e
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if((msg.targetMinor()==CMMsg.TYP_ENTER) &&(msg.target()==this)) { final MOB mob=msg.source(); if((mob.location()!=null)&&(mob.location().roomID().length()>0)) { int direction=-1; for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--) { if(mob.location().getRoomInDir(d)==this) direction=d; } if(direction<0) { mob.tell(L("Some great evil is preventing your movement that way.")); return false; } msg.modify(msg.source(), getAltRoomFrom(mob.location(),direction), msg.tool(), msg.sourceCode(), msg.sourceMessage(), msg.targetCode(), msg.targetMessage(), msg.othersCode(), msg.othersMessage()); } } return true; }
0f9618fd-ccf3-4679-b07b-ccc8a996676b
5
public static Pair<String> splitFirst(String str, String out) { if (str == null || "".equals(str)) { return null; } if (str.length() < out.length()) { return null; } if (str.equalsIgnoreCase(out)) { return new Pair<String>("", ""); } int ind = str.indexOf(out); if (ind == -1) { return null; } return new Pair<String>(str.substring(0, ind), str.substring(ind + out.length())); }
e03caaa3-4d1a-40d9-9702-b38782c0a4a0
6
public double matchAtFrom(int i, int j) { while(j < children.length) { double cur; if (children[j].optional) { PartMatcher incl, excl; Regex.GroupMap inclGroups, tempGroups; tempGroups = new Regex.GroupMap(owner.groups); cur = children[j].matchAt(i + len); incl = new PartMatcher(this); if (cur < 1) { incl.res *= 1 - Math.min(cur, 1); incl.len = len + children[j].getMatchLen(); incl.s.append(children[j].getReplacement()); incl.matchAtFrom(i, j + 1); } else { incl.res = 1; incl.len = 0; } // else excl = new PartMatcher(this); inclGroups = owner.groups; owner.groups = tempGroups; excl.matchAtFrom(i, j + 1); if (incl.res < 1 && incl.res <= excl.res) { res = incl.res; len = incl.len; s.replace(0, s.length(), incl.s.toString()); owner.groups = inclGroups; } else { res = excl.res; len = excl.len; s.replace(0, s.length(), excl.s.toString()); } // else return res; } else { cur = children[j].matchAt(i + len); } // else res *= 1 - Math.min(cur, 1); if (res == 0) { res = 1; len = 0; return res; } // if len += children[j].getMatchLen(); s.append(children[j].getReplacement()); j++; } // while return (res = 1 - Math.pow(res, 1.0 / len)); } // matchAtFrom
65bc0046-fcaf-407f-a696-28ccfd196230
5
public void resolveConflict(Transaction me, Transaction other) { long transferred = 0; ContentionManager otherManager = other.getContentionManager(); for (int attempts = 0; ; attempts++) { long otherPriority = otherManager.getPriority(); long delta = otherPriority - priority; if (delta < 0 || attempts > delta * delta) { transferred = 0; other.abort(); return; } // Unsafe increment, but too expensive to synchronize. if (priority > transferred) { otherManager.setPriority(otherPriority + priority - transferred); transferred = priority; } if (attempts < delta) { sleep(SLEEP_PERIOD); } } }
d3118637-f992-4dc0-88d2-2859b271619a
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just intimidated the enemy!"); return random.nextInt((int) agility) * 4; } return 0; }
91ba104b-631c-4106-9757-3c674f169aee
0
@Override public String getCalle() { return super.getCalle(); }
671d77ac-b56a-4a67-80ac-99ad5e7accad
9
public BufferedImage HistogramSpecification(ImageClass im2){ // Especificacion del histograma con otra imagen de muestra int[] imhisto = this.getAcumulativeValues(); int[] imhisto2 = im2.getAcumulativeValues(); double []imh1 = new double[256]; double []imh2 = new double[256]; for(int i=0;i<256;i++){ imh1[i]=(double)imhisto[i]; imh2[i]=(double)imhisto2[i]; } int[] trans_table = new int[256]; for (int i=0;i<256;i++){ imh1[i]/=img_size; imh2[i]/=im2.img_size; } for (int i=0;i<256;i++){ for (int j=0;j<256;j++){ if (imh1[i] == imh2[j]){ trans_table[i] = j; break; } else if (imh1[i] < imh2[j]){ if(j != 0 && j != 255){ double aux = Math.abs(imh1[i] - imh2[j]); double aux2 = Math.abs(imh1[i] - imh2[j-1]); if(aux < aux2){ trans_table[i] = j; break; } else { trans_table[i] = j-1; break; } } else{ trans_table[i] = j; } } } } return TRANSFORM(pixels, trans_table); }
703ec5d6-7bbd-4808-b670-7e34a2fd059f
8
@Override public void run() { try { // Opening the socket socket = new DatagramSocket(serverUDPPort); /* Registering to the Registry Server */ registerRegistryServer(); getOtherServers(); // Listen to articles and pings byte buffer[] = new byte[1024]; DatagramPacket pkg = new DatagramPacket(buffer, 1024, null, 0); while (!done) { pkg.setLength(1024); socket.receive(pkg); if (pkg.getData()[0] != 'h') { // List of server :) String list = new String(pkg.getData(), pkg.getOffset(), pkg.getLength(), "UTF-8").trim(); System.out.println("Servers list: " + list); parseOtherServersList(list); } else { // Respond with a pong! try { InetAddress registryServerIp; registryServerIp = InetAddress .getByName(registryServerName); DatagramPacket outPkg = new DatagramPacket( pkg.getData(), pkg.getData().length, registryServerIp, pkg.getPort()); socket.send(outPkg); } catch (UnknownHostException e) { System.out.println("Could not send pong"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } socket.close(); } catch (UnknownHostException e) { System.out.println("ERROR unknown host: " + registryServerName); } catch (SocketException e) { System.out .println("ERROR opening the socket with the Registry Server"); return; } catch (IOException e) { System.out.println("ERROR sending UDP package"); } }
21b54a24-46d3-47f3-98cd-85fbf47ed326
3
public void paint(Graphics g) { if (fm == null) { this.font = mcd.getFont(); this.fm = mcd.getFontMetrics(font); } updateSize(); Graphics2D g2d = (Graphics2D) g; g2d.setFont(font); RoundRectangle2D r = new RoundRectangle2D.Double(getX(), getY(), getWidth(), getHeight(), 1, 1); //Rectangle2D r = new Rectangle2D.Double(getX(), getY(), getWidth(), // getHeight()); Line2D l = new Line2D.Double(getX(), 25 + getY(), getWidth() + getX(), getY() + 25); g2d.setColor(Color.white); g2d.fill(r); g2d.setColor(Color.blue); g2d.draw(r); g2d.draw(l); g2d.setColor(Color.black); g2d.drawString(name, getX() + 10, getY() + 15); for (int i = 0; i < sizeInformation(); i++) g2d.drawString((String) (data.getValue(getCodeInformation(i), DictionnaireTable.NAME)), getX() + 10, getY() + 40 + i * (fm.getMaxDescent() + 15)); if (sizeInformation() > 0) { String nom = (String) (data.getValue(getCodeInformation(0), DictionnaireTable.NAME)); l = new Line2D.Double(getX() + 10, 45 + getY(), getX() + fm.stringWidth(nom) + 10, 45 + getY()); g2d.draw(l); } }
49987473-8d1e-4832-8427-3f701a4c8f4f
5
@Override public Object getValueAt(int row, int col) { if (col == 0) { if (panel.isCellEditable(row)) { return TEXT_DELETE; } else { return ""; } } else if (col == 1) { boolean isReadOnly = ((Boolean) readOnly.get(row)).booleanValue(); if (isReadOnly) { return OutlineEditableIndicator.ICON_IS_NOT_PROPERTY; } else { return OutlineEditableIndicator.ICON_IS_PROPERTY; } } else if (col == 2) { return keys.get(row); } else { return values.get(row); } }
b9155e56-a1e9-4207-a40a-b09775806ddb
2
public FieldVisitor visitField( final int access, final String name, final String desc, final String signature, final Object value) { StringBuffer sb = new StringBuffer(); appendAccess(access | ACCESS_FIELD, sb); AttributesImpl att = new AttributesImpl(); att.addAttribute("", "access", "access", "", sb.toString()); att.addAttribute("", "name", "name", "", name); att.addAttribute("", "desc", "desc", "", desc); if (signature != null) { att.addAttribute("", "signature", "signature", "", encode(signature)); } if (value != null) { att.addAttribute("", "value", "value", "", encode(value.toString())); } return new SAXFieldAdapter(getContentHandler(), att); }
c001786a-4dd2-4386-96d9-f4dc9bf858e6
2
public static boolean registerObject(ChunkyObject object) { HashMap<String, ChunkyObject> ids = OBJECTS.get(object.getType()); if (ids == null) { ids = new HashMap<String, ChunkyObject>(); OBJECTS.put(object.getType(), ids); } if (ids.containsKey(object.getId())) return false; ids.put(object.getId(), object); return true; }
6c3d99ff-703a-4d9c-bfb6-febbb319af12
8
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { edits.clear(); langCounts.clear(); for (Text str : values) { try { edits.add(new JSONObject(str.toString())); } catch (JSONException e) { logger.error("Error parsing JSON from mapper in reducer.",e); } } String majLang=""; int majLangCount=0; for (JSONObject json : edits) { String lang; try { lang = json.getString("language"); Integer count = langCounts.get(lang); if (count==null) { count=Integer.valueOf(1); } else { count=Integer.valueOf(count.intValue()+1); } langCounts.put(lang,count); if (count.intValue()>majLangCount) { majLangCount=count.intValue(); majLang=lang; } } catch (JSONException e) { logger.warn("Language key not found",e); } } double avgSize=0; Set<JSONObject> unqEdits = new HashSet<JSONObject>(edits); for (JSONObject edit : unqEdits) { try { String size = edit.getString("lineCount"); avgSize+=Integer.valueOf(size); } catch(Exception e) { e.printStackTrace(); } } avgSize=avgSize/unqEdits.size(); JSONArray json = new JSONArray(unqEdits); outVal.set(json.toString() +"\t"+unqEdits.size() +"\t"+avgSize +"\t"+majLang +"\t"+majLangCount +"\t"+langCounts.size() ); context.write(key, outVal); }
e4d5a9af-c4df-4ec7-941a-366cec83fa23
7
public static Keyword uSignumSpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; Stella_Object mainarg = (proposition.arguments.theArray)[0]; Stella_Object mainargvalue = Logic.argumentBoundTo(mainarg); DimNumberLogicWrapper mainargdim = ((mainargvalue == null) ? ((DimNumberLogicWrapper)(null)) : Units.helpGetDimNumber(mainargvalue)); Stella_Object signumarg = (proposition.arguments.theArray)[1]; Stella_Object signumargvalue = Logic.argumentBoundTo(signumarg); lastmove = lastmove; if (mainargvalue == null) { return (Units.KWD_FAILURE); } else { if (signumargvalue == null) { if (mainargdim != null) { return (Logic.selectProofResult(Logic.bindArgumentToValueP(signumarg, IntegerWrapper.wrapInteger(((DimNumber)(mainargdim.wrapperValue)).signum()), true), false, true)); } else { return (Units.KWD_TERMINAL_FAILURE); } } else { if (Stella_Object.isaP(signumargvalue, Units.SGT_STELLA_INTEGER_WRAPPER) && (mainargdim != null)) { if (((DimNumber)(mainargdim.wrapperValue)).signum() == ((IntegerWrapper)(signumargvalue)).wrapperValue) { { ControlFrame.setFrameTruthValue(frame, Logic.TRUE_TRUTH_VALUE); return (Units.KWD_FINAL_SUCCESS); } } else { { ControlFrame.setFrameTruthValue(frame, Logic.FALSE_TRUTH_VALUE); return (Units.KWD_TERMINAL_FAILURE); } } } else { return (Units.KWD_TERMINAL_FAILURE); } } } } }
bc61cc1b-b013-46cf-87d4-2bdb10319af6
6
public void backToMenu() { int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?"); if(reply == JOptionPane.YES_OPTION) { timer.stop(); reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?"); if(reply == JOptionPane.YES_OPTION) { saveGame(); JOptionPane.showMessageDialog(null, "Puzzle Saved", "Success", JOptionPane.INFORMATION_MESSAGE); MainMenu menu = new MainMenu(1000, 800, user); menu.setSize(1000, 800); menu.setVisible(true); menu.setTitle("CSE360 Sudoku Main Menu"); dispose(); } else { reply = JOptionPane.showConfirmDialog(null, "Would you like to see the solution?"); if(reply == JOptionPane.YES_OPTION) { MainMenu menu = new MainMenu(1000, 800, user); menu.setSize(1000, 800); menu.setVisible(true); menu.setTitle("CSE360 Sudoku Main Menu"); ShowSolution solution; switch(difficulty) { case "Easy": solution = new ShowSolution("easy16x16Solution.txt", "16x16"); solution.setTitle("Easy 16x16 Solution"); break; case "Medium": solution = new ShowSolution("medium16x16Solution.txt", "16x16"); solution.setTitle("Medium 16x16 Solution"); break; case "Hard": solution = new ShowSolution("hard16x16Solution.txt", "16x16"); solution.setTitle("Hard 16x16 Solution"); break; default: solution = new ShowSolution("evil16x16Solution.txt", "16x16"); solution.setTitle("Evil 16x16 Solution"); break; } solution.setSize(700, 700); solution.setVisible(true); solution.setResizable(false); dispose(); } else { MainMenu menu = new MainMenu(1000, 800, user); menu.setSize(1000, 800); menu.setVisible(true); menu.setTitle("CSE360 Sudoku Main Menu"); dispose(); } } } }
4309075c-947b-4257-b833-b1659919629e
0
@Override public void endElement(String uri, String localName, String qName) throws SAXException { System.out.println("==end Element"); }
e0c5c5d2-b2ad-4bdc-a733-d3bd4a6cb99a
0
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Car"); sb.append("{carPhysics=").append(carPhysics); sb.append('}'); return sb.toString(); }
03374046-2523-44cf-ab71-9c25c6c9495c
3
private void doUpdate() { //check so everything is ok if (!Validate.tfEmpty(tfBenamning)) { if (Validate.notOverSize(taBeskrivning) && Validate.notOverSize(tfBenamning)) { updateKompetens(); PanelHelper.cleanPanel(PanelHelper.getMainFrame().getMfRight()); PanelHelper.addContainerToMFRight(new KompetensdomanPanel(), 1); } else { lblError.setText("Beskrivningen och benämningen får inte vara över 255 bokstäver vardera"); lblError.setVisible(true); } } else { lblError.setText("Måste fylla i benämning för att kunna uppdatera."); lblError.setVisible(true); } }
9a62d664-1d39-4cbc-9e5d-7e0c6dfed431
4
@Override public void cook() { Iterator<IFoodMaterial> iFoodMaterialIterator = foodMaterials.iterator(); while (iFoodMaterialIterator.hasNext()) { IFoodMaterial foodMaterial = iFoodMaterialIterator.next(); if ("牛肉".equals(foodMaterial.getName())) { foodMaterial.what(); System.out.println("红烧..."); System.out.println("牛肉用没了"); iFoodMaterialIterator.remove(); break; } } iFoodMaterialIterator = foodMaterials.iterator(); while (iFoodMaterialIterator.hasNext()) { IFoodMaterial foodMaterial = iFoodMaterialIterator.next(); if ("面粉".equals(foodMaterial.getName())) { foodMaterial.what(); System.out.println("和面...擀面...做面条...煮面..."); break; } } System.out.println("将牛肉放到面里..."); System.out.println("牛肉面成功"); }
2e7aa7ac-659a-48f1-b760-7f9cabff3ff1
3
private int pickFruit(int [] platter) { // generate a prefix sum int[] prefixsum = new int[NUM_FRUITS]; prefixsum[0] = platter[0]; for (int i = 1; i != NUM_FRUITS; ++i) prefixsum[i] = prefixsum[i-1] + platter[i]; int currentFruitCount = prefixsum[NUM_FRUITS-1]; // roll a dice [0, currentFruitCount) int rnd = random.nextInt(currentFruitCount); for (int i = 0; i != NUM_FRUITS; ++i) if (rnd < prefixsum[i]) return i; assert false; return -1; }
61268e8f-b2b1-49fe-8487-a0858c1010d3
1
private boolean addImportFormat(String formatName, OpenFileFormat format) { if (isNameUnique(formatName, importerNames)) { format.setName(formatName); importerNames.add(formatName); importers.add(format); // Also add it to the list of formats stored in the preferences Preferences.FILE_FORMATS_IMPORT.add(formatName); return true; } return false; }
e72a7a91-5f0e-4584-b9e1-8f149802d643
3
public Cell selectCellCoord(int x, int y) { for (Cell tempCell : cells) { if (tempCell.x == x && tempCell.y == y) return tempCell; } return null; }
bf7f93b9-1724-4619-94c6-734d1c085034
3
private boolean jj_3_2() { if (jj_scan_token(LEFTB)) return true; if (jj_3R_9()) return true; if (jj_scan_token(RIGHTB)) return true; return false; }
c5ff9c2c-e927-4878-a5ed-6cfc4bf9f618
3
private List<Cluster> getResultingClusters(Map<Node, Color> nodeClusterMapping) { Map<Color,List<Node>> clusters = new HashMap<Color, List<Node>>(); for(Map.Entry<Node, Color> nodesCluster : nodeClusterMapping.entrySet()) { List<Node> clusterNodes = new ArrayList<Node>(); Color cluster = nodesCluster.getValue(); if (clusters.containsKey(cluster)) { clusterNodes = clusters.get(cluster); } clusterNodes.add(nodesCluster.getKey()); clusters.put(cluster, clusterNodes);// update the list. } ArrayList<Cluster> clustersResult = new ArrayList<Cluster>(); for(Map.Entry<Color, List<Node>> clusterNodes:clusters.entrySet()) { String clusterName = clusterNodes.getKey().getColorAsInt().toString(); LabelPropagationCluster cluster = new LabelPropagationCluster(clusterNodes.getValue(), clusterName, clusterNodes.getKey()); clustersResult.add(cluster); } return clustersResult; }
d8391c92-954d-450d-9b7c-fef37e42aab9
1
public static void finish(String message) { try { after = System.currentTimeMillis(); String output = "Completed " + message + NEWLINE; console.append(output); console.append("Operation took: " + (after - before)/1000.0 + " seconds." + NEWLINE); int pos = console.getText().lastIndexOf(output); console.getHighlighter().addHighlight(pos, pos + output.length(), new DefaultHighlighter.DefaultHighlightPainter(GREEN)); scrollToBottom(); } catch (BadLocationException ex) { System.out.println(ex.getMessage()); } }
f3aed21f-dcd8-4d67-914e-c27b5220680c
2
protected DirectoryFileFilter(String baseDir, String excludeDirs) { exclusionList = new ArrayList(); StringTokenizer st = new StringTokenizer(excludeDirs, ","); while (st.hasMoreTokens()) { String token = st.nextToken().trim(); if (token.equals(".")) { exclusionList.add(baseDir); } else { exclusionList.add(baseDir + token); } } }
e8d27134-957d-4b23-bd99-22fe3fb485e1
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((browser == null) ? 0 : browser.hashCode()); result = prime * result + id; result = prime * result + ((operatingSystem == null) ? 0 : operatingSystem.hashCode()); return result; }
a654b491-c01f-4965-90f0-5a5e94152ba5
2
public Matrix4f mul(Matrix4f r) { Matrix4f res = new Matrix4f(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { // @formatter:off res.set(i, j, m[i][0] * r.get(0, j) + m[i][1] * r.get(1, j) + m[i][2] * r.get(2, j) + m[i][3] * r.get(3, j)); // @formatter:on } } return res; }
4d8cc433-fd72-40df-89e0-5b45b0c12b5b
7
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Piece other = (Piece) obj; if (color == null) { if (other.color != null) { return false; } } else if (!color.equals(other.color)) { return false; } if (isKing != other.isKing) { return false; } return true; }
b9cc6b93-1629-4b39-ae54-495e4e862a08
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClass().getClassLoader().getResourceAsStream("SSL/serverstore.jks"), SERVER_KEY_STORE_PASSWORD.toCharArray()); tmf.init(tks); chain = ((X509TrustManager) tmf.getTrustManagers()[0]).getAcceptedIssuers(); } catch (Exception e) { throw new RuntimeException(e); } return chain; }
2e76e956-64f4-4ae2-a867-0fc0a1508fac
7
final void method645(Component component) { javax.sound.sampled.Mixer.Info ainfo[] = AudioSystem.getMixerInfo(); if (ainfo != null) { javax.sound.sampled.Mixer.Info ainfo1[] = ainfo; for (int i = 0; ainfo1.length > i; i++) { javax.sound.sampled.Mixer.Info info = ainfo1[i]; if (info == null) { continue; } String s = info.getName(); if (null != s && s.toLowerCase().indexOf("soundmax") >= 0) { aBoolean3084 = true; } } } anAudioFormat3087 = new AudioFormat(PacketStream.anInt4529, 16, InputStream_Sub1.aBoolean59 ? 2 : 1, true, false); aByteArray3085 = new byte[256 << (InputStream_Sub1.aBoolean59 ? 2 : 1)]; }
49cf17e1-ada9-4d25-a112-5657e00a9da8
5
public AbstractAction getKeyListener(final String move) { return new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent evt) { Coordinate newLocation = null; if (move.toUpperCase().equals("UP")){ newLocation = game.getPlayerLocation().getNorth(); } else if (move.toUpperCase().equals("LEFT")){ newLocation = game.getPlayerLocation().getWest(); } else if (move.toUpperCase().equals("DOWN")){ newLocation = game.getPlayerLocation().getSouth(); } else if (move.toUpperCase().equals("RIGHT")){ newLocation = game.getPlayerLocation().getEast(); } if(game.validMove(newLocation)) { game.moveMouse(newLocation); game.moveCats(); } else { game.playSound(game.SOUND_WALL_BLOCK); } } }; }
1932a71f-53fb-43d8-9dd7-91f081ae7b99
5
public void update(){ checkKeys(); if(score >= highScore){ highScore = score; } for(int row = 0; row < ROWS; row++){ for(int col = 0; col < COLS; col++){ Tile current = board[row][col]; if(current == null) continue; current.update(); resetPosition(current, row, col); if(current.getValue() == 2048){ won = true; } } } }
1ef5f5ba-54fa-4771-a1a5-8d91c1eb705b
8
static final void method3324(AbstractToolkit var_ha, byte i, long l) { do { try { Class122.anInt1803 = 0; FileIndexTracker.anInt4797 = Class313.totalParticals; Class318_Sub1_Sub5.currentParticles = 0; anInt7120++; Class313.totalParticals = 0; long l_1_ = Class62.getCurrentTimeMillis(); Class318_Sub10 class318_sub10 = (Class318_Sub10) Class152.aClass243_2077.method1872(8); if (i > 40) { for (/**/; class318_sub10 != null; class318_sub10 = (Class318_Sub10) Class152.aClass243_2077 .method1878((byte) -64)) { if (class318_sub10.method2535(var_ha, l)) Class318_Sub1_Sub5.currentParticles++; } if (!Class348_Sub16_Sub2.aBoolean8874 || (l % 100L ^ 0xffffffffffffffffL) != -1L) break; System.out.println("Particle system count: " + Class152.aClass243_2077.method1874(0) + ", running: " + Class318_Sub1_Sub5.currentParticles); System.out.println("Emitters: " + Class122.anInt1803 + " Particles: " + Class313.totalParticals + ". Time taken: " + (-l_1_ + Class62.getCurrentTimeMillis()) + "ms"); } } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, ("wm.A(" + (var_ha != null ? "{...}" : "null") + ',' + i + ',' + l + ')')); } break; } while (false); }
dca62014-2cff-435b-901a-d3e8eb71f202
2
@Override public ArrayList<Secteur> getAll() throws DaoException { ArrayList<Secteur> result = new ArrayList<Secteur>(); ResultSet rs; // préparer la requête String requete = "SELECT * FROM SECTEUR"; try { PreparedStatement ps = Jdbc.getInstance().getConnexion().prepareStatement(requete); rs = ps.executeQuery(); // Charger les enregistrements dans la collection while (rs.next()) { Secteur unSecteur = chargerUnEnregistrement(rs); result.add(unSecteur); } } catch (SQLException ex) { throw new modele.dao.DaoException("DaoSecteur::getAll : erreur requete SELECT : " + ex.getMessage()); } return result; }
91575285-bf5d-44e4-b6b7-7cc51c02772c
2
public EditItemInventory(String prodName, String code, double price, int stock, final int id) { setTitle("Edit Item"); setBounds(500, 500, 400, 150); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0}; gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); JLabel lblProductName = new JLabel("Product Name:"); GridBagConstraints gbc_lblProductName = new GridBagConstraints(); gbc_lblProductName.insets = new Insets(0, 0, 5, 5); gbc_lblProductName.gridx = 1; gbc_lblProductName.gridy = 1; add(lblProductName, gbc_lblProductName); txt_pName = new JTextField(); GridBagConstraints gbc_txt_pName = new GridBagConstraints(); gbc_txt_pName.insets = new Insets(0, 0, 5, 0); gbc_txt_pName.fill = GridBagConstraints.HORIZONTAL; gbc_txt_pName.gridx = 3; gbc_txt_pName.gridy = 1; add(txt_pName, gbc_txt_pName); txt_pName.setColumns(10); JLabel lblProductCode = new JLabel("Product Code:"); GridBagConstraints gbc_lblProductCode = new GridBagConstraints(); gbc_lblProductCode.insets = new Insets(0, 0, 5, 5); gbc_lblProductCode.gridx = 1; gbc_lblProductCode.gridy = 3; add(lblProductCode, gbc_lblProductCode); txt_pCode = new JTextField(); GridBagConstraints gbc_txt_pCode = new GridBagConstraints(); gbc_txt_pCode.insets = new Insets(0, 0, 5, 0); gbc_txt_pCode.fill = GridBagConstraints.HORIZONTAL; gbc_txt_pCode.gridx = 3; gbc_txt_pCode.gridy = 3; add(txt_pCode, gbc_txt_pCode); txt_pCode.setColumns(10); JLabel lblProductPrice = new JLabel("Product Price:"); GridBagConstraints gbc_lblProductPrice = new GridBagConstraints(); gbc_lblProductPrice.insets = new Insets(0, 0, 5, 5); gbc_lblProductPrice.gridx = 1; gbc_lblProductPrice.gridy = 5; add(lblProductPrice, gbc_lblProductPrice); txt_pPrice = new JTextField(); GridBagConstraints gbc_txt_pPrice = new GridBagConstraints(); gbc_txt_pPrice.insets = new Insets(0, 0, 5, 0); gbc_txt_pPrice.fill = GridBagConstraints.HORIZONTAL; gbc_txt_pPrice.gridx = 3; gbc_txt_pPrice.gridy = 5; add(txt_pPrice, gbc_txt_pPrice); txt_pPrice.setColumns(10); JLabel lblProductStock = new JLabel("Product Stock:"); GridBagConstraints gbc_lblProductStock = new GridBagConstraints(); gbc_lblProductStock.insets = new Insets(0, 0, 5, 5); gbc_lblProductStock.gridx = 1; gbc_lblProductStock.gridy = 7; add(lblProductStock, gbc_lblProductStock); txt_pStock = new JTextField(); GridBagConstraints gbc_txt_pStock = new GridBagConstraints(); gbc_txt_pStock.insets = new Insets(0, 0, 5, 0); gbc_txt_pStock.fill = GridBagConstraints.HORIZONTAL; gbc_txt_pStock.gridx = 3; gbc_txt_pStock.gridy = 7; add(txt_pStock, gbc_txt_pStock); txt_pStock.setColumns(10); txt_pName.setText(prodName); txt_pCode.setText(code); txt_pPrice.setText(Double.toString(price)); txt_pStock.setText(Integer.toString(stock)); JButton btnSubmit = new JButton("Submit"); btnSubmit.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { try{ String prodName = txt_pName.getText(); String serial = txt_pCode.getText(); double price = Double.parseDouble(txt_pPrice.getText()); int stock = Integer.parseInt(txt_pStock.getText()); Items k = new Items(); k.updateItem(prodName, serial, price, stock, id); txt_pStock.setText(""); txt_pPrice.setText(""); txt_pName.setText(""); txt_pCode.setText(""); dispose(); } catch(Exception e1) { e1.printStackTrace(); } catch (Throwable e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); GridBagConstraints gbc_btnSubmit = new GridBagConstraints(); gbc_btnSubmit.insets = new Insets(0, 0, 5, 0); gbc_btnSubmit.gridx = 3; gbc_btnSubmit.gridy = 9; add(btnSubmit, gbc_btnSubmit); pack(); setVisible(true); }
d621c536-3c44-41f8-a74a-c6424f2f1283
1
public void setHealth(int healt) { if(health <= 0){ this.die(); } this.health = healt; }
12784a92-0e45-4f23-b343-8b601b36dee8
3
public HashMap<String, Epoque> getAllEpoques() { List listeEpoquesXML = racine.getChildren("epoque"); HashMap<String, Epoque> listeEpoques = new HashMap(); Iterator i = listeEpoquesXML.iterator(); while (i.hasNext()) { Epoque ep = new Epoque(); Element courant = (Element) i.next(); ep.setEpoque(courant.getChildText("siecle")); ep.setId(courant.getChildText("id")); ep.setImage(courant.getChildText("image")); ep.setNom(courant.getChildText("nom")); Element bateaux = courant.getChild("bateaux"); Iterator i2 = bateaux.getChildren().iterator(); HashMap<String, Bateau> bateauxHM = new HashMap<>(); while (i2.hasNext()) { Bateau b = new Bateau(); Element courant2 = (Element) i2.next(); b.setNom(courant2.getChildText("nom")); b.setLongueur(Integer.parseInt(courant2.getChildText("longueur"))); b.setPortee(Integer.parseInt(courant2.getChildText("portee"))); Element images = courant2.getChild("images"); Iterator i3 = images.getChildren("image").iterator(); HashMap<Integer, String> imagesL = new HashMap<>(); while (i3.hasNext()) { Element courant3 = (Element) i3.next(); imagesL.put(Integer.parseInt(courant3.getAttributeValue("id")), courant3.getText()); } b.setImagesBateau(imagesL); bateauxHM.put(courant2.getChildText("nom"), b); } ep.setListBateaux(bateauxHM); listeEpoques.put(courant.getChildText("nom"), ep); } return listeEpoques; } // getAllEpoques()
c8f9f7e5-3067-49b9-938f-97618fb8e28f
7
public void enumerate() { effectiveCounter = 0; feasibleCounter = 0; int j = -1; do { if (j >= 0) { cuts[j]--; } long unused = stockLength; int k = -1; for (int i = 0; i < cuts.length; i++) { if (i > j) { long upperBound = unused / lengths[i]; cuts[i] = Math.min(upperBound, demands[i]); } unused -= cuts[i] * lengths[i]; if (cuts[i] > 0) { k = i; } } j = k; if (unused < stockLength) { feasibleCounter++; if (unused < minOrderLength) { effectiveCounter++; } } } while (j >= 0); }
3891c7df-ec25-468b-9012-17667e4f6c24
8
static ContentType interleave(ContentType t1, ContentType t2) { if (t1.isA(ZERO_OR_MORE_ELEMENT_CLASS) && t2.isA(ZERO_OR_MORE_ELEMENT_CLASS)) return INTERLEAVE_ZERO_OR_MORE_ELEMENT_CLASS; if (((t1.isA(MIXED_MODEL) || t1 == TEXT) && t2.isA(ZERO_OR_MORE_ELEMENT_CLASS)) || t1.isA(ZERO_OR_MORE_ELEMENT_CLASS) && (t2.isA(MIXED_MODEL) || t2 == TEXT)) return INTERLEAVE_MIXED_MODEL; return groupOrInterleave(t1, t2); }
aec71dc5-6b4d-4e2d-ba38-1e180d4a8294
1
public void moveTo(Vector2 toTile) { IPathFinder pathFinder = new AStarPathFinder(World.getWorld().getLayerMap()); Path path = pathFinder.getShortestPath(getGridPosition(), toTile); this.considered = ((AStarPathFinder)pathFinder).considered; this.usedPath = ((AStarPathFinder)pathFinder).thePath; if(path != null) Move(path); }
928e673b-7431-43b7-a207-cfeaeafb752e
3
private static boolean handlePossibleMove(Board b, ArrayList<Move> moves, Move m, int opponentColor) { try { if (b.spaceHasOpponent(m.end, opponentColor)) { moves.add(m); return false; } else if (b.spaceIsEmpty(m.end)) { moves.add(m); return true; } return false; } catch (IndexOutOfBoundsException e) { return false; } }
58c18306-5458-44d5-a493-4b595f1fc2b3
3
private int getParamNumberInCommand(String command) { int result = 0; if (command == null) return result; for (int i = 0; i < command.length(); i++) { if (command.substring(i,i+1).equalsIgnoreCase("?")) result++; } return result; }
14e914c6-90cb-445b-b69d-cddeea685482
1
private void setFitness() { for(int i = 0; i < numberOfParticles; i++){ double currentfitness = objectiveFunction.CalculateFitness(position[i]); fitness.put(i, currentfitness); } }
39204fdd-dfdb-4c77-b814-3ca547a6a4a3
1
public boolean end() { return this.eof && !this.usePrevious; }
46bfb00e-8712-4aec-84b8-ae1ee4ba7a94
8
public /*@pure@*/ boolean checkInstance(Instance instance) { if (instance.numAttributes() != numAttributes()) { return false; } for (int i = 0; i < numAttributes(); i++) { if (instance.isMissing(i)) { continue; } else if (attribute(i).isNominal() || attribute(i).isString()) { if (!(Utils.eq(instance.value(i), (double)(int)instance.value(i)))) { return false; } else if (Utils.sm(instance.value(i), 0) || Utils.gr(instance.value(i), attribute(i).numValues())) { return false; } } } return true; }
66dbcbd6-6139-482b-b6ba-78e30a72a48d
2
public static String applyRelativePath(String path, String relativePath) { int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); if (separatorIndex != -1) { String newPath = path.substring(0, separatorIndex); if (!relativePath.startsWith(FOLDER_SEPARATOR)) { newPath += FOLDER_SEPARATOR; } return newPath + relativePath; } else { return relativePath; } }
94a3eacd-40e8-4c9a-bd18-4478d1db46f5
4
public void paintComponent(Graphics g) { switch(status) { case 1: paintBackgroundAndStuff(g); break; case 2: paintBackgroundAndStuff(g); drawContinueArrow(g, image.getWidth() - 200, image.getHeight() - 110); break; case 3: paintBackgroundAndStuff(g); drawOldTutorial(g, this.getSize()); drawContinueArrow(g, image.getWidth() - 200, image.getHeight() - 200); break; } g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12)); g.setColor((status == 3)?Color.BLACK:Color.YELLOW); g.drawString(Configurables.GAME_VERSION, 5, image.getHeight() - 10); }
b0b81920-69eb-48c4-a797-9b2744abcc88
8
public void render(Graphics g){ g.setColor(Color.BLACK); g.setFont(JudokaComponent.bigFont); JudokaComponent.drawTextBox(170, 160, 350, 35, g); g.drawImage(JudokaComponent.judokaMatte, 640, 120, 160, 240, null); g.setColor(Color.BLACK); g.drawString(name, 175, 187); if(timer % 60 < 30 && selectedItem == -1)g.drawRect(175 + name.length() * 21, 165, 1, 27); g.setColor(Color.DARK_GRAY); g.setFont(new Font("Courier new", 1, 45)); g.drawString("Techniques", 190, 235); g.drawString("Name", 190, 150); g.drawRect(185, 236, 280, 1); g.drawRect(185, 151, 116, 1); g.setColor(Color.BLACK); g.setFont(JudokaComponent.stdFont); for(int i = 0; i < techniqueTitle.length * 35; i += 35){ g.setColor(Color.BLACK); g.setFont(JudokaComponent.stdFont); g.drawString(techniqueTitle[i / 35], 450, 270 + i); g.drawRect(150, 250 + i, 280, 24); g.drawRect(150, 250 + i, 24, 24); g.setColor(Color.WHITE); g.fillRect(175, 251 + i, 255, 22); g.setColor(Color.BLACK); g.drawImage(JudokaComponent.pen, 150, 250 + i, 24, 24, null); if(i / 35 == selectedItem && selectedItem != -1){ g.drawString(">", 130, 270 + i); } g.setFont(JudokaComponent.bigFont); if(selectedItem == 8) g.drawString("> Save <", 640, 390); else g.drawString("Save", 682, 390); g.setFont(JudokaComponent.stdFont); if(techniques[i / 35] != null) g.drawString(techniques[i / 35].NAME, 177, 270 + i); else{ g.setColor(Color.RED); g.drawString("NONE", 177, 270 + i); g.setColor(Color.BLACK); } } if(saveTimer < 180) { g.setColor(Color.LIGHT_GRAY); g.fillRect(700, JudokaComponent.HEIGHT - 100, 145, 200); g.setColor(Color.WHITE); g.setFont(JudokaComponent.stdFont); g.drawString("Saved!", 730, JudokaComponent.HEIGHT - 60); g.setColor(Color.BLACK); } }
6b08ea9b-c41c-4af1-bc5e-8109ef3d0926
4
public Element appendAt(String parentPath, String prefix, String name, Map<String, String> namespaces) throws Exception { Element output = null; Node parent = Utilities.selectSingleNode(this.doc, parentPath, this.namespaces); String uri = null; if(!Utilities.isNullOrWhitespace(prefix) && namespaces != null) { uri = namespaces.get(prefix); } if(uri != null) { output = this.doc.createElementNS(uri, name); output.setPrefix(prefix); } else { output = this.doc.createElement(name); } if(output != null) { parent.appendChild(output); } return output; }
d0fa05bf-a469-4f73-aa60-d565460cde3b
4
public void setUserRoleField(String nodeName,String content) { if (nodeName.equals("roleid")) setRoleId(Long.parseLong(content)); if (nodeName.equals("name")) setName(content); if (nodeName.equals("shortname")) setShortName(content); if (nodeName.equals("sortorder")) setSortOrder(Integer.parseInt(content)); }
d2c07949-b398-49fe-bb72-45f0f6defcf9
3
public Class<?> getColumnClass(int n) { if (columnClasses == null) throw new IllegalStateException("columnClasses not set"); int max = columnClasses.length; if (n>=max) throw new ArrayIndexOutOfBoundsException( "columnClasses has " + max + " elements; you asked for " + max); return columnClasses[n]; }
15fd8aa5-6c91-49b0-a385-72609f0a40b2
2
public int getGeometryIndex(int stake) { RoadGeometry toFind = geometry.get(0); for (RoadGeometry section : stakes.keySet()) { if (stakes.get(section).contains(stake)) { toFind = section; break; } } return geometry.indexOf(toFind); }
8fce3e4a-91e9-4d4e-a6d0-d8cf554b1cf0
4
@Override public boolean isDead() { // The handler is dead if it was killed if (this.killed) return true; // or if autodeath is on and it's empty (but has had an object in it previously) if (this.autodeath) { // Removes dead handleds to be sure removeDeadHandleds(); if (this.started && this.handleds.isEmpty()) return true; } return false; }
73f18f0b-56e6-499c-b942-317345232f0c
4
@Test public void testSave1() { Session session=null; Transaction tx = null; User user=null; try{ session=sessionFactory.openSession(); tx= session.beginTransaction(); user=new User(); user.setAge(26); user.setName("刘江龙"); user.setCreateTime(new Date()); user.setExpireTime(new Date()); logger.debug("user即将进入persistent状态"); /*persistent状态 persistent状态的对象,当属性发生变化时,hibernate会自动跟数据库保持同步 */ session.save(user); user.setAge(25); /** * 实际上user.setAge(25);此时已经发出了一条update指令了 * 也可以显示的调用update指定 * session.update(user); */ logger.debug("session提交事务--【前】还未发送语句"); tx.commit(); logger.debug("session提交事务--【后】,发出insert update语句?"); }catch (HibernateException e) { e.printStackTrace(); tx.rollback(); }finally{ if(session!=null){ session.close(); } } /** * session已经关闭,这时候user对象的状态就变为detached状态 * 所有的user对象已经不被session管理,但数据库中确实存在与之对应的记录(age=25) */ //detached状态(分离独立状态) user.setAge(18); try{ session=sessionFactory.openSession(); tx=session.beginTransaction(); /** * 此时,session有对user对象进行管理 * session发出update指令后,进行更新数据为(age=18) */ session.update(user); //update后user对象的状态又变为persistent状态(坚固状态) logger.debug("session提交事务--前"); tx.commit(); //session提交事务,发出update语句 logger.debug("session提交事务--后,发出update语句?"); }catch (HibernateException e) { e.printStackTrace(); tx.rollback(); }finally{ if(session!=null){ session.close(); } } }
db2f7d4b-f5e5-4061-b49f-555b038f210b
1
private void setUpGUI() { // add split pane to application frame this.add(share); southPanel.setPreferredSize(new Dimension(500,500)); southPanel.setLayout(new BorderLayout()); southPanel.add(textScroll, BorderLayout.CENTER); if (controllsOption != null) southPanel.add(controllsOption, BorderLayout.PAGE_START); // add scroll text to bottom pane share.add(southPanel, JSplitPane.BOTTOM); share.setDividerLocation(180); // add tabbed pane to upper pane share.add(tabbedPane, JSplitPane.TOP); updateTabs(); }
f110cb1d-4d61-4dbb-ab8b-bf0005ee547d
4
public static void main(String[] args) { ProxyFactory factory = new ProxyFactory(); factory.setInterfaces(new Class[] { TestInterface.class }); factory.setFilter(new MethodFilter() { @Override public boolean isHandled(Method m) { if (m.getName().equals("doTest")) { return true; } return false; } }); Class<?> proxyClass = factory.createClass(); MethodHandler mi = new MethodHandler() { public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable { System.out.println("Name: " + m.getName()); return "result from proxy object"; } }; try { TestInterface testIFace = (TestInterface) proxyClass.newInstance(); ((Proxy) testIFace).setHandler(mi); System.out.println(testIFace.doTest()); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
f45080cc-e3eb-4930-824a-0b3dd3046a9e
1
public List<PosSolicitud> getSolicitudesNuevasFromPos(int idPos){ try { return getHibernateTemplate().find( "from PosSolicitud where solEstado = 'X' and solPosId = ? ", idPos); } catch (DataAccessException e) { e.printStackTrace(); return new ArrayList<PosSolicitud>(); } }
aca2e0d8-de2f-43d1-bf76-498c7313629b
2
public void mousePressed(MouseEvent e) { java.awt.Point point = e.getPoint(); if (table.getSelectedRowCount() == 0 || !table.isRowSelected(table.rowAtPoint(point))) table.changeSelection(table.rowAtPoint(point), 0, false, false); }
efff6d68-dce0-4631-a239-8f9f03f7e536
3
public void refreshList () { if ((rosterTableModel == null) || (MainWindow.rosterDB == null)) return; rosterTable.removeAll(); for (Roster r: MainWindow.rosterDB.getRosters()) { rosterTable.add( r); } rosterTable.changeSelection(0, 0, false, false); rosterTableModel.fireTableDataChanged(); }
37bc7246-4133-4637-863f-c110042a0852
2
private void doViewAllCYs(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String pageNum = StringUtil.toString(request.getParameter("pageNum")); if("".equals(pageNum)) { pageNum = "1"; } try { Pager<ChengYuan> pager = manager.getCurPageCYsByNum(pageNum); request.setAttribute("pager",pager); request.getRequestDispatcher("/admin/tuandui/chengyuanList.jsp").forward(request,response); return; } catch (SQLException e) { logger.error("查找所有团队成员失败",e); request.setAttribute("errorMsg","查找所有团队成员失败"); request.getRequestDispatcher("/admin/error.jsp").forward(request, response); return; } }
3fbf3a80-5831-4078-8abd-37ea3f4ff0a3
5
protected void loadSamples(String samples) { if (verbose) Timer.showStdErr("Loaded GTEx experiments from file " + samples); if (!Gpr.canRead(samples)) throw new RuntimeException("Cannot find samples file '" + samples + "'"); experiments = new HashMap<String, GtexExperiment>(); LineFileIterator lfi = new LineFileIterator(samples); for (String line : lfi) { if (lfi.getLineNum() <= 1) continue; // Ignore title GtexExperiment gtexExperiment = new GtexExperiment(this, line); experiments.put(gtexExperiment.getId(), gtexExperiment); } if (verbose) Timer.showStdErr("Done. Loaded " + experiments.size() + " experiments."); }
f59a4cc7-bff4-4f96-a82a-eb559f64e051
9
public static void minimizeInsertions(List<Insertion> insertions, List<Deletion> deletions, Map<String, String> relabelings) { List<Insertion> insertionsToRemove = new ArrayList<Insertion>(); List<Deletion> deletionsToRemove = new ArrayList<Deletion>(); Map<String, String> parentToInserted = new HashMap<String, String>(); Map<String, Insertion> finalInsertions = new HashMap<String, Insertion>(); // remove all of the deletions and insertions that weren't caught above for (Insertion insertion : insertions) { if (!relabelings.containsKey(insertion.getB())) { // not a relabeling parentToInserted.put(insertion.getB(), insertion.getA()); // add to parent -> inserted mapping finalInsertions.put(insertion.getB(), insertion); if (parentToInserted.containsKey(insertion.getA())) { boolean hasMatchingDeletion = false; for (Deletion deletion : deletions) { // check for a matching deletion if (deletion.getA().equals(parentToInserted.get(insertion.getA())) && deletion.getB().equals(insertion.getB())) { deletionsToRemove.add(deletion); insertionsToRemove.add(insertion); hasMatchingDeletion = true; if (finalInsertions.containsKey(insertion.getA())) { Insertion parentInsertion = finalInsertions.get(insertion.getA()); parentInsertion.addInheritedChild(insertion.getB()); while (finalInsertions.containsKey(parentInsertion.getA())) { // Richard understands this parentInsertion = finalInsertions.get(parentInsertion.getA()); parentInsertion.addInheritedChild(insertion.getB()); } } } } if (!hasMatchingDeletion) { parentToInserted.put(insertion.getB(), parentToInserted.get(insertion.getA())); finalInsertions.put(insertion.getB(), insertion); } } } } insertions.removeAll(insertionsToRemove); deletions.removeAll(deletionsToRemove); }
964f4232-57a1-43b3-890f-a7313a30199d
7
public void deleteSubscribedCategories(int studentid){ ResultSet rs=null; Connection con=null; PreparedStatement ps=null; try{ String sql="DELETE FROM student_category_mapping WHERE s_id=(?)"; con=ConnectionPool.getConnectionFromPool(); ps=con.prepareStatement(sql); ps.setInt(1, studentid); ps.executeUpdate(); } catch(Exception ex) { ex.printStackTrace(); } finally{ if(rs!=null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if(ps!=null) { try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } } if(con!=null) { try { ConnectionPool.addConnectionBackToPool(con);; } catch (Exception e) { e.printStackTrace(); } } } }
a0e5f249-611e-4dd6-ad19-fd42ba557694
8
private PolizaElectronica actualizarConBase(PolizaElectronica pol) { for (int i = 1; i < base.length; i++) { String poliza = base[i][colNumPolBase - 1]; // Si coinciden las polizas if (poliza.equals(pol.getNumPol())) { String rutaDoc = base[i][colRutaDoc - 1]; System.out.println("POliza = "+pol.getNumPol()+ "Ruta Doc = " + rutaDoc); if (!base[i][colApePatContr - 1].equals("") && rutaDoc.startsWith("POL") && rutaDoc.contains("EMISION") && rutaDoc.toUpperCase().endsWith("OLDER")) { // Es una // entrada // de // emisi�n pol.setRutaDoc(rutaDoc); pol.tieneRutaDoc1 = true; System.out.println("POliza = "+pol.getNumPol()+ "Se encontro emision"+ rutaDoc); // Leer los campos en el archivo String numReg = base[i][colNumReg - 1]; String nomContr = base[i][colNomContr - 1]; String apePatContr = base[i][colApePatContr - 1]; String apeMatContr = base[i][colApeMatContr - 1]; String tipoDocIdContr = base[i][colTipoDocIdContr - 1]; String numDocIdContr = base[i][colNumDocIdContr - 1]; String nomAseg = base[i][colNomAseg - 1]; String apePatAseg = base[i][colApePatAseg - 1]; String apeMatAseg = base[i][colApeMatAseg - 1]; String emailAseg = base[i][colEmailAseg - 1]; String tipoDocIdAseg = base[i][colTipoDocIdAseg - 1]; String numDocIdAseg = base[i][colNumDocIdAseg - 1]; // String numPolBase = base[i][colNumPolBase-1]; String codProd = base[i][colCodProd - 1]; String nomProd = base[i][colNomProd - 1]; String nomMarca = base[i][colNomMarca - 1]; String nomModelo = base[i][colNomModelo - 1]; String numPlaca = base[i][colNumPlaca - 1]; String codOrgDoc = "GW";// base[i][colCodOrgDoc-1]; String fecIniVig = representarFecha(base[i][colFecIniVig - 1]); String fecFinVig = representarFecha(base[i][colFecFinVig - 1]); String trans = "Emision";// base[i][colTrans-1]; String numTrans = base[i][colNumTrans - 1]; String emailContrat = base[i][colEmailContrat - 1]; String nomPlant = "Seguro de Autos Completo";// base[i][colNomPlant-1]; String tlfAseg = base[i][colTlfAseg - 1]; String tlfContrat = base[i][colTlfContrat - 1]; String nomApeAge = base[i][colNomApeAge - 1]; String fecEmiPol = representarFecha(base[i][colFecEmiPol - 1]); String consent0 = base[i][colConsent - 1]; String formCmrcl = "2";// base[i][colFormCmrcl-1]; String codProdSBS = base[i][colCodProdSBS - 1]; String rieCont = base[i][colRieCont - 1]; String numAseg = base[i][colNumAseg - 1]; String primaTot = base[i][colPrimaTot - 1]; String consent = "No"; if (consent0.equalsIgnoreCase("virtual")) consent = "Si"; // Actualizar la poliza pol.setNumReg(numReg); pol.setNomContratante(nomContr);// polNomContr-1]; pol.setApePatContratante(apePatContr);// polApePatContr-1]; pol.setApeMatContratante(apeMatContr);// polApeMatContr-1]; pol.setTipoDocIdCtrtnt(tipoDocIdContr);// polTipoDocIdContr-1]; pol.setNumDocIdCntrtnt(numDocIdContr);// polNumDocIdContr-1]; pol.setNomAseg(nomAseg);// polNomAseg-1]; pol.setApePatAseg(apePatAseg);// polApePatAseg-1]; pol.setApeMatAseg(apeMatAseg);// polApeMatAseg-1]; pol.setEmailAseg(emailAseg);// polEmailAseg-1]; pol.setTipoDocIdAseg(tipoDocIdAseg);// polTipoDocIdAseg-1]; pol.setNumDocIdAseg(numDocIdAseg);// polNumDocIdAseg-1]; pol.setCodProd(codProd);// polCodProd-1]; pol.setNomProd(nomProd);// polNomProd-1]; pol.setNomMarca(nomMarca);// polNomMarca-1]; pol.setNomModelo(nomModelo);// polNomModelo-1]; pol.setNumPlaca(numPlaca);// polNumPlaca-1]; pol.setCodOrgnDoc(codOrgDoc);// polCodOrgDoc-1]; pol.setFecIniVigPol(fecIniVig);// polFecIniVig-1]; pol.setFecFinVigPol(fecFinVig);// polFecFinVig-1]; pol.setCodEvt(trans); // pol.setRutaDoc (rutaDoc);//polRutaDoc-1]; pol.setNumTransac(numTrans);// polNumTrans-1]; pol.setEmailContrtnt(emailContrat);// polEmailContrat-1]; pol.setNomPlant(nomPlant);// polNomPlant-1]; pol.setTlfnoAseg(tlfAseg);// polTlfAseg-1]; pol.setTlfnoCntrtnt(tlfContrat);// polTlfContrat-1]; pol.setNomApeAgte(nomApeAge);// polNomApeAge-1]; pol.setFecEmicPol(fecEmiPol);// polFecEmiPol-1]; pol.setConsentimiento(consent);// polConsent-1]; pol.setFormaComrcl(formCmrcl);// polFormCmrcl-1]; pol.setCodProdSbs(codProdSBS);// polCodProdSBS-1]; pol.setCodRieContab(rieCont);// polRieCont-1]; pol.setNumAseg(numAseg);// polNumAseg-1]; pol.setPrimaTotal(primaTot);// polPrimaTot-1]; pol.seEncontroBase = true; } else if (rutaDoc.toUpperCase().startsWith("CONV")) { // Es una entrada // ConvPago pol.setRutaDoc2(rutaDoc);// polRutaDoc-1]; pol.tieneRutaDoc2 = true; System.out.println("POliza = "+pol.getNumPol()+ "Se encontro convenio "+ rutaDoc); } } // Fin if poliza=poliza } // fin for return pol; }
651c3b79-6ee7-4d54-a568-ae01184b2673
6
public Object getValueAt(int row, int col) { if (col==bytesPerRow) { // Get ascii dump of entire row int pos = editor.cellToOffset(row, 0); if (pos==-1) { // A cleared row (from deletions) return ""; } int count = doc.read(pos, bitBuf); for (int i=0; i<count; i++) { char ch = (char)bitBuf[i]; if (ch<0x20 || ch>0x7e) { ch = '.'; } dumpColBuf[i] = ch; } return new String(dumpColBuf, 0,count); } int pos = editor.cellToOffset(row, col); // & with 0xff to convert to unsigned return pos==-1 ? "" : byteStrVals[doc.getByte(pos)&0xff]; }
9ea3d76f-93c4-4085-9194-195e5898fa83
9
public void validate() throws XPathException { name = typeCheck("name", name); select = typeCheck("select", select); int countChildren = 0; NodeInfo firstChild = null; AxisIterator kids = iterateAxis(Axis.CHILD); while (true) { NodeInfo child = (NodeInfo)kids.next(); if (child == null) { break; } if (child instanceof XSLFallback) { continue; } if (select != null) { String errorCode = getErrorCodeForSelectPlusContent(); compileError("An " + getDisplayName() + " element with a select attribute must be empty", errorCode); } countChildren++; if (firstChild == null) { firstChild = child; } else { break; } } if (select == null) { if (countChildren == 0) { // there are no child nodes and no select attribute select = new StringLiteral(StringValue.EMPTY_STRING); } else if (countChildren == 1) { // there is exactly one child node if (firstChild.getNodeKind() == Type.TEXT) { // it is a text node: optimize for this case select = new StringLiteral(firstChild.getStringValueCS()); } } } }
8c6c1260-2ef1-41a7-942c-1200544a30a3
9
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirection / HALF_RIGHT) * HALF_RIGHT; int dc = 0; int dr = 0; if (adjustedDirection == EAST) dc = 1; else if (adjustedDirection == SOUTHEAST) { dc = 1; dr = 1; } else if (adjustedDirection == SOUTH) dr = 1; else if (adjustedDirection == SOUTHWEST) { dc = -1; dr = 1; } else if (adjustedDirection == WEST) dc = -1; else if (adjustedDirection == NORTHWEST) { dc = -1; dr = -1; } else if (adjustedDirection == NORTH) dr = -1; else if (adjustedDirection == NORTHEAST) { dc = 1; dr = -1; } return new Location(getRow() + dr, getCol() + dc); }
6663265f-a098-4aa5-814a-26f9967de25f
5
public void drawChar(char ch) { Font font = new Font("monospaced", 0, 16); GlyphVector gv = font.createGlyphVector(new FontRenderContext(null, false, true), ""+ch); Shape shape = gv.getOutline(); PathIterator pi = shape.getPathIterator(null, 0.1D); double[] coords = new double[6]; GLUtessellator gt = GLU.gluNewTess(); gt.gluTessCallback(100100, this); gt.gluTessCallback(100101, this); gt.gluTessCallback(100102, this); gt.gluTessCallback(100105, this); gt.gluTessBeginPolygon(null); gt.gluTessProperty(100140, pi.getWindingRule() == 1 ? 100131 : 100134); while (!pi.isDone()) { int type = pi.currentSegment(coords); if (type == 0) { gt.gluTessBeginContour(); gt.gluTessVertex(coords, 0, Integer.valueOf(2)); } else if (type == 1) { gt.gluTessVertex(coords, 0, new VertexData(coords[0], coords[1])); } else if (type == 4) { gt.gluTessEndContour(); } pi.next(); } gt.gluTessEndPolygon(); GL11.glTranslatef(gv.getGlyphMetrics(0).getAdvance(), 0.0F, 0.0F); }