method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9a8d7351-9415-400c-874b-181d6323af0b
6
protected byte[] encrypt(RSAPublicKey rsaPublicKey, byte[] obj){ if (rsaPublicKey != null) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, rsaPublicKey); return cipher.doFinal(obj); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuch...
7b02e194-6d43-4f9f-a880-97f03d8e7110
1
private boolean jj_3_53() { if (jj_3R_71()) return true; return false; }
bc14193c-601d-4d89-b0b5-20af0bfc8ba6
1
@Override public int hashCode() { int result = starClass != null ? starClass.hashCode() : 0; result = 31 * result + temperature; result = 31 * result + name.hashCode(); return result; }
42ead56a-b4b4-4367-90af-3730ecd13e2f
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTargetAnywhere(mob,commands,givenTarget,false,true,false); if(target==null) return false; final Ability A=target.fetchEffect(ID()); if(A!=null) { A.unInvoke(); mob...
7ea1e902-068b-4a21-9e33-c57e24efdf8e
9
public boolean cantarReTruco(){ if((this.getCartas()[0].getValor() > 9)&&(this.getCartas()[1].getValor() > 9)){ return true; }else if((this.getCartas()[1].getValor() > 9)&&(this.getCartas()[2].getValor() > 9)){ return true; }else if((this.getCartas()[0].getValor() > 9)&&(this.getCartas()[2].getValor() > 9))...
a9ad7c34-d434-47e0-9771-9a21e58330c7
5
@Override public Key readInput() { //Check if we have ctrl+c coming Key key = super.readInput(); if(key != null && terminalBehaviour == Behaviour.CTRL_C_KILLS_APPLICATION && key.getCharacter() == 'c' && !key.isAltPressed() && ...
0796a99f-2626-4ee0-83dd-b2afe73c1bbd
6
static int solve(int budget, int dish, int amount) { if (dish == k) return 0; if (dp[budget][dish][amount] != -1) return dp[budget][dish][amount]; int best = 0, tax = 0, spent = (n * (x - t)) - budget, remain; // Two tax = (int) Math.ceil((spent + c[dish] * 2 + t * n) * 0.1); remain = budget - c[di...
9be0cbf8-eb8b-4ec7-8ffe-1fe205b33cdf
1
public double randomFunction(double x, double y){ if(this.randomXY <= 0.5){ return x; } else{ return y; } }
1732f112-3f44-4bc3-8b35-707e321151d9
9
@Override public int compare(Weapon weapon1, Weapon weapon2) { int compare = 0; switch (weapon1) { case ROCK: switch (weapon2) { case PAPER: compare = -1; break; case SCISSORS: ...
fe004151-d9ef-4e5b-a220-06286b94b920
6
public void filterBullets() { ArrayList<Bullet> toDel = new ArrayList<Bullet>(); for (Bullet bullet : bullets) { if (bullet.pos.x <= 0 || bullet.pos.x >= Game.WIDTH || bullet.pos.y < 0 || bullet.pos.y > Game.HEIGHT) toDel.add(bullet); } for (Bullet bullet : to...
032a09c3-8abe-40d8-bb28-0ab69426e491
2
public static void main(final String args[]) { /* Create and display the form */ if(args.length != 0) { String name = args[0]; try { QueryDefinition query = Settings.getInstance().getQuery(name); Response response = query.execute(); System.out.print(response.getRawValue...
f8945a64-589b-4bcd-bd5d-bdb15aa25d26
5
public void keyPressed(KeyEvent arg0) { switch (arg0.getKeyCode()) { case KeyEvent.VK_UP: upKey.setPressed(true); break; case KeyEvent.VK_DOWN: downKey.setPressed(true); break; case KeyEvent.VK_SPACE: spaceKey.setPressed(true); break; case KeyEvent.VK_LEFT: leftKey.setPressed(true); b...
6bb02f59-6742-4213-a049-abb3afc630f4
3
private void paintBackgroundAndPieces(Graphics g) { for(int i = 0 ;i < 64;i++) { int x = i%8; int y = i/8; if((x+y)%2==0) {g.fillRect(myCellSize*(x), myCellSize*(y), myCellSize, myCellSize);} Piece pieceAtPosition = myGame.getPiece(new Point(x,7-y)); if(pieceAtPosition!=null) { g.dr...
57090384-fbef-45a8-be2e-a69b69216e63
5
public static void canPlayOffline(){ boolean needUpdate = false; File jars[] = new File[4]; String binPath = new String(Util.getWorkingDirectory() + File.separator + "bin" + File.separator); jars[0] = new File(binPath + "minecraft.jar"); jars[1] = new File(binPath + "lwjgl.jar"); jar...
eeb36dd2-1b9e-4e6d-96e1-eb1f9d658ffb
5
public String getJenkinsRelativePath(String urlPrefix) { try { URL url = new URL(urlPrefix+"lastStableBuild/api/xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(url.openStream()); NodeList jobs = doc.get...
3da44b88-246c-465a-baef-ca2aee3d92f7
4
public double getTotalCapPerSquareMetre(){ if(this.psi0set && this.sigmaSet){ return this.totalCap; } else{ if(this.sigmaSet){ this.getSurfacePotential(); return this.totalCap; } else{ if(this.psi0set...
31d38e75-e466-41f2-afce-30793d3f013f
2
private void getGroupImages(String line) { StringTokenizer tokens = new StringTokenizer(line); if (tokens.countTokens() < 3) { EIError.debugMsg("Wrong no. of arguments for " + line, EIError.ErrorLevel.Error); } else { tokens.nextToken(); // skip command label ...
73b7f3b8-8355-4e54-80b5-710f66aa03aa
5
private List<String> getMail(int n) { List<String> mailContent = new ArrayList<String>(); String response = ""; try { sTrace.debug("Try RETR " + n + " Command"); writeToServer("RETR " + n); boolean noFullstop = true; if (response.startsWith("-ERR")) { sTrace.error("Could not Retrive Mail " + n); ...
902732f3-7f24-436f-a7ec-41ced12b8253
9
public void drawarrows(GOut g) { Coord oc = viewoffset(sz, mc); Coord hsz = sz.div(2); //half size double ca = -Coord.z.angle(hsz); for (Party.Member partyMember : glob.party.memb.values()) { // Gob gob = glob.oc.getgob(id); Coord memberCoords = partyMember.getc(); if (memberCoords == null) continu...
60769c64-e21b-4a46-b1d2-b57c0e9631ce
9
public static String[] majorServiceToName(int d) { Vector v = new Vector(); if ((d & 0x2000) > 0) { v.addElement("LimitedDiscoverableMode"); } if ((d & 0x10000) > 0) { v.addElement("Positioning"); } if ((d & 0x20000) > 0) { v.addElement("Networking"); } if ((d & 0x40000) > 0) { v.addElement...
66186692-9a55-4ed7-ba60-e9d60688c3d4
7
public void run() { while ( true ) { try { semaphore.acquire(); } catch (InterruptedException ex) { Logger.getLogger(Manos.class.getName()).log(Level.SEVERE, null, ex); } while (distanciaActual > 130) { try { ...
5e2503d1-73e9-4a27-8d2c-79764a22c3c3
0
public void setId(int id) { this.id = id; }
1c245fac-296e-4c49-8421-459f01845078
1
public Help() { command = config.getSetting("command"); Match addons = config.getMatch("content").children(); content = new String[ addons.size() ]; int index = 0; for ( Match addon : addons.each() ) content[index++] = addon.first().tag() + ": " + addon.first().text(...
9ef0b8a6-082e-43eb-b98a-f5b3d9102ae9
5
protected void extract_threshold_lists(ArrayList<String> argv) { ArrayList<Double> thresholds_list = new ArrayList<Double>(); try { while (!argv.isEmpty()) { thresholds_list.add(Double.valueOf(argv.get(0))); argv.remove(0); } } catch (NumberFormatException e) { } if (IOExte...
1c306ed5-37d7-493b-a6e8-70897f948eaa
9
protected synchronized void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit) { if (children == null) { return; } for (int i=0; i<source.length; i++) { NodeImpl child = (NodeImpl)source[i]; child.parent = this; int kind = child.getNo...
269e3525-3b2f-412e-ab4c-56ebd6b8f5eb
0
public void setStatus(boolean accept) { isAccept = accept; }
f46eee7d-cf96-4adf-be57-c57425f5b9ad
7
@Override public void run() { run = true; while (run) { try { server.listen(); } catch (SocketException e) { LOGGER.log(Level.INFO, "ServerSocket has been closed. ListenThread will now terminate"); run = false; } cat...
fdea9276-29af-4010-b971-a33ccc629bc5
4
public static int rob(int[] nums) { int length = nums.length; if (length <= 0) return 0; int[] robs = new int[length]; int[] norobs = new int[length]; robs[0] = nums[0]; norobs[0] = 0; for (int i = 1; i < length; i++) { norobs[i] = robs[i - 1]; robs[i] = norobs[i - 1] + nums[i]; ...
bac35999-9f39-4cb7-86d8-9980132136d4
9
private int decodeHandle() { int index = _index; int base = _bytes[index++] & 0xFF; int result = base & 0x00000007; int v; switch (base & TYPE_CODER1) { case TYPE_CODER6: v = _bytes[index++] & 0xFF; if ((v & 0xC0) != 0xC0) break; ...
4876ef86-459c-4a6d-ad85-5b75d12294be
5
public Rectangle getImageBounds (int columnIndex) { checkWidget (); if (!parent.checkData (this, true)) SWT.error (SWT.ERROR_WIDGET_DISPOSED); int validColumnCount = Math.max (1, parent.columns.length); if (!(0 <= columnIndex && columnIndex < validColumnCount)) return new Rectangle (0,0,0,0); int padding = parent...
a8f27a82-9934-4faf-8c06-17241671098b
9
private double calculateCosimilarity(ArrayList<Integer> leftVector,ArrayList<Integer> rightVector){ double result = 0; double sizeLeft = 0; double sizeRight = 0; System.out.println("leftVector = "+leftVector); System.out.println("rightVector = "+rightVector); for(int i =0;i<leftVector.size();...
d00f6c24-6f84-48b8-a661-65577a7a77f1
7
public String addBinary(String a, String b) { int lenA = a.length(); int lenB = b.length(); String result = ""; boolean inc = false; while(lenA>0||lenB>0){ int value = 0; if (lenA>0){ value += (a.charAt(lenA-1)-'0'); lenA--;...
31e00139-7e92-4c2c-91c1-1004eaae4373
4
public static Message getMessageByXMLElem(XMLElement root) { if (!root.attributeMap.containsKey("type")) { System.out.println("Message type must have a 'type' field"); return null; } String type = root.attributeMap.get("type"); if (type.equals("challenge")) { return ChallengeMessage.getChallengeMess...
83f4ea65-a99c-41ba-85e2-fb0834a8bfcc
9
void run(){ Scanner sc = new Scanner(System.in); for(;;){ int n = sc.nextInt(); int m = sc.nextInt(); if((n|m)==0)break; int[] a = new int[n]; for(int i=0;i<n;i++)a[i]=sc.nextInt(); int assign = 0; int time = get(a[0], m); int d = a[0]; boolean f = false; for(int i=1;i<n;i++){ int ...
d632ee29-ad7b-4694-8a31-7688a95ce855
2
private void parseBicsString(CounterParty counterParty, String bicsString){ if(bicsString!=null){ String[] bicsStrings = bicsString.split("\\Q | \\E"); for(int i=0;i<bicsStrings.length;i++){ counterParty.getAccountsList().get(i).setBic(bicsStrings[i]); } ...
af0c6488-1621-45f5-98e1-3ae7267c149e
4
public void spawnRateSlow() { if (spawnCounter > 500) { spawnCounter = 0; double spawnRandom = Math.random(); if (spawnRandom <= 0.33) { Boat b1 = new Boat(30,1,600,exit1); addObject(b1,800,61); } else if (spawnRan...
555aef4e-557c-4e1a-a94e-1753b4f3c03b
9
public void setSprites(){ if(facingDown){ if(currentAction != DOWN){ currentAction = DOWN; animation.setFrames(sprites.get(DOWN)); animation.setDelay(100); } }else if(facingUp){ if(currentAction != UP){ currentAction = UP; animation.setFrames(sprites.get(UP)); animation.setDelay(100); } ...
81681630-96ec-4d44-a0f4-f2f10a57b7d7
2
public static Point[] getThreeByThreeAround(Point point, int blockSize) { /* 0 1 2 * 3 4 5 * 6 7 8 */ Point[] result = new Point[9]; int i = 0; for(int x = point.x - blockSize; x <= point.x + blockSize; x += blockSize) { for(int y = point.y - blockSize; y <= point.y + blockSize; y += blockSize) { ...
5e6a3d66-306e-4304-a82a-64412d899fb9
9
@Override public void onTurnEnded(TurnEndedEvent event) { final ITurnSnapshot turn = event.getTurnSnapshot(); if (turn == null) { return; } final IRobotSnapshot[] robots = turn.getRobots(); final IScoreSnapshot[] scoreSnapshotList = event.getTurnSnapshot().getIndexedTeamScores(); maxEnergy = 0...
c8e9d55d-0f74-44f7-b5ec-e1fc79166723
5
public static void main(String[] args) throws ClassNotFoundException { // load the sqlite-JDBC driver using the current class loader int x = 0; Class.forName("org.sqlite.JDBC"); Connection connection = null; try { // create a database connection connection = DriverManager.getConnection("jdbc:sqlite:Pres...
f43e7aae-ec09-4fdd-9066-5d700f79c71c
3
public void addPlayer(Player player) { if(state == GameState.BEFORE) { if(players.size() < 2) { if(players.size() == 0) { player.setColor(PieceColor.BLACK); } else { player.setColor(PieceColor.WHITE); } players.add(player); setChang...
df4ac380-08f6-41e5-871f-c65d9c51731c
8
static int processCSVStream(final InputStream input, final Token token) throws IOException, SQLException { final Scanner scanner = new Scanner(input); String[] paramNames = null; final Map<String, String[]> valuesMap = new HashMap<>(); int affectedRows = 0; try { while (scanner.hasNextLine()) { fina...
a4e6a727-da78-4d48-8e39-7a1744f411ce
1
private void _releaseResources() throws WriterException { try { this.lock.release(); this.lock.close(); this.channel.close(); this.file.close(); } catch (IOException e) { throw new WriterException(e.getMessage()); } }
8a96781b-9f31-4a6a-9ee5-25e1471dfd31
9
@Override public void keyPressed(KeyEvent e) { int multiplier = 10; if(e.isShiftDown()){ multiplier=1; }else if( e.isAltDown()){ multiplier = 100; }else if(e.isMetaDown()){ switch(e.getKeyCode()){ case KeyEvent.VK_UP: chart.zoom(-5, chart.getWidth()/2, chart.getHeight()/2); break; case KeyEv...
b1a7f1fa-359a-462d-905b-4155476be43f
8
public static Object invoke( Method method, Object target, Object... parameters ) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if( method.getDeclaringClass() == ClassLoader.class && method.getName().equals("defineClass") && method.isAccessible() ) { Class<?>[] paramTypes =...
5efd4639-599e-4370-9c03-1b0d40674862
0
public static Builder validateValue(final Object paramValue) { Builder builder = new Builder(paramValue); return builder; }
cb923202-6ed5-4d4d-81e9-940b06c0010d
5
public void destroy(Integer id) throws NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); Comment comment; try { comment = em.getReference(Comment.class, id...
98a08dc0-0d1e-452e-9050-d5bca8ddc077
8
private void postPlugin(boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc PluginDescriptionFile description = plugin.getDescription(); // Construct the post data String data = encode("guid") + '=' + e...
ce8298a5-a7a1-49c9-b8dd-4fa1a46b2a17
9
private void getStartingPointToDrawCenteredImage() { Logger.getLogger(ReadComponent.class.getName()).entering(ReadComponent.class.getName(), "getStartingPointToDrawCenteredImage"); if (readInterfaceScrollPane != null) { readInterfaceScrollPane.validate(); if (drawingImageHeigh > ...
500e00d8-b5d8-4457-953d-b69c6198a31e
1
public boolean hasCoffer(Player player){ if(player==null) return false; return coffers.contains(player); }
a43e0b31-0127-4deb-975d-b73d2168cbd9
4
public void Update() { if (move.equalsIgnoreCase("up")) { this.SetAnimLayer(1); } else if (move.equalsIgnoreCase("down")) { this.SetAnimLayer(2); } else if (move.equalsIgnoreCase("left")) { this.SetAnimLayer(3); } else if (move.equalsIgnoreCase("right")) { this.SetAnimLayer(4); } else { ...
32572399-6806-466c-8481-dda97f42b428
2
public void siirra(int xMuutos){ if (this.x + xMuutos >= 0 && this.x + xMuutos < 10){ this.x = this.x + xMuutos; } }
21a60ee6-b16a-4e3c-8f62-d23ac7f3c431
7
private int waveform( int phase, int wform ) { int amplitude; amplitude = 0; switch( wform & 0x3 ) { case 0: /* Sine. */ if( ( phase & 0x20 ) == 0 ) { amplitude = sine_table[ phase & 0x1F ]; } else { amplitude = -sine_table[ phase & 0x1F ]; } break; case 1: /* Saw. */ ...
f41235ee-a220-408e-a0c6-9b2d1615a0b5
5
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuffer rs = new StringBuffer(); int c1, c2; if (len <= 0 || len > d.length) throw new IllegalArgumentException ("Invalid len"); while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_co...
fb30b81e-e645-463e-9dfe-c0d007169ae4
0
protected AutomatonDrawer getDrawer() { return drawer; }
1f5e1cf7-704d-4ab8-baa7-d0ef117d1629
1
* @throws IOException if a communications error occurs * @throws UnknownHostException if the Cyc server cannot be found * @throws CycApiException if the Cyc server returns an error */ public void unassertMtContentsWithTranscript(CycObject mt) throws UnknownHostException, IOException, CycApiExceptio...
4aaffefb-359e-4f6d-b803-b7ce9bfff78a
0
public void mouseClicked(MouseEvent e) { }
608c3650-f8d6-43f5-a770-594e28535d90
6
public boolean trasferBalance(int origen, int destino, double monto){ boolean state = false; if(!activo.validateTipo(Usuario.LIMITADO)){ if(origen>0 && destino>0 && origen!=destino){ int indexO = searchIndex(origen, !state); int indexD = searchIndex(destino, s...
a4c0cb32-5da4-4e2b-906c-e074d928a9a1
8
public static void createProductTypeHierarchy(Long[] seeds) { System.out.println("Generating Product Type Hierarchy..."); DateGenerator publishDateGen = new DateGenerator(new GregorianCalendar(2000,05,20),new GregorianCalendar(2000,06,23),seeds[0]); ValueGenerator valueGen = new ValueGenerator(seeds[1]); Ob...
de71c5af-5898-4dd6-8e76-a22424f85808
4
public double getMinimumDifference_as_double(){ double diff = 0.0D; if(this.type==0 || this.type==1){ ArrayMaths am = this.sort(); double[] sorted = am.getArray_as_double(); diff = sorted[1] - sorted[0]; double minDiff = diff; for(int i=1; i<th...
8536f5bd-a853-49af-a417-00f762720e79
2
public boolean equals(Object o) { if (o instanceof Card) { Card c = (Card) o; if (this.card.equals(c.card)) return true; } return false; }
d6ed2b6f-3a95-40ee-831c-048abd396372
1
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.BLUE); for (int i = 1; i <= 10; i++) { g2d.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, i * 0.1f)); g2d.fillRect(50 *...
8f94ca7b-6188-4238-934e-2063e2f71816
3
public static Map<String, String> getLocators(String pageName) { Map<String, String> locators = locatorsMap.get(pageName); paths.put(pageName, getlocatorsDirectory() + pageName.toString() + ".properties"); if(locators != null) return locators; locators = new HashMap<Str...
77a6b18e-5d90-47df-b0aa-868b1702d5ef
0
public void setDepartmentName(String departmentName) { this.departmentName = departmentName; }
57089c71-6535-404e-9ace-3143f3802d08
4
public boolean actionMineTile(Actor actor, Tile face) { float progressChance = successCheck(actor, face.habitat()) / 10f ; final Item left = mineralsLeft(face) ; if (left == null) return false ; final float bonus = site.extractionBonus(left.type) ; progressChance *= 1 + (bonus / 2f) ; if (Rand.n...
8180be0f-0d34-4243-b473-d8d7b787aea3
7
private void jButtonAddUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddUsuarioActionPerformed // TODO add your handling code here: if(jTextFieldCod.getText() == null || jTextFieldCod.getText().equals("")){ jLabelErro.setErrorText(WORDS.getString("ERRO-CODI...
2e01cb5a-d8e8-4507-bb21-417762db65d6
1
private boolean isMineshafterPresent() { try { Class.forName("mineshafter.MineServer"); return true; } catch (Exception e) { return false; } }
51bad91c-d282-44c6-9e6a-f727845fe555
3
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } String settingsFileName = null; for (int i = 0; i < args.length; i++) { if ("-i".equals(args[i])) { settingsFileName = args[++i]; }...
504d06df-e456-40ae-ab1f-6497598f8e5c
3
public String getClassName(int i) throws ClassFormatException { if (i == 0) return null; if (tags[i] != CLASS) throw new ClassFormatException("Tag mismatch"); String clName = getUTF8(indices1[i]); try { TypeSignature.checkTypeSig("L" + clName + ";"); } catch (IllegalArgumentException ex) { throw n...
34e9124f-1ed5-4f39-9e19-c171ca00a07d
1
public boolean setWindowWidth(int width) { boolean ret = true; if (width < UISizeInits.WINDOW.getWidth()) { this.window_Width = UISizeInits.WINDOW.getWidth(); ret = false; } else { this.window_Width = width; } somethingChanged(); ret...
ca4395fc-6bb7-439d-a334-abfca02d68c5
1
public SkiPass getDaysSkiPass(int numDays) { if (numDays <= 0) { throw new IllegalArgumentException("Cannot create card for non-positive number of days"); } Calendar calendar = new GregorianCalendar(); Date activationDate = calendar.getTime(); calendar.add(Calendar.D...
a66ea69f-ecee-4a37-9d80-0ac0c2021414
2
@Override public String getText() { if(checkInput()) { String ret = ""; for (JTextField i : components) ret += i.getText() + "#"; return ret; } else return null; }
b653cdac-b715-4d5f-ab55-d55cd26dc4a9
1
public void moveClicked() { if (hero != null) { scroll.ensureVisible(this.hero.getX()*64, this.hero.getY()*64, 64*4, 64*4); } minimap.repaint(); }
8c69c606-93be-46a1-bc0f-2fc242e4f55d
3
public void verbindeRaeume(EditorMap map) { _map = map; GridButton[][] array = _map.getButtonArray(); _arraySpaltenzahl = array.length; _arrayZeilenzahl = array[0].length; _raumListe = new ArrayList<Raum>(); _raumArray = liesRaeumeAusButtonArray(); loescheAlleVerbindungen(); for(int y = 0; y < _arra...
33cc8ff3-5fc3-4116-97b1-b87401bbf5c3
1
private double eucDistance( double[] a, double[] b) { double sumDSquared = 0.0; int n = a.length; for(int i = 0; i < n; i++) { sumDSquared += (a[i]-b[i])*(a[i]-b[i]); } return Math.sqrt(sumDSquared); }
11adcce8-f112-49aa-ac1d-9637c88b232a
4
public static VariableDependencyGraph getVariableDependencyGraph( Grammar grammar) { VariableDependencyGraph graph = new VariableDependencyGraph(); initializeVariableDependencyGraph(graph, grammar); String[] variables = (String[]) getCompleteUsefulVariableSet(grammar) .toArray(new String[0]); for (int k ...
b4d17821-627c-42de-be9d-f0d5009debea
2
public pgrid.service.corba.PeerReference replace (String failedPath, pgrid.service.corba.repair.RepairIssue[] issues) { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("replace", true); $out.write_string ...
681290f5-1520-45d2-b0ce-d944f1f7dcfd
3
public static int lengthOfLongestSubstring(String s){ int length=0; HashMap<Character, Integer> hm=new HashMap<>(); for(int i=0;i< s.length();i++){ if(!hm.containsKey(s.charAt(i))) hm.put(s.charAt(i),i); else{ length=length>hm.size()?length:hm.size(); i=hm.get(s.charAt(i)); hm.clear(); }...
a77e1a4c-0204-41d0-ada3-6161310ab61a
5
public boolean hasChanged() { if (parent != null && parent.hasChanged()) return true; if (!pos.equals(oldPos)) return true; if (!rot.equals(oldRot)) return true; if (!scale.equals(oldScale)) return true; return false; }
1ad30be8-65b9-46bc-9bdf-aa8bbb6ff791
9
private boolean r_Step_4() { int among_var; int v_1; // (, line 91 // [, line 92 ket = cursor; // substring, line 92 among_var = find_among_b(a_5, 19); if (among_var == 0) ...
2a0084ca-38df-42f3-8dec-476abde54c1c
7
private Player study(Player player) { ArrayList<Flashdrive> fInv = new ArrayList<Flashdrive>(); fInv = player.getFlash(); ArrayList<Textbook> tInv = new ArrayList<Textbook>(); tInv = player.getBooks(); boolean studying = true; Scanner in = new Scanner(System.in); String response; while (studying) { S...
bd60ddf0-4545-43cc-b84f-5cac1c7ce9f4
1
public void uimsg(String name, Object... args) { if(name == "ch") { this.state = (Integer)args[0]; } else { super.uimsg(name, args); } }
420e8504-ec7a-46e3-80fd-125cb8133640
6
public static Message process(Message m) throws JSONException{ Map<String,Object> msg = new HashMap<String,Object>(); try{ if(m.containsKey("isRegistration") && m.get("isRegistration") != null && m.get("isRegistration").equalsIgnoreCase("YES")){ addClient(m); msg.put("STATUS",Constants.SUCCESS); retu...
516e8900-4dce-4a71-aaa2-33895d071f51
8
public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_LEFT) { xa = -1; if (left) { sAngle = 225; limit = 225; fill = 270; limit2 = 180; } right = true; up = true; left = false; down = true; } if(e.getKeyCode() == KeyEvent.VK_RIGHT) { //countMoves = 0; ...
b1b1afce-cef0-49ae-8a65-bccaef51056b
1
@Override public int rollback() { int allCanceled = 0; for (int i = 0; i < 256; ++i) { allCanceled += files[i].getNewKeys(); files[i].rollback(); } return allCanceled; }
58b17475-bb19-44b3-be4c-769056528f01
7
public void populateSolvers(){ solverAgents = new ArrayList<AMSAgentDescription>(); SearchConstraints sc = new SearchConstraints(); sc.setMaxResults(100L); // not sure of the default value, but this ensures you get them all. AMSAgentDescription[] evalAgents = null; try { ...
5dd280e5-7a42-410f-9b51-27fd1f7ce8cf
8
private static List<List<String>> pricerowDataExtractor() throws SQLException { List<List<String>> rows = new ArrayList<>(); String basicProdcatDataQuery = "select upc, avg_price from `products-cpg-nutrition`"; Connection connection = ConnectionManager.getConnection(); Statement statem...
6c33d126-1e26-4c75-b6da-02a9a3c78631
8
private void addEnum(Class clazz) { Mapping<?, ?> mapping; if (clazz.isAnnotationPresent(DefEnumAtoms.class)) { mapping = new AtomEnumMapping(clazz); } else if (clazz.isAnnotationPresent(DefEnumConstants.class)) { mapping = new ConstantEnumMapping(claz...
3c7e52c6-9e7f-4a63-bedd-aac57d885120
8
public Map<String, Integer> getAttributs (String table) { Map<String, Integer> resul = new HashMap<String, Integer>(); try { Connection conn = connect(); ResultSet res = null; Statement stmt = conn.createStatement(); stmt.setQueryTimeout(iTimeout); res = stmt.executeQuery("PRAGMA table_info (" +...
79f2f128-806f-42ae-a78d-5b8908741e18
7
@Override public String toString() { if (children == null || children.size() == 0) { return this.getText(); } StringBuffer buf = new StringBuffer(); if (children != null) { buf.append("("); buf.append(this.getText()); buf.append(' '); ...
15ce1c1d-ffca-4c51-a16f-cd141787a58e
1
@Test public void testAddToStart() throws Exception{ List<String> list = new List<>(); list.addToStart("test1", 1); list.addToStart("test2", 3); list.addToStart("test3", 5); for (String current : list) { assertTrue(list.exist(current)); } }
bfd14662-3aff-475d-a5e5-32baca4d19a3
6
public TextBox(Entity owner, String message, boolean kill) { this.ID = "textBox"; this.x = owner.getPosition().x*Vars.PPM + owner.rh; this.y = owner.getPosition().y*Vars.PPM + owner.rw / 2; origLayer = Vars.BIT_LAYER1; isAttackable = false; selfKill = kill; animation = new Animation(this); this.msgSr...
cf1682c9-ba8e-42fc-b299-3631ed8e8049
1
public void moveVertical(int movement) { if(!falling) { stopVer = true; moveVer = movement; } }
34d0a650-9bb5-4773-a023-904d52709e60
8
public static void main(String[] args) { final String lookupPath = "C:/programe files/altools"; // 모니터링 대상 경로 final String lookupPath2 = "D:/fileTestDir"; // 모니터링 대상 경로 final String resultSavePath = "C:/result.txt"; // 저장파일 경로 Timer timer = new Timer("Directory Size Check"); timer.schedule(new ...
7e3c2086-5a56-405b-a1f2-03f6a74abce5
7
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { return (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) || (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) || (par5 == 4 && par1World.isBlockSo...
7f0b8696-aaea-47fc-bfa5-5e193309b5ac
3
public Color getDefaultRowBackground(int position, boolean selected, boolean active) { if (selected) { Color color = UIManager.getColor("List.selectionBackground"); //$NON-NLS-1$ if (!active) { color = Colors.adjustSaturation(color, -0.5f); } return color; } return mUseBanding ? Colors.getBanding(...
f7c6f0cf-040a-47fa-9262-b03983b79bfa
1
public static long positionStringToBin(String pos_str){ if( !pos_str.matches("^[a-h][1-8]$") ) throw new IllegalArgumentException(); int ASCII_DEC_a = 97; // ASCII code decimal representation for 'a' int ASCII_DEC_1 = 49; // ASCII code decimal representation for '1' int...
90ea8a54-dd1c-46ce-b324-06f0c95ec32b
9
public static void main(String[] args) { int port = -1; String host = null; if (args.length==3) { name = args[0]; host = args[1]; try { port = Integer.parseInt(args[2]); } catch (Exception e) { port = -1; } } if (port==(-1)) { io.p("What is your name? "); name = io.read...
841a7088-d62c-41c8-a598-232edfd86d8a
2
public void join_pipes() { try { for (Thread t : threads) { t.join(); } } catch (InterruptedException e) { setException(e); } }
57dd9ad6-f25e-49c6-841e-30db86b85b23
4
public void enableEdit() { disableEdit(); nameField.setEnabled(true); nameField.setText(list.getSelectedValue().substring(0, list.getSelectedValue().indexOf(';'))); switch(list.getSelectedValue().charAt(list.getSelectedValue().indexOf(';') + 1)) { case 'S': stringField.setEnabled(true); stringField.s...