method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0bfb1612-8dbf-4f2f-a4e1-1356aa668aae
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Estoque other = (Estoque) obj; if (this.id != other.id) { return false; } ret...
e030db10-a9d2-4ac5-9269-2ec64c848e79
3
public static void main(String[] args) { // TODO code application logic here //6. Дан двумерный массив целых чисел. //б) Последний нулевой элемент каждою столбца заменить на число 100 //(предполагается, что в каждом столбце есть нулевой элемент). System.out.println("*** Задани...
cf6048fa-5f84-406a-b963-af38671d144e
4
public int solution(int[] array) { if (array.length == 1) { return -2; } sort(array); long minimumDistance = Long.MAX_VALUE; for (int i = 1; i < array.length; i++) { long distance = (long) array[i] - array[i-1]; if (distance < minimumDistance) { minimumDistance = distance; } } return m...
6ace27bc-98c2-4137-a0cd-90475d283ce3
4
@Override public void setSheetName( String newname ) { cch = (byte) newname.length(); byte[] namebytes; if( !ByteTools.isUnicode( newname ) ) { grbitChr = 0x0; } else { grbitChr = 0x1; } try { if( grbitChr == 0x1 ) { namebytes = newname.getBytes( UNICODEENCODING ); } else ...
940dbe4b-366b-412e-a374-38756841b5c8
0
protected LSystemEnvironment getEnvironment() { return environment; }
1df22052-874c-4015-8308-5b5544cde5fc
9
public static void main(String[] args) { try { setupLog4j(); CommandLine commandLine = parser.parse(ConsoleOptions.OPTIONS, args); if (commandLine.hasOption("d")) { Logger.getLogger("net.kahowell.xsd.fuzzer").setLevel(Level.DEBUG); } for (Option option : commandLine.getOptions()) { if (option.g...
d8d1ed6c-56ef-4a39-9ece-431e58962c3d
5
public String[] getEditableDimensionArray() { TreeSet dim_set = new TreeSet(); for (Iterator i = parameters.values().iterator(); i.hasNext();) { Parameter p = (Parameter)(i.next()); if (p.getSize() > 0) { String foo = ""; for (int j = 0; j < p.get...
bea3ac9c-0fb1-4a05-8162-156a285f8c15
8
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || !(obj instanceof java.util.Map.Entry)) return false; java.util.Map.Entry<?,?> me2 = (java.util.Map.Entry<?,?>)obj; return (HashedMap.compareObjects(key, me2.getKey()) && HashedMap.compareObjects(getValue(), me2....
7cfdfdac-8815-4f97-9e58-c91d5940c175
1
public RandomInt() { s.add(new BigInteger("12345")); // initial seed // calculate first 4 elements of series for (int i = 0; i < 3; i++) { // calculate si+1 from si s.add(s.get(i).multiply(new BigInteger("22695477")).add(new BigInteger("1"))); } }
ce9d4d55-ce59-4aad-8bec-25b48e49a49a
7
@Override public byte[] write(DataOutputStream out, PassthroughConnection ptc, KillableThread thread, boolean serverToClient) { if(length == null) { return null; } Short lengthTemp = lengthUnit.write(out, ptc, thread, serverToClient); if(lengthTemp == null) { return null; } if((short)(lengthTemp...
3a8892bb-66fe-47cf-b923-247d8082ea14
5
@Test public void testServerSetQueueTimeoutDisconnectIndividualInvalidEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutDisconnectIndividualInvalidEx -----"); boolean exception_other = false; String client_hash = ""; try { server2.setUseMessageQu...
3a5ea923-542d-4a58-be15-240cc08671b5
4
@Override public boolean execute(CommandSender sender, String identifier, String[] args) { if (sender instanceof Player) { try { ArrayList<String> list = new ArrayList<String>(); String ownedIds = ""; list = DBManager.getOwnedTitles(sender.getName()); if (list.size() >= 1) { for (String ...
4ae6137c-958e-4260-8b0b-11890b03e1db
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 fe...
91c5470f-a0bc-4620-9131-ddaaad91f672
6
@Override public GrammarTree createGrammarTree(SyntaxAnalyser analyser) throws GrammarCreateException { GrammarTree grammarTree = new GrammarTree(new Token(TokenType.KEYWARD, "all")); AnalyticResult tokens = analyser.getAnalyticResult(); Token tempToken = tokens.front(); if (tempToken == null) { Gram...
a674cc43-9b85-4fd2-8339-3b3ce3cb2224
3
public boolean checkInitalBridge() { if (client_bridge.isCreateGameRequest()) { client_bridge.setGameCreated(true); client_bridge.setCreateGameRequest(false); setClientId(Messager.Id_Server); start(); return true; } if (client_bridge.isJoinGameRequest()) { try { sleep(1000); } catch (I...
a5888e76-5b7a-4f93-a303-83ff14fb147e
3
@EventHandler public void banCheck(LoginEvent e) throws SQLException { if(BansManager.isPlayerBanned(e.getConnection().getName())){ Ban b =BansManager.getBanInfo(e.getConnection().getName()); if(b.getType().equals("tempban")){ if(BansManager.checkTempBan(b)){ e.setCancelled(true); SimpleDateForma...
107eae44-7466-44c8-bf9e-289bb1c5eef1
3
@Override public boolean equals(Object o){ if (o == null) { return false; } if (o == this) { return true; } if (o.getClass() != getClass()) { return false; } RomanNumeral rn = (RomanNumeral) o; return new EqualsBuilder() .append(this.value, rn.value) .isEquals(); }
85421fef-9c2a-4d22-9dab-47f52bf226d5
0
@Override public int getRank() { return rank; }
5a6d1ca7-b583-46b7-8ef8-9a8f307a0cf0
1
@Override public void mousePressed(MouseEvent e) { System.out.println("Clicked pressed at pixel (" + e.getX() + ", " + e.getY() + ")"); int x = e.getX() * _width / getWidth(); int y = e.getY() * _height / getHeight(); System.out.println("Which is cell (" + x + ", " + y + ")"); if (_dra...
4356f94b-7ec9-46a2-be1e-297ee9008070
7
public static int kmpStrStr(String text, String pattern) { if(text == null || pattern == null) { return -1; } Set<Character> dedup = new HashSet<>(); // find all unique characters in pattern for(char c : pattern.toCharArray()) { dedup.add(c); } ...
925c5bc1-e695-4cba-b44b-ec14813ad92a
0
protected void onDccSendRequest(String sourceNick, String sourceLogin, String sourceHostname, String filename, long address, int port, int size) {}
f3c6322d-b623-4895-bdc7-9fd288a306e7
8
@Override public void actionPerformed(ActionEvent arg0) { if (colorGain) colorN += 5; else colorN -= 5; if (colorN >= 200) colorGain = false; else if (colorN <= 30) colorGain = true; if (!seen) { tutorial = true; if (tutorialX > 0) { tutorialX -= 15; tutorialEnd = true; } ...
9a06a093-7c57-4dec-8068-831c6cbdba3c
9
private void requestUpdateRange() { int i = 0; for (DBUpdate u : updates) { console.printf("[%d]: %s\n", ++i, u.getFileName()); } first = 0; while (first < 1) { String sfirst = requestInputWithFallback("First Update", "1"); try { first = Integer.parseInt(sfirst); } catch (NumberFormatExcepti...
12156f07-c250-44b6-88f3-10e7a343ccaf
7
public Discretize(Element discretize, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs) throws Exception { super(opType, fieldDefs); /* if (m_opType == FieldMetaInfo.Optype.CONTINUOUS) { throw new Exception("[Discretize] must have a categorical or ordinal optype"); } */ m_fi...
e72c4755-794b-412b-b315-1ceb36116618
0
public long getTotalTicketsSold() { return totalTicketsSold; }
9478ed0a-f091-4f49-ba26-5c73f875d747
8
private void jButtonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonApplyActionPerformed String type = typeAskPanel1.getTypeAsk(); jPanel1.setLayout(new BorderLayout()); jPanel1.removeAll(); switch (type) { case "SelectedTest": ...
121a8a0a-71d8-4fc5-b5cf-38fa57396f53
1
public Icon getIcon(File file) { return file.isFile() ? file_icon : folder_icon; }
819d87d4-2daa-4202-a918-564e278252d9
9
public void generateFakeCorpus(String filePrefix){ HashMap<Integer, Double> t_wordSstat = new HashMap<Integer, Double>(); double t_allWordFrequency = 0; for(_Doc d:m_corpus.getCollection()){ if(d instanceof _ChildDoc){ _SparseFeature[] fv = d.getSparse(); for(int i=0; i<fv.length; i++){ in...
cfc1d879-7bcf-46e9-9d9a-9d19e2948057
8
public static boolean helpFinalizeClass(Stella_Class renamed_Class, Surrogate finalizedparent) { if (renamed_Class.classFinalizedP) { return (true); } KeyValueList.setDynamicSlotValue(renamed_Class.dynamicSlots, Stella.SYM_STELLA_BADp, Stella.TRUE_WRAPPER, null); { Surrogate renamed_Super = null; ...
f233a4fd-fdfe-4d9a-b08d-c12668a187f3
1
public void sendRequest(Player player) { if (sent) return; player.sendPluginMessage(The5zigMod.getInstance(), "5ZIG", ("/ts/seconds=" + seconds + ";up=" + up + ";id=" + id + ";name=" + name).getBytes()); sent = true; }
b55b638f-badc-458d-901b-ede1eae585b9
5
public void listenForControls(int dt) { float movementSpeed = 0.015f * dt; if (Keyboard.isKeyDown(Keyboard.KEY_A)) { main.player.strafeLeft(movementSpeed); } if (Keyboard.isKeyDown(Keyboard.KEY_D)) { main.player.strafeRight(movementSpeed); } if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {...
3dfe4579-4cb3-4822-a6d9-3bf92996a16b
1
public void setShowRowDivider(boolean visible) { if (visible != mShowRowDivider) { mShowRowDivider = visible; notify(TreeNotificationKeys.ROW_DIVIDER, Boolean.valueOf(mShowRowDivider)); } }
60f367c9-1889-440b-8b40-e57ce2b0f9a0
6
public static ExtensionRegistry getInstance() { if(registrySingleton == null) { try { // locate file in bundle URL url = ExtensionRegistry.class.getClassLoader().getResource(CONFIG_PROPERTIES_FILENAME); if(url != null) { // open file and parse it Properties config = new Properties(); ...
33d658c3-bf7e-4e70-90c5-7d6e0d1a988e
7
public Menu(Descent descent) { this.descent = descent; addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent event) { Font font = Menu.this.descent.getTitleFont().deriveFont(16.0F); if (SwingUtilities.isLeftMouseB...
aa7b8b3a-1291-4dc9-87ea-d62bdd3b6742
0
public GuiFrame() { total.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CardLayout cardLayout = (CardLayout) panelcontainer.getLayout(); cardLayout.show(panelcontainer,"totalpanel"); /...
0f8ccfed-5ab9-45c6-96ad-25a5bc42bf85
3
@Override public void tick(int arg0, int arg1, int arg2) { ArrayList<ComponentPlayer> comps = player.getComponentsOfType(ComponentPlayer.class); ColliderBox coll; if(comps.size() > 0) coll = player.pos.add(comps.get(0).colliderPos).getColliderWithDim(comps.get(0).colliderDim); else coll = player.pos.getC...
93d49fce-a974-47e3-a827-0eeeae08e762
8
private void getPossibleEventsForDate(Date selectedDate){ Hall selectedHall = (Hall) hallCombo.getSelectedItem(); String selectedHallName = selectedHall.getName(); ArrayList<Event> allAssignedEvents = new ArrayList<Event>(); allAssignedEvents = getAllAssignedEvents(); eventCombo.removeAllItems(); for (in...
9d0cfd36-7f04-4078-a0fa-b5da3e2f168b
8
public static String htmlEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input....
b3f91735-d7d9-4c2b-b186-0e0657826d4c
2
public static void aNewWalk() { try { String firstDirectoryName = "/home/xander/test/test1"; String secondDirectoryName = "/home/xander/test/test1/test2"; String fileOne = "/home/xander/test/test1/firstFile.txt"; String nameOfTheLinkToFileOne = "/home/xander/test/...
eb65b485-a27b-42fd-9f76-2a70fb2585c4
5
public void readCharacterDefinition(String filename, UnknownDictionary dictionary) throws IOException { FileInputStream inputStream = new FileInputStream(filename); InputStreamReader streamReader = new InputStreamReader(inputStream, encoding); LineNumberReader lineReader = new LineNumberReader(streamReader); S...
8a10a7fa-d489-443f-878a-1ac062242c78
4
long fixedFromGJ(int year, int monthOfYear, int dayOfMonth) { if (year == 0) { throw new IllegalArgumentException("Illegal year: " + year); } int y = (year < 0) ? year + 1 : year; long y_m1 = y - 1; long f = JULIAN_EPOCH - 1 + 365 * y_m1 + div(y_m1, 4) + d...
163f1c93-b597-4249-b73d-6b6366940aa4
1
public void addTray(Tray tray) { if (!this.trays.contains(tray)) { this.setSlotNumber(tray); this.trays.add(tray); tray.setStorageUnit(this); } }
669b4a62-549c-48de-9971-0b680e67a98d
3
public double[] getColumnCopy(int ii){ if(ii>=this.numberOfColumns)throw new IllegalArgumentException("Column index, " + ii + ", must be less than the number of columns, " + this.numberOfColumns); if(ii<0)throw new IllegalArgumentException("column index, " + ii + ", must be zero or positive"); ...
01dc4411-1195-4f13-b5eb-37824d449735
7
public void fillPreRequisites(Ability A, DVector rawPreReqs) { for(int v=0;v<rawPreReqs.size();v++) { final String abilityID=(String)rawPreReqs.elementAt(v,1); if(abilityID.startsWith("*")||abilityID.endsWith("*")||(abilityID.indexOf(',')>0)) { final List<String> orset=getOrSet(A.ID(),abilityID); ...
25bc661e-e5f6-4318-a044-0e37e59a022c
6
public Object getFromCache(String key) throws Exception { Object result = null; // We get the SoftReference represented by that key SoftReference softRef = (SoftReference) map.get(key); if (softRef != null) { // From the SoftReference we get the value, which can be // null if it was not in the map, or it ...
8e3e3b2b-6e9a-4b52-9613-001d99dd95c1
6
public void bodyDetected(double x, double y, double width, double height, double dist) { // calculate body-center pos (image) x,y 0..1 double cX = x + width / 2; double cY = y + height / 2; Point2D absPos = this.camPosToAbsPos(new Point2D(cX, cY)); Point3D cartPos = this....
c4e4c262-defc-45d9-9212-5f0cfef54395
9
Message parse(final DataInputStream input) throws IOException { if (input == null) { throw new IllegalArgumentException("Input stream for ISO8583 message cannot be null"); } final MessageReader reader = getMessageReader(); // if the header field is required, check that it is present fin...
a0ac26bb-fc88-403c-9adf-df2d0442d116
8
public static void main( String[] args ) { System.out.println( "NanoHTTPD 1.0 (c) 2001 Jarno Elonen\n" + "(Command line options: [port] [--licence])\n" ); // Show licence if requested int lopt = -1; for ( int i=0; i<args.length; ++i ) if ( args[i].toLowerCase().endsWith( "licence" )) { lopt = i;...
8fb74799-6da1-42b1-8a3f-cba24a80bbd0
9
public void handleConf(CSTAEvent event) { if ((event == null) || (!(event.getEvent() instanceof CSTAPickupCallConfEvent))) { return; } this.device.replyTermPriv = event.getPrivData(); Vector<TSEvent> eventList = new Vector<TSEvent>(); if (this.terminalAddress == this.pickConnection.getTSDevice()) { ...
b53560bf-b356-4abf-980a-3b02da1c1d6f
5
public void run() { while(connected){ try { int i = inputStream.readInt(); IPacket packet = PacketList.instance.getPacketFromID(i); if (packet != null){ if (!packet.isClientPacket() || packet.isServerPacket()){ ...
5e162d79-11a2-4844-8c4f-1c700c6413e7
1
public void update(int delta) { while(performAction(delta) != -1); }
c2f89628-0278-48ed-8c5d-d43ebf701cc7
9
public boolean testForward() throws PersistitException { setPhase("a"); _ex.clear().append(Key.BEFORE); int index1 = 0; int index2; while (_ex.next() && !isStopped()) { index2 = (int) (_ex.getKey().decodeLong()); for (int i = index1; i < index2; i++) { ...
11a44f41-0cc8-48b7-bac7-7cef06b58e3d
0
public Person1 (int id,String Name,Double height) { this.id = id; this.Name = Name; this.height = height; }
01d42753-a9ac-4f17-b05f-f15a2bb6964f
0
public PrintAutonomousMove(double speed,double waitTime){ _speed = speed; _waitTime = waitTime; }
6a849e7c-6185-4fb1-9fe3-3c9bf425210b
0
public int getArmor() {return armor;}
cd9cf07b-4c05-40ee-8ab4-73f268875f6a
6
public static void main(String args[]) throws IOException { /* 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 deta...
9cf633a3-994a-40e9-a128-cda5178c3c06
4
@Override public void processPacket(Client c, int packetType, int packetSize) { int tradeId = c.getInStream().readSignedWordBigEndian(); c.getPA().resetFollow(); if(c.arenas()) { c.sendMessage("You can't trade inside the arena!"); return; } if(c.playerRights == 2 && !Config.ADMIN_CAN_TRADE) { ...
2977ea59-1429-4b28-94f4-a34f75fa4fd8
0
public static GsonBuilder registerAdapters(GsonBuilder builder) { builder.registerTypeAdapter(GeoJsonObject.class, new GeoJsonObjectAdapter()); builder.registerTypeAdapter(LngLatAlt.class, new LngLatAltAdapter()); return builder; }
376e40ce-e228-489a-bd37-3afd3908bfbd
9
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer sb = new StringBuffer(); ArrayList<Figura> figuras = new ArrayList<Figura>(); for (String ln; !(ln = in.readLine().trim()).equals("*"); ) { String[] arr = ln.split(...
3b651c1d-6616-411e-bd86-5b55d8148864
3
public ChatRoom getChatRoomAt(int index) { if(list == null) { return null; } if(index < 0 || index >= list.size()) { return null; } return list.get(index); }
bd0f564a-36ee-48bd-a501-9c51a1f5b07f
3
public static boolean compare(int a, int b) { long resa = a; long resb = b; int ta = a; int tb = b; do {resa = resa * 10; tb = tb / 10;} while (tb != 0); resa = resa + b; do {resb = resb * 10; ta = ta / 10;} while (ta != 0); resb = resb + a; if (resa >= resb) return true; return ...
e425b312-6880-4a72-a58b-a0c573a33957
4
public void move() { x += dx; y += dy; Dimension d = panel.getSize(); if (x < 0) { x = 0; dx = -dx; } else if (x + BALL_DIAM >= d.width) { x = d.width - BALL_DIAM; dx = -dx; } if (y < 0) { y = 0; dy = -dy; } else if (y + BALL_DIAM >= d.height) { y = d.height - BALL_DIAM; dy = -d...
f148a273-fe79-468a-9b38-97c35eb36674
1
public boolean getUpdate(){ if (prop.getProperty("autoUpdate").equals("true")) return true; else return false; }
767c6142-92b3-4622-b8d0-469bdc0ff123
1
private static void printGerber(ArrayList<Gaussian> primes) throws Exception { System.out.println(GerberPlottables.GERBER_HEADER); System.out.println("G75*"); int scale = 1000; // double radius = scale/2*2/Math.sqrt(3); double radius = scale/2; for(Gaussian e: primes) System.out.println(GerberPlottables.circ...
44662edf-2260-4c7e-b317-3da50bb1fd9a
1
@Test public void findStudentBookingsByMonthAndYearTest() { try { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); DiningHall d1 = new DiningHall(24, BigDecimal.valueOf(4.00), DiningHall.Type.MADRUGADORES); DiningHall d2 = new DiningHall(20, BigDecimal.valueOf(5.00), DiningHall.Type.COME...
f086631e-7c74-481f-bca8-68b1972da928
3
public void setCondicao(PExpLogica node) { if(this._condicao_ != null) { this._condicao_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent...
4405cc39-9402-4165-bf94-156b5bdd85c1
1
private void shiftLeft(int position) { // int countOfLeftShift = 0; // countOfLeftShift = (items.length - 1) - position; for (int count=position; count > 0; count--) { items[count]=items[count+1]; } }
c7f8350d-ec3e-403f-b36f-0e23fbf07b38
1
public void setPause(int seconds) { try { Thread.sleep(seconds * 1000); } catch (InterruptedException e) { System.out.printf("\n%s", "Some thing went wrong!!!"); } }
950be255-a690-4542-9569-55b523e7231a
5
private static void traverseFields(Class<?> c, List<Field> out) { List<Field> fieldList = new ArrayList<Field>(); for (Field f : c.getFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) { f.setAccessible( true ); ...
8a7cc22c-ffe0-4105-ac23-718dcc058119
6
private boolean camposCompletos (){ if((!field_codigo.getText().equals(""))&& (!field_nombre.getText().equals(""))&& (!field_apellido.getText().equals(""))&& (!field_localidad.getText().equals(""))&& (!field_direccion.getText().equals(""))&& (!field_sit_fre...
a9363503-61cb-47f0-90a4-4b363e0b5377
0
public static Praticien selectNum(EntityManager em, String nom, String prenom) throws PersistenceException { Praticien praticien = null; Query query = em.createQuery("select pra.numero from Praticien pra where pra.nom = :nom and pra.prenom = :prenom"); query.setParameter("nom", nom); que...
171c26b8-60fd-454f-8c5e-8e01f6756634
3
@SuppressWarnings("deprecation") @Override public boolean girisYap(String kullaniciAdi, String sifre) throws Throwable { if (!kullaniciAdi.isEmpty() && !sifre.isEmpty()) { kullanici = new Calisan(); if (kullanici.girisYap(kullaniciAdi, sifre)) { kullanici.bilg...
38679f21-dbc6-4d90-9da1-b5177c3ea2a7
7
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ComparableObjectSeries)) { return false; } if (!super.equals(obj)) { return false; } ComparableObjectSeries that = (ComparableObjectSerie...
c6d42c78-ae91-45ff-8e2f-0d208845c2bf
0
@Override public boolean existsLockRead(Long connectionId, String objectType) { return readLocks.contains(objectType + lockSeparate + connectionId); }
60e4bf57-e0c2-4c3a-aaee-b61eea97a241
3
public static BEProvince fromCode(String code){ if (!StringUtils.isBlank(code)){ String codeUpper = code.toUpperCase().trim(); for (BEProvince p : BEProvince.values()){ if (codeUpper.equals(p.provinceCode)){ return p; } } } return null; }
0f597568-680b-4146-93ef-937bf686672a
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
b8e8a3b5-8794-4bed-b713-122f8ba35c45
5
private Set<Local> getAllDeadKeys(List<Local> live_var){ Set<Local> dead_keys = new HashSet<Local>(); for(Map.Entry<Local, Set<Local>> e: map.entrySet()){ if(!live_var.contains(e.getKey())){ Set<Local> myset = e.getValue(); boolean flag = true; for(Local l: myset){ if(live_var.contains(l)){ ...
b251a1e3-3ac3-4f7d-bba0-75b8ad11f747
2
public void mostrarDatos(beansVentas registros){ if(registros.getAccion().equals("Descuento")){ System.out.println("Descripcion "+registros.getDescripcion()); System.out.println("Descuento "+registros.getDescuento()+"%"); System.out.println("TotalSinDescuento "+registros.getTotalSinDescue...
658150a2-1873-4e37-8c7f-7649e58494c3
5
public static void get_bill_configure() { try{ FileInputStream in = new FileInputStream(billConfigFile); try (BufferedReader bufffile = new BufferedReader(new InputStreamReader(in, "UTF8"))) { String strLine; strLine = bufffile.readLine();...
6f05e5a8-2337-404d-82c4-eb2a8346c1b9
2
public static Double toDouble(Object obj) { if(obj==null) return null; String string=StringUtils.trimNonNumeric(obj.toString()); Double o=null; try { o=new Double(Double.parseDouble(string)); } catch (NumberFormatException ex) { } return o; }
1075615d-ee5f-41b4-a915-448b343ec244
1
@Override public void collideWith(Element e) { if (e instanceof Moveable) getGrid().teleportElement(e, destination); }
17c7f3b4-0beb-4a6b-95af-f21f803ca86e
4
public static String toString(JSONObject jo) throws JSONException { StringBuffer sb = new StringBuffer(); sb.append(escape(jo.getString("name"))); sb.append("="); sb.append(escape(jo.getString("value"))); if (jo.has("expires")) { sb.append(";expires="); s...
a1f1f3b0-9b34-46c4-a9ed-202b9b1a6908
9
public void mousePressed(MouseEvent event) { int x = event.getX(); int y = event.getY(); int mouseButton = event.getButton(); Marking initialMarking = PNEditor.getRoot().getCurrentMarking(); if (PNEditor.getRoot().getClickedElement() != null && PNEditor.getRoot()...
97d850d6-5b91-4ba9-b40b-8fbb70bc3e86
4
public void init( ArrayList<Monster> mon ) { int enmyCt = 1 + (int)(Math.random()*4); //How many enemies in play? while ( enmyCt > 0 ) { //Add rand enmys to battle depending on MONSTERS try { Class mans = MONSTERS.get((int)(Math.random() *MONSTERS.size())).getClass(); _eInPlay.add( (Monster)(m...
c5a99815-b848-4dd0-884f-58e4714247a3
0
public String getRealName() { return realName; }
697f5405-030d-49ae-b415-5387aebd1dbc
5
private void put(JsonElement value) { if (pendingName != null) { if (!value.isJsonNull() || getSerializeNulls()) { JsonObject object = (JsonObject) peek(); object.add(pendingName, value); } pendingName = null; } else if (stack.isEmpty()) { product = value; } else { ...
5a98d908-e8e2-4320-a74f-01a0f00fac46
8
public void keyPressed( KeyEvent e ) { int iday = getSelectedDay(); switch ( e.getKeyCode() ) { case KeyEvent.VK_LEFT: if ( iday > 1 ) setSelected( iday-1 ); break; case KeyEvent.VK_RIGHT: if ( iday < lastDay ) setSelected( iday+1 ); break; case KeyEvent.VK_UP: if ( iday > 7 ) setSel...
37a58686-48be-477d-8e6a-f5f3d69a53d0
9
private static boolean bestPermutationMutated (Tour tour, int a, int b, int c, int d, int e, int f) { City A = tour.getCity(a); City B = tour.getCity(b); City C = tour.getCity(c); City D = tour.getCity(d); City E = tour.getCity(e); City F = tour.getCity(f); double[] dist = new double...
79abc85e-e7ab-4dc6-9090-0c6d5757a52f
3
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jColorChooser1 = new javax.swing.JColorChooser(); jColorChooser2 = new javax.swing.JColorChooser(); buttonGroup1 = new javax.swing.But...
8d586758-e8a1-428c-8865-11e9b4371849
2
@Override public String getLabel() { if (Java8Util.PARAMETER_NAME == null) { throw new IllegalStateException("Missing Label"); } try { return Java8Util.PARAMETER_NAME.invoke(javaParameter).toString(); } catch (IllegalAccessException...
355b61f8-4408-4897-ab62-c4d3818bd44f
8
private static String addScriptDirectives(Element scriptElement) throws IOException, DocumentTemplateException { String scriptReplacement = ""; List scriptParts = parseScriptParts(scriptElement.getValue()); for (int index = 0; index < scriptParts.size(); index++) { ScriptPart scriptPart = (ScriptPart) scrip...
77b319a8-73f3-4d7a-9c17-84f0b35d0f05
6
public void initFromXML( Element node, String projectDir ) { NodeList nList = node.getElementsByTagName("settings") ; Element elem = null ; // a settings entry was found if (nList != null) { if (nList.getLength() > 0) { elem = (Element) nList.item(0) ; setProjectName( ...
47911940-e280-457d-a102-10d257c0f289
8
public static void displayJob(String selected) { Position position = Position.fromString(selected); Map<Evaluation, Set<Dwarf>> eval = new EnumMap<Evaluation, Set<Dwarf>>(Evaluation.class); for (Dwarf dwarf : dwarvesList) { Evaluation evaluation = position.evaluate(dwarf); ...
2cc51531-f616-43c5-88bf-318985ddbdc7
3
public boolean validateAndStartScriptExecutable(ScriptExecutable pScriptExecutable, int pStatementSequence) { try { if(pScriptExecutable instanceof ScriptSQL){ ScriptSQL lScriptSQL = (ScriptSQL) pScriptExecutable; //Check if we can run this exectuable boolean lRunAllow...
9ab65648-1949-40a4-83eb-15cf81677aea
0
public State getState() { return this.state; }
6ec79bdc-9cfa-4cb1-b1ed-14bc1676c408
7
public void setOptions(String[] options) throws Exception { String classifierString = Utils.getOption('W', options); if (classifierString.length() == 0) classifierString = weka.classifiers.rules.ZeroR.class.getName(); String[] classifierSpec = Utils.splitOptions(classifierString); if (classifierS...
b7d45efb-fc2c-4c20-bfe9-40a9f2640a99
2
public void copy(int[] src, int[] dst) { for (int i = 0; i < dst.length; i++) { if (src.length > i) { dst[i] = src[i]; } else { dst[i] = 0; } } }
b7170762-b4f7-42ec-a696-f517d0b67afd
5
public static boolean checkInBounds(Object array, int... coords) { for (int i = 0; i < coords.length; ++i) { if (i > 0) array = Array.get(array, coords[i - 1]); if (!array.getClass().isArray()) return false; if (coords[i] < 0 || coords[i] >= Array.getLength(array)) return false; } return true...
3614bd2f-cd05-492d-9e92-93a87420a897
3
private Tree argumentListPro(){ Tree argumentList = null; ArgumentListExpression argumentLists = null; if((argumentList = expressionPro()) != null){ if(accept(Symbol.Id.PUNCTUATORS,",")!=null){ if((argumentLists = (ArgumentListExpression) argumentListPro()) != null){ return new ArgumentListExpressi...
7bb12b3a-8310-4319-be0a-aac7a0368daa
9
@SuppressWarnings("unchecked") private void gatherAndLoad(ExecutionPlan plan, Collection<Class<?>> entities) { List<Class<?>> sortedEntities = new ArrayList<Class<?>>(entities); Collections.sort(List.class.cast(sortedEntities), Schema.CLASS_COMPARATOR); for (Class<?> c : sortedEntities) { plan.addOperation(ne...