method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3393fa64-eaf4-4917-93ba-e405035e8dfd
3
public boolean contains(int x, int y) { for (Node node : waypoints) { if (node.getX() == x && node.getY() == y) return true; } return false; }
0ed10c96-c808-499d-a061-ac75021b9af9
6
public void checkIsCovering(List<String> oneAttrCombo){ //Get partition for this combination of non decision attributes Set<List<Integer>> singlePartition = computePartition(oneAttrCombo); //Check to see if it's a possible covering if(isCoveringCanidate(singlePartition, decisionPartition)) { System.out.print...
d0d95a21-479a-4ebc-a9c4-35dafa509894
0
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(super.toString() + "\n"); sb.append(verticesToPoints); return sb.toString(); }
61c79e5c-845d-41aa-a3b3-5ae94551a881
2
public void hashOutput() { for (int i = 0; i < length; i++) { if (!hashTable[i].isEmpty()) { hashTable[i].output(); } } }
05275300-29fd-4111-8934-82cfa803f1f3
8
@Override public void paintComponent(Graphics g) { super.paintComponent(g); int increment = 15; int start = 7; if(owner != gameBoard.bank) { if(((Player)owner).getNumber() == 1) g.setColor(GameBoard.PLAYER1); else if(((Player)owner).getNumber() == 2) g.setColor(GameBoard.PLAYER2); else i...
01e3bf46-7224-4bf7-973c-3b598cc64344
6
public static void main(String[] args){ int[] primes = new int[1000000]; //possible list of primes for(int i = 0; i<primes.length; i++){ primes[i] = 0; } primes[0] = 2; int arrayi = 1; //array index (where the next prime will go) long total = 2; //the sum of all values of the array System.out.print...
6d53bdf4-e3d5-47ce-917e-d7fd947a4576
8
public Players getPlayers(Main plugin) { ProxyServer proxy = plugin.getProxy(); synchronized(this) { if (!loadedPlayerList) { if (playerListServers != null) { playerListServersSet = new HashSet(playerListServers.size()); for (String ser...
22085aa2-01b9-4ed8-a02d-285efe638ce9
2
public static JDBCConnect getInstance() { if (singleInstance == null) { synchronized (JDBCConnect.class) { if (singleInstance == null) { singleInstance = new JDBCConnect(); } } } return singleInstance; }
1e327696-9a15-4b3d-b6dc-3174c63b9cdb
6
private double parseList() throws InvalidEquationException{ //Create a variable to keep track of last relevant rank int lastRank = 0; //For each index of the list for(int i = 0; i < expList.size(); i++){ //If the next rank is 0 it is a numerical expression and should just be added without question if(ex...
53bdf307-6c8a-4225-9a47-26b9ecc5c539
8
public static ArrayList<Integer> KMP(String cadena, String patron) { int[] fallas = new int[patron.length() + 1]; ArrayList<Integer> coincidencias = new ArrayList<Integer>(); int pos; Arrays.fill(fallas, -1); // funcion de fallas for (int i = 1; i <= patron.length(); i++) { pos = fallas[i - 1]; whi...
9451f03a-1e34-4700-961e-2bddc17777df
3
private void SelecioneMinhaGeracao () { listaPopulacaoDaMinhaGeracao = new ArrayList<Caminho>(); if(mecanismoDeSelecaoDaMinhaGeracao == 0) { ranking = new Ranking(taxaSelecaoDaMinhaGeracao, listaDaPonteControladora); listaPopulacaoDaMinhaGeracao = ranking.listaPopulacaoR...
1fbd294d-a4a0-4ba2-a020-c2970c4a493d
4
public void checkType(Symtab st) { exp1.setScope(scope); exp1.checkType(st); exp2.setScope(scope); exp2.checkType(st); if (!exp1.getType(st).equals("int") && !exp1.getType(st).equals("decimal")) Main.error("type error in lt!"); if (!exp2.getType(st).equals("int") && !exp2.getType(st).equals("decimal")) ...
c75b0c17-a978-463b-848a-5e28a1daed83
4
@Override public void paintComponent(Graphics g) { super.paintComponent(g); if (rp == null && rp.getEntities() == null) return; double offsetX = 0; double offsetY = 0; double widthMultiplier = getWidth() / (double)Const.width; double heightMultiplier...
9f2a6261-233a-4189-b4b3-33a291c7b28e
1
public WidgetHolder(QWidget parent, int width, int height, QWidget widget) { super(parent); //move(0, 0); setGeometry(0, 0, width, height); if (widget != null) { addWidget(widget); } }
25092782-bfbd-4ba2-9b78-1ed1f394e660
2
public static void main(String[] args) { int length = Integer.parseInt(JOptionPane.showInputDialog("Input the table Dimension")); int intArray[][] = new int[length][length]; Random generator = new Random(); for (int i = 0; i < length; i++) { for (int j = 0; j < length; j++) ...
4d669ea9-20c7-4520-8ddb-64d42b458f4c
0
public static HTTPResponse notAuthorized() { return new HTTPResponse(401, "<h1>Not Authorized</h1>"); }
8f3eaf03-c73c-482c-bfbf-14176d44c441
3
public static IOCase forName(String name) { if (IOCase.SENSITIVE.name.equals(name)){ return IOCase.SENSITIVE; } if (IOCase.INSENSITIVE.name.equals(name)){ return IOCase.INSENSITIVE; } if (IOCase.SYSTEM.name.equals(name)){ return IOCase.SYSTEM; ...
f3648a18-e386-47fa-bf7e-928a2a3aeceb
7
@Override public boolean equals(Object obj) { //if (this == obj) //return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Grid other = (Grid) obj; if (vehicles == null) { if (other.vehicles != null){ return false; } else { return true; } } else...
a1230f2d-2905-4832-b49a-a0f84f9724cf
8
public void activate(Duel duel, Duelist duelist) { int c; int materialCount = 0; if(this.threeOfAKind()) { if(duelist.field.containsCardId(this.materials.get(0), 3)) materialCount = 3; } else { for(Integer card : materials) { if(duelist.field.containsCardId(card)) { materialCount++; } ...
faa826b8-d609-43f9-9015-aa9050eef426
3
public boolean accessGranted( URI requestURI, HTTPHeaders headers, HypertextAccessFile htaccess, String authMethod, Map<String,BasicType> additionalSettings, Map<String,BasicType> optionalReturnSettings ) throws IOException, MissingParamException, ConfigurationExce...
6fe0d65c-d21a-44a7-88a0-b701ba9cfc72
8
protected void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja Salvar ?","",JOptionPane.OK_CANCEL_OPTION) == 0){ if(validaCampos()){ UsuarioSistema usuario = n...
61e2f6ad-2627-49b7-a101-7e3409fb9827
5
public void loadSearchSpace(String filePath) throws IOException { Scanner scanner = new Scanner(new FileInputStream(filePath)); try { while (scanner.hasNextLine()) { String line = scanner.nextLine(); int lineLength = line.length(); ArrayList<Node> list = new ArrayList<Node>(); int y = 0; ...
f4923b80-6bd9-4101-9a55-7d53d1016b55
4
public void update() { esc = keys[KeyEvent.VK_ESCAPE]; up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; space = keys[KeyEvent.VK_SPACE]; r = ...
2956711a-06eb-44eb-bba1-bbb6049b8dd4
0
public static void main(String[] args) { Generic<Integer,String> foo1 = new Generic<Integer,String>(); foo1.setFoo1(new Integer(1)); foo1.setFoo2("hello"); System.out.println(foo1.getFoo1()); System.out.println(foo1.getFoo2()); }
144721c9-6c00-4ad8-bbed-77ee0ec7bae3
6
public static void removeProduct() { File f = new File("ProductsAndInventory.txt"); String choice = "y"; try { pw = new PrintWriter(new FileOutputStream(f, false)); while (choice.equalsIgnoreCase("y")) { System.out.print("What is the upc of the product you would like to remove? "); String u...
c55759a1-116a-479e-8b53-3ecf9048e5d1
0
protected void setFullscreen(boolean _fullscreen) { this.fullscreen = _fullscreen; }
2877a914-28e3-4c0e-957b-dfb39e2db653
9
public static BufferedImage crop(BufferedImage image) { int width = image.getWidth(), height = image.getHeight(), minX = width, maxX = 0, minY = height, maxY = 0; for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { if((image.getRGB(x, y) & 0x00FFFFFF) != 0) { if(x < ...
08f62520-29d9-4f8c-9ad8-8a096f19152e
8
public boolean displayModesMatch(DisplayMode m1, DisplayMode m2){ if(m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()){ return false; } if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m1.getBitDepth() != m2.getBitDepth()){ return ...
9cd2bde8-9888-4e2f-a4c8-23f2494e0318
0
protected TableModel createModel(Transition transition) { final MealyTransition t = (MealyTransition) transition; return new AbstractTableModel() { String s[] = new String[] {t.getLabel(), t.getOutput()}; public Object getValueAt(int r, int c) {r...
0b15b258-a66f-48be-9283-7c711a068df9
9
private spindle.core.dom.Rule generateRule(CtRule cRule) throws ParserException, RuleException { String ruleLabel = cRule.getLabel(); if (null == ruleLabel || "".equals(ruleLabel)) ruleLabel = TEMP_RULE_LABEL + spindle.core.dom.Theory.formatter.format(ruleCounter++); // if ("".equals(ruleLabel)) ruleLabel = T...
82717463-27f2-4413-a17a-90a697d69675
4
public OamEntry toOamEntry() { return new OamEntry(new byte[] { (byte) sprite.y, (byte) sprite.x, (byte)(sprite.upperTile.usages.getValueAt(from) % 0x180), (byte) (sprite.palette.usages.getValueAt(from) | ((sprite.upperTile.usages.getValueAt(from) >= 0x180 ? 1...
1eff66ce-ff29-4fab-8b30-50aa22bb9289
3
boolean checkUsername(String username) { if(username.length() < 4 || username.length() > 10) { JOptionPane.showMessageDialog(null, "Username must be between 4 to 10 characters long", "Error", JOptionPane.ERROR_MESSAGE); return false; } else { if(alreadyInFile(username)) { return false; } } retur...
b882b511-8df3-47c0-bbae-cfd4735fcf77
9
protected void updateFromMirror() { setTag(mirroredElement.getTag()); int numOfAtts = getNumberOfAttributes(); int numMirroredAtts = mirroredElement.getNumberOfAttributes(); if (numOfAtts < numMirroredAtts) { for (int i = 0; i < numOfAtts; i++) { String attNa...
aa07fa0c-a5ee-4d58-ad26-314d74e60b4a
5
public void setTile(Tile loc, byte i) { HashSet<Tile> tiles = cols.get(loc.getX()); if (tiles != null) { for (Tile t : tiles) { if (t.getY() > loc.getY() || t.getPlane() != loc.getPlane()) continue; byte[] arr = data.get(t); int ind = loc.getY() - t.getY(); if (ind < arr.length) { arr[i...
b4ed0971-0df3-4ed4-87f6-fac5eeac5770
0
public String getTarget() { return target; }
d4485ad2-9755-4d8c-b39e-d1af51161404
9
@Override public boolean equals(Object o) { // 非NULL及び型の確認 if (o == null || !(o instanceof Ip)) { return false; } Ip ip = (Ip) o; if (ip.getInetKind() == inetKind) { if (inetKind == InetKind.V4) { byte[] b = ip.getIpV4(); for (int i = 0; i < 4; i++) { if (ipV4[i] != b[i]) { return fa...
e529306a-71ad-4b5e-b45d-f4d559360260
6
public static String getSortName(int x) { if(x == DeckEditor.SORT_NUMBER) { return "NUMBER"; } else if(x == DeckEditor.SORT_ABC) { return "NAME"; } else if(x == DeckEditor.SORT_ATK) { return "ATK"; } else if(x == DeckEditor.SORT_DEF) { return "DEF"; } else if(x == DeckEditor.SORT_TYPE) { return...
c8c3754b-8f73-4347-9b16-21e1c0823a55
2
public static Operation memberOf(char c) { for(Operation o : Operation.values()) { if(c==o.getUnderlyingCharacter()) { return o; } } return null; }
6f99c99f-dab5-4fbc-bdf8-198a6bc1a534
8
public void populate(){ float currentlinewidth =0; float totalwidth; Vec2u pp = getPopulatePad(); Vec2u currentPoint = pp; ArrayList<GuiItem> items_cur_line = new ArrayList<GuiItem>(); for(GuiItem g : items){ if( vertical_wrap > 0 && currentPoint.y + g.width_height().y + g.margins.top + g.margins.botto...
ec499be1-5f3e-402b-86f6-1394fe673d6f
9
private double getDouble(int format, int offset) { switch (format) { case FMT_SBYTE: return data[offset]; case FMT_BYTE: int iValue = data[offset]; return iValue & 0xFF; case FMT_USHORT: return get16u(offset); ...
b272184b-dd83-4184-9359-62c7530e0779
4
public static void main(String[] args) { PopupMenu trayMenu = new PopupMenu(); MenuItem captureItem = new MenuItem("Capture in 3 seconds"); captureItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { Thread.sleep(3000); Robot robot = new Robo...
d09fc7c5-fb26-4b21-b0d4-1d87acc3dc71
3
public void findAllChromosomeNames( BPTreeNode thisNode, ArrayList<String> chromosomeList){ // search down the tree recursively starting with the root node if(thisNode.isLeaf()) { // add all leaf names int nLeaves = thisNode.getItemCount(); for(int index = 0; in...
00d2d6dd-81d6-4893-b0bd-d77630c93b6e
1
public void testParsePeriod_parseType() { Period expect = new Period(0, 0, 0, 4, 5, 6, 7, 8, PeriodType.dayTime()); assertEquals(expect, f.withParseType(PeriodType.dayTime()).parsePeriod("P4DT5H6M7.008S")); try { f.withParseType(PeriodType.dayTime()).parsePeriod("P3W4DT5H6M7.008S"); ...
62ebad2a-254f-4bbc-b3cf-37bebb8274ce
7
private void updateNetworkState() { boolean[] updatedInfections = new boolean[numberOfComputers]; for (int i = 0; i < numberOfComputers; ++i) updatedInfections[i] = infections[i]; for (int i = 0; i < numberOfComputers; ++i) { if (infections[i]) { for (int ...
87cc8c0a-93bc-4537-9e7b-fd3d5b17a4e3
1
public List<Pessoa> getListagem() { if (listagem == null) { listagem = dao.Buscar(null); } return listagem; }
fe1c62be-6cf1-402e-ae83-659d808857ef
9
public int[] windowMax(int[] nums, int window) { int w = (nums.length < window) ? nums.length : window; // A deque allows insertion/deletion on both ends. // Maintain the first as the index of maximal of the window // and elements after it are all smaller and came later than the first. Deq...
05f10319-3291-45fe-b8ca-f5fd7eac5efc
6
@Override protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case SHORT_VALUE: Short short_value = (Short)value_; oprot.writeI16(short_value); return; case INT_VALUE: Integer int...
7f97b3b3-8dda-410c-8c86-f5d4faa1a9c6
2
private static Image createImageAndApplyMask(Image original, Mask mask) { Image image = original.shallowClone(); if (original.isRgb()) { applyMask(original, image, mask, RED); applyMask(original, image, mask, GREEN); applyMask(original, image, mask, BLUE); } else if (original.isHsv()) { applyMask(orig...
34dfa49d-166e-45d5-bc6e-01ffd08e4657
5
private boolean AT3x04CarrierConfirm (List<CarrierInfo> clist) { int expectedCarrierBins[]=new int[12]; int a,b,p=pilotToneBin-40; int findCounter=0; for (a=11;a>=0;a--){ expectedCarrierBins[a]=p; p=p-20; } // Check if there are carriers where we think there should be for (a=0;a<clist.size();a++) { ...
bacc7d19-5acd-42eb-b0a3-c036b132d43b
5
@Test public void test2(){ Set<String> set = new TreeSet<String>(); set.add("Salut"); set.add("Mon"); set.add("Nom"); set.add("Est"); set.add("Gaylor"); for(Iterator<String> i = set.iterator(); i.hasNext();){ System.out.println(i.next()); } System.out.println("----------"); set.remove("Sal...
88ba2d3c-2282-4723-8028-299cb8442898
3
static void write() { while (!Thread.currentThread().isInterrupted()) { while (!Thread.currentThread().isInterrupted()) { Lock readLock = rw.writeLock(); long val; readLock.lock(); try { counter ++; val = counter; } finally { readLock.unlock(); } System.out.println(Thread...
475a9867-5d31-46f2-a623-3ab4a83cdf6d
8
@Override protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { switch (classifierID) { case statePackage.PLAYER: return validatePlayer((Player)value, diagnostics, context); case statePackage.STATE: return validateState((State)value, diag...
98242f52-5f64-4ca5-b2da-ec0961314a45
2
public void removeOneFromBasket(int productId) { if (basket.containsKey(productId)) { if (basket.get(productId).getQuantity() > 1) { basket.get(productId).removeOneProduct(); numProductsInBasket--; } } }
b07c3544-ed07-4ab8-b462-9b19ad4346a7
4
public void setZ(int x, int y, double value) { if (x >= _Width || x < 0 || y >= _Height || y < 0) { throw new IllegalArgumentException("Point [" + x + ", " + y + "] is outside of the Z Buffer array"); } buffer[y * _Width + x] = value; }
d8d7427a-4331-4f60-8087-6ce103fcdab8
5
@Override public void keyPressed(KeyEvent event) { switch(event.getKeyCode()) { case KeyEvent.VK_UP: upPress = true; break; case KeyEvent.VK_DOWN: downPress = true; break; case KeyEvent.VK_LEFT: leftPress = true; break; case KeyEvent.VK_RIGHT: rightPress = true; break; ...
9ece0587-42b1-455f-ac51-9a9483f4f312
3
public static final Type tArray(Type type) { if (type == tError) return type; int hash = type.hashCode(); Iterator iter = arrayHash.iterateHashCode(hash); while (iter.hasNext()) { ArrayType arrType = (ArrayType) iter.next(); if (arrType.getElementType().equals(type)) return arrType; } ArrayTyp...
bbd105db-ac38-49d2-9f1d-9d2ceff4f4cc
3
@Override protected void onAction(String sender, String login, String hostname, String target, String action) { if ( target.startsWith("#") ) { ChannelEventsListener listener = getChannelEventsListener(target); if (listener != null) listener.actionReceived(sender, act...
6d510b7b-93b0-427d-b200-4e6c3b3bac24
7
public void EntferneSpieler(Spieler zuentfernenderspieler) { if (dieSpieler.length <= 1) { dieSpieler = new Spieler[0]; Zustand = Spielzustaende.Beenden; aktueller_Response.setzeAktuellenZustand(Zustand); return; } if (zuentfernenderspieler == th...
1967386f-f86d-4c62-8800-07cbea81d89d
9
private void move() { xa = 0; ya = 0; int px = (int) level.getPlayerAt(0).getX(); // player's coordinate is in pixel precision. But our algorithm is in tile precision int py = (int) level.getPlayerAt(0).getY(); Vector2i start = new Vector2i((int) getX() >> 4, (int) getY() >> 4); // divide by 16 to get to tile...
d5a65582-bed5-4365-833b-976ab15ff337
5
protected void buttonDeleteActionPerformed(ActionEvent evt) { for(JTextComponent uiSource: uiSources) { if(uiSource.isFocusOwner()) { String text = uiSource.getText().trim(); if(text.length() != 0) { uiSource.setText(text.substring(0, text.length() - 1)); if(uiSource instanceof JFormattedTextFiel...
0869bbfe-643b-422e-b049-1e31374e7731
9
public void mousePressed(MouseEvent e){ //If the board isn't initialised yet, don't do anything. if(board.getBoardTiles() == null){return;} //Find the square that the user clicked on. If they clicked outside the board, ignore it. int boardSize = board.getBoardTiles().length+1; int squareX = (int)(e.ge...
4e7779bd-cb59-4b6c-9a2e-d0bcbbf84aa3
5
protected int readBlock() { blockSize = read(); int n = 0; if (blockSize > 0) { try { int count = 0; while (n < blockSize) { count = in.read(block, n, blockSize - n); if (count == -1) break; n += count; ...
121cd1a3-6563-47a1-8ec2-d908f6d3c317
0
@Override public boolean isCorrect() { return correct; }
19b5b0e2-1764-42a5-b88b-07165f0f30f2
3
public void update(){ if(alunoTurma != null){ Turma t = this.alunoTurma.getTurma(); if(t != null){ this.lblNumTurma.setText(Integer.toString(t.getNumeroTurma())); this.lblPeriodo.setText(t.getPeriodoLetivo()); this.lblDisciplina.setText( ...
555978f1-ea29-4fcf-a5f7-dbb039c5ac9d
8
private static String[] _l2a(String list) { List<String> array = new ArrayList<String>(); StringBuilder sb = new StringBuilder(); char[] chs = list.toCharArray(); for (char ch : chs) { final boolean isSpace; switch (ch) { case ' ': case 0x0a: case 0x0d: case 0x09: isSpace = true; break...
af2a499c-6cdd-4069-b18e-c542ee042470
7
protected void beforeAttrib(final char c) { switch(c) { case ' ': case '\t': case '\r': case '\n': bufDex++; return; case '<': piece.innerStart = bufDex; abandonTagState(State.BEFORETAG); return; case '>': changeTagState(State.START); piece.innerStart = bufDex; return; case '/': change...
e4e501ff-98d9-49b7-abc8-712d7e0dbaaf
9
ASN1Encodable readImplicit(boolean constructed, int tag) throws IOException { if (_in instanceof IndefiniteLengthInputStream) { if (!constructed) { throw new IOException("indefinite length primitive encoding encountered"); } ...
d18063ec-39c7-4dea-97c3-4f3f44808bec
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected instanceof MOB) &&(!noRepeat) &&(msg.targetMinor()==CMMsg.TYP_ENTER) &&(msg.source()==affected) &&(msg.target() instanceof Room) &&(msg.tool() instanceof Exit) &&(((MOB)affected)....
e36c4c39-a35e-4e1a-bf36-525be754b15e
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Story other = (Story) obj; if (skel == null) { if (other.skel != null) ...
120aa3e4-fb08-4a32-8796-89eb95264ffa
4
public Operator next() { if(next == null){ return null; } if(next.type == Type.S){ return null; } if(next.type == Type.O || next.type == Type.I){ return next.next(); }else{ return next; } }
8f22268a-022b-48e4-a8d1-7bd13f7f4951
0
public void setLineColor(Color c) { lineColor = c; }
1e72eca9-71a8-4a9b-82ed-bb49fd011d0e
1
public Hash(HashFunctionInterface hashCounter) { this.hashTable = new List[length]; for (int i = 0; i < length; i++) { hashTable[i] = new List(); } this.hashCode = hashCounter; }
13f1672d-0133-4f20-a29e-dd1a10680283
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Favorites other = (Favorites) obj; if (favoritedTime == null) { if (other.favoritedTime != null) return false; } else if (!favoritedTime...
8f2de1b5-c69f-4821-bf5c-7baf7075b4cd
6
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
9d641dcb-adb2-44c1-84f9-e45f7111fdb2
2
public Map<String, Integer> getStatusFrequency(){ Map<String, Integer> map = new HashMap<String, Integer>(); for(Record record : log.getRecords()){ String status = record.getStatus().getStatus(); Integer number = map.get(status); if(number != null){ map.remove(status); map.put(status, ++numb...
ea177e0c-25c1-4165-924b-ca2c7b96ede1
6
private void evaluateScaling(double[] scales) { int totalFailures[] = new int[scales.length]; for( int n = 3; n < 100; n++ ) { System.out.println("Matrix size = "+n); DenseMatrix64F A = RandomMatrices.createUpperTriangle(n,1,-1,1,rand); if( !extractor.process(A) ){ ...
08cd47de-c23b-4ea2-9b55-65f6df7cdba0
4
private double recArtPts(Intersection node, double depth, Intersection fromNode) { node.depth = depth; double reachBack = depth; for (Intersection neighbour : getNeighbours(node)) { if (!(neighbour.equals(fromNode))) { if (neighbour.depth < Double.POSITIVE_INFINITY) { reachBack = Math.min(neighbou...
f55394fa-f4db-45e5-8fab-4fd7d898c140
8
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(this)) &&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE))) { synchronized(this) { final boolean wasOpen=isOpen; isOpen=true; CMLib.commands().handleBeingLookedAt(msg);...
d7dc4fa0-cd61-4bfb-b590-639885eadb7b
5
@SuppressWarnings("unused") private static java.sql.Connection connect2(String endpoint, String driver, String user, String pwd) { try { Class.forName(driver); } catch (ClassNotFoundException e) { LogHandler.writeStackTrace(Logger.getGlobal(), e, Level.SEVERE); return null; } java.sql.Connection ...
9cca72cd-67b7-4c4e-8e96-b4b124aa4584
2
@Override public String toString() { switch (pb) { case range: StringBuilder sb = new StringBuilder(); parts.stream().forEach((part) -> { sb.append(',').append(part.toString()); }); return String.format("PARTITION BY RANGE (%s) (%s)", parameter, sb.substring(1)); case hash: return Stri...
2deb703a-4b3d-4c80-9592-cf4c8affac4e
1
public Dimension preferredLayoutSize(Container parent) { Component[] components = parent.getComponents(); left = 0; right = 0; height = 0; for (int i = 0; i < components.length; i += 2) { Component cleft = components[i]; Component cright = components[i + 1]; Dimensio...
dac0294d-9d28-4c44-8457-a38fd0c68879
9
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
600a2e91-2320-4ae7-8903-13f676fa9159
3
public String mapMethodDesc(String desc) { if("()V".equals(desc)) { return desc; } Type[] args = Type.getArgumentTypes(desc); String s = "("; for (int i = 0; i < args.length; i++) { s += mapDesc(args[i].getDescriptor()); } Type ret...
aaf3d3a4-103f-4f25-a463-871a8882ca8c
8
public void resetOrientation() { if (x1 <= x2 && y1 <= y2) { // Do nothing, this is our standard orientation. Left this for // clarity. } else if (x1 <= x2 && y1 >= y2) { int tempy1 = y1; y1 = y2; y2 = tempy1; } else if (x1 >= x2 && y1 >= y2) { int tempx1 = x1; int tempy1 = y1; x1 = x2; ...
f2c865b5-d240-42c6-b680-ba2f6ad1d52f
4
private static byte[] encryptBloc(byte[] input){ byte[] tmp = new byte[input.length]; int t,u; int aux; int[] data = new int[input.length/4]; for(int i =0;i<data.length;i++) data[i] = 0; int off = 0; for(int i=0;i<data.length;i++){ data[i] = ((input[off++]&0xff))| ((input[off++]&0xff) << 8...
0fb42be1-63e0-460b-bcd6-9368c7f94292
9
private final void method640(byte b) { anInt5631++; int i = 32767; int i_60_ = 32767; int i_61_ = 32767; int i_62_ = -32768; int i_63_ = -32768; int i_65_ = -32768; int i_66_ = 0; int i_67_ = 0; for (int i_68_ = 0; i_68_ < anInt5672; i_68_++) { int i_69_ = anIntArray5595[i_68_]; int i_70_ = an...
b52587ac-5231-43e8-9905-87304be6004d
3
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { if (event.isCancelled()) return; String command = event.getMessage().substring(1); Player player = event.getPlayer(); try { Runnable reaction = this.questionManager.an...
06e17658-b80e-4249-9887-99be85d8e552
6
private void jButtonOpretAnsatActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonOpretAnsatActionPerformed {//GEN-HEADEREND:event_jButtonOpretAnsatActionPerformed String stilling = jComboBoxStillinger.getSelectedItem().toString(); String navn = jTextFieldAnsatFornavn.getText() +...
6b3465d3-74b5-4fe5-bc47-8d67280bf051
3
private int canReplace() throws CannotCompileException { int op = iterator.byteAt(newPos + 3); if (op == Opcode.DUP) return 4; else if (op == Opcode.DUP_X1 && iterator.byteAt(newPos + 4) == Opcode.SWAP) return 5; else return 3; // fo...
0b5dcbe3-4118-42b3-9f2e-342b07d76493
1
@GET @Path("/ping") @Produces(MediaType.TEXT_PLAIN) public String submit(@Context HttpServletRequest request) { try { // Do something... dao.getRepos(getBaseUrl(request)); } catch (IOException e) { logger.log(Level.SEVERE, "Failed to load repo list...
bbfe7470-1718-4133-8465-29dcc4012619
5
protected void onRender(GraphicsHelper gh) { Rectangle rect = new Rectangle(xOnView(pos.x),yOnView(pos.y),size.x,size.y); gh.drawRectangleGradient(rect,cBgTop.multiply(color),cBgTop.multiply(color),cBgBottom.multiply(color),cBgBottom.multiply(color)); gh.g().setColor(cBorder.multiply(color)); gh.g().draw(rec...
9e527468-8ebe-44ab-8169-6ea450e1a686
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Opérations pré-traitement et suite des opérations, si nécessaire. if (preTraitement(request, response)) { // ================================ // Gestion de la ressource demandée //...
151cfbd1-c80d-411b-8ba5-34980d0a9422
5
private void executeAction(PlayerAction a){ if(a == null) return; switch(a.type){ case buy: selectedTowerDef = a.def; setInteractionState(InteractionState.placeTower); towerIsPlaceable = false; placeTowerLocation = transformPointBack(mousePos.x, mousePos.y).getPointI(a.def.size); break; ca...
56a8f120-4db1-44b3-83e2-1c626de67823
2
private void handleProxyRequest(HttpRequest request, OutputStream os, String method) { logger.log(FINE, "handleProxyRequest for {0}", request.getUrl()); URL url = request.getUrl(); Socket socket; InputStream remoteInputStream = null; OutputStream remoteOutputStream = null; ...
606a36ff-8b9f-48c2-8dd8-f83b0262d4b3
2
public boolean insertAt(int index, E element) { if (indexWithinCurrentSize(index)) { checkEnoughCapacity(1); System.arraycopy(array, index, array, index + 1, currentSize - index); array[index] = element; currentSize++; return true; } else if (indexWithinCapacity(index)) { array[index] = eleme...
dbafb524-03e4-4693-a91a-91ffbc9fb850
3
public boolean detachNext(Linkable paramLinkable) { boolean b = false; if ((paramLinkable instanceof Instruction)) { Instruction localInstruction = (Instruction)paramLinkable; if ((localInstruction.getPreviousInstruction() == null) && (getNextInstruction() == localInstruction)) { ...
39ed9e9e-3308-43ea-933b-764208a0d6eb
3
public static void main(String[] args) { try { if (args.length != 1 || StringUtils.isEmpty(args[0])) { System.err.println("RubyRunMain take only one parameter : a ruby string to eval"); System.exit(1); } final String ruby = args[0]; ...
72bea308-7142-470e-a01d-9b7afcf9678d
4
public static void updatePerson(PersonBean person){ PreparedStatement pst = null; Connection conn=null; boolean result = false; try { conn=ConnectionPool.getConnectionFromPool(); pst = conn .prepareStatement("UPDATE PERSON SET FNAME=?, LNAME=?, ADDRESS=?, TYPE=? " + " WHERE ID=?"); ...
2231d44e-d65b-4445-9276-1cc316f9a930
2
public ChannelTab getChannelTabByName(String name) { name = name.toLowerCase(); for (ChannelTab channel : channelTabs) { if ( channel.getTabName().toLowerCase().equals(name) ) return channel; } return null; }
8c353355-dfe1-47fb-8b2c-97fb536be681
9
public void triggerController() { String query = view.getQuery().toLowerCase(); switch (query) { case "temperature": view.showDate(WeatherCalculator.getDates().get(0)); view.showTemperature(WeatherCalculator.getTime(), WeatherCalculator.getTemperature()); break; case "pressure": view.showD...