method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7819ec85-12d5-478c-85ec-98324cf56562
0
public String getB() { return b; }
94f428cb-9308-4922-946c-223327218e50
6
private void installTabContainer() { if (JTattooUtilities.getJavaVersion() >= 1.6) { for (int i = 0; i < tabPane.getTabCount(); i++) { Component tabComponent = getTabComponentAt(i); if (tabComponent != null) { if (tabContainer == null) { ...
c538052a-a151-418a-a9c7-1c44caf660eb
5
@Test public void testRemove() { List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5)); List<String> list2 = new ArrayList<String>(Arrays.asList("1", "2", "3", "4", "5")); for (int i=0; i<list1.size(); i++) { System.out.println("size:" + list1.size() + " " + i + "->" + list1.get(i)); i...
e5b34db0-facf-427e-9fc6-a0b1dba96cff
7
public static File chooseSaveFileCheckOverwrite(Component parent, JFileChooser chooser, final String suffix, Preferences prefs, String prefsKey) { String path = null; String fname = null; if (prefs != null) { String sdir = prefs.get(prefsKey, null); if (sdir != null) chooser.setCurrentDirectory(new File(sdir)); ...
307da2a5-4aea-403e-99f8-7cedbdceb272
6
public AbstractExpression LExpr(ProcedureBuilder pb) throws Exception { Token l_token; AbstractExpression RetValue = Expression(pb); while (Current_Token == Token.TOK_GT || Current_Token == Token.TOK_LT || Current_Token == Token.TOK_GTE || Current_...
fb399095-4025-492a-a2f6-95c1c07cb671
6
public int compare(Object o1, Object o2) { // we swap the parameters so that sorting goes largest to smallest String v1 = ((AbstractPolicy)o2).getVersion(); String v2 = ((AbstractPolicy)o1).getVersion(); // do a quick check to see if the strings are equal (note that ...
eb2572c4-00cc-4b38-b9d7-788ae69d47d1
9
@Override public void sort() { // Create the heap for (int i=1; i<this.arr.size(); i++) { // i = right side of the heap // Move the element upside int moving = i; int parent = (moving-1)/2; while (parent>=0 && this.arr.getValue(moving).compareTo(this.arr.getValue(parent)) > 0) { this.steps++; ...
710c9f9a-e1ff-48a7-b642-9e86d5b1fd20
8
int readCorner1(int numRows, int numColumns) { int currentByte = 0; if (readModule(numRows - 1, 0, numRows, numColumns)) { currentByte |= 1; } currentByte <<= 1; if (readModule(numRows - 1, 1, numRows, numColumns)) { currentByte |= 1; } currentByte <<= 1; if (readModule(numRo...
d47167f3-a4be-4fb6-b3d1-1643e092bd4e
0
public void setAlgorithm(String value) { this.algorithm = value; }
24ac5355-3750-4a58-a970-67cff878aa6c
4
public void setComando(List<?> list) { for(PComando e : this._comando_) { e.parent(null); } this._comando_.clear(); for(Object obj_e : list) { PComando e = (PComando) obj_e; if(e.parent() != null) { e.pa...
e02a0a99-4fcb-42ea-8c57-683d834360c3
3
public void undo(){ if(getCell(0, 0).getundoListSize() < 0){ for(int i = 0; i < model.getWidth(); i++){ for(int j = 0; j < model.getHeight(); j++){ getCell(i, j).undo(); } } } else{ System.out.println("Não há...
b8f1c4d2-8167-4077-86dc-b92288ed6f9f
2
private final boolean initialiseFullScreen() { graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); if (!graphicsDevice.isFullScreenSupported()) { logger.error("Full screen not supported by graphics device"); return false; } graphicsDevice.setFullScreenWindow(this...
5086d4a0-39b6-4f0c-8207-af1565628c8f
0
public PastPane(Configuration last) { setConfiguration(last); }
cd4e1d91-2be6-4e33-ad8f-70aeed3e0d7b
8
public int[] getStats(boolean recursive){ int[] stats=new int[6]; HashSet<String> blankNodes=new HashSet<String>(); HashSet<String> USUs=new HashSet<String>(); //Triples if (!triples.isEmpty()){ int[] r=getStatsTripleList(triples,blankNodes,USUs); for (int i=0; i<stats.length; i++){ stats[i]+=r[i]; ...
d948f0ca-d901-4a2f-b398-bf955d5a4863
3
private void buildRightSideInfo(final JPanel right, final JList<FolderConfig> list) { right.add(new JLabel("Artist URL")); final JTextField artistUrlText = new JTextField(); if (GuiUtils.currentFolderConfig.getArtistUrl() != null) { artistUrlText.setText(GuiUtils.currentFolderConfig.getArtistUrl()); } arti...
9101ddc0-8a6a-49a1-a66a-4ab7452b9ac4
9
private int read1(char[] cbuf, int off, int len) throws IOException { if (nextChar >= nChars) { /* If the requested length is at least as large as the buffer, and if there is no mark/reset activity, and if line feeds are not being skipped, do not bother to copy the char...
b5795c89-cb40-423f-b606-ac5116ea6802
3
private void createDevicesSection() { BasePanel deviceSection = new BasePanel(); deviceSection.setBorderSize(1); deviceSection.setArc(10); deviceSection.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); GridBagLayout deviceSectionLayout; deviceSection.setLayout(deviceSectionLayout = new GridBagLayout...
772af29f-0e61-45e6-b3e7-411d1ad33b63
2
public void setX(int x) { for(int i=0;i<markers;i++) { if(marker[i].isSelectedDrag()) { marker[i].setX(x); // break; } } }
19694b95-5ea0-4a86-bb01-e2131fb4fec5
5
private static void saveMapToTextFile(String fileToSaveTo) { FileWriter writeto = null; try { writeto = new FileWriter(fileToSaveTo, true);// true append // text } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (writeto == null) { System.out.pri...
3b5211a3-ac4c-4b12-b3a1-68604d439eb5
2
public Set<BankAccount> getAccountsSatisfying(Predicate<BankAccount> predicate) { Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) if (predicate.test(account)) result.add(account); return result; }
299d114b-e232-4db3-8610-d04ccdcb795f
6
public void gameRebounds() { Collections.shuffle(rebounds); for (int i = 0; i < 35; i++) { Collections.shuffle(rebounds); if(rebounds.get(0) == team.get(0).name) { rebC++; } if(rebounds.get(0) == team.get(1).name) { rebPF++; } if(rebounds.get(0) == team.get(2).name) { rebSF++; } ...
51b50fd4-8e95-4b26-98f2-7afab93c3c93
9
public void createConstraints(Model m){ //Inventory balance inventory= new QBnBconstr[psize][tsize]; for (int p = 0; p < psize; p++) { for (int t = 0; t < tsize; t++) { if(t==0){ QBnBLinExp le= new QBnBLinExp(); le.addTerm(1, Q[p][t]); le.addTerm(-1, I[p][t]); inventory[p][t]= new QBnBc...
541a5a77-afc3-4b90-9976-6d27444679ad
9
public void conectar(String AHC, String BHC){ //hashcode B y B String Acode= null; String Bcode= null; for (Nodo<String> i = _ID_HASHCODE_IO.getHead(); i != null; i = i.getSiguiente()){ if(i.getDato().contains(AHC)){ Acode = i.getDato(); } if(i...
a5d70512-443c-47b5-9b27-87cafd180d91
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
143ddeb1-7aa2-4199-9a75-1b20bf33eb89
9
public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction) { if (positions.isEmpty()) return; if (maxFraction <= 0 || maxFraction > 1) throw new IllegalArgumentException("maxFraction must be between 0 and 1"); TileFactory tileFactory = getTileFactory(); TileFactoryInfo i...
05fe794c-95ae-498f-86a7-973511a2d6f0
0
public void setId(int id) { this.id = id; }
ded8259b-ffb3-426e-a8c4-55b094e43b36
2
private int getStart(int offs) throws BadLocationException { for (int i=offs;i>=0;i--){ if (endOfTokens.contains(getText(i, 1))){ return i+1; } } return 0; }
3a7aa113-d6cc-47e9-9e50-d66b60687e3b
0
public void setFunMm(BigInteger funMm) { this.funMm = funMm; }
95c29b64-4a49-4e21-bdb2-be31d637b475
0
public void setRecordStatus(Integer recordStatus) { this.recordStatus = recordStatus; }
f5cf0b66-d593-4da0-95d6-eec2693ec85a
9
static int mame_stats(int selected) { String buf=""; int sel, i; sel = selected - 1; if (dispensed_tickets!=0) { buf = "Tickets dispensed: " + sprintf("%d\n\n", dispensed_tickets); } for (i=0; i<COIN_COUNTERS; i++) { buf += sprintf("Coin %c...
3fc42700-c0c2-4c51-b58b-1774db30b498
0
public void start() { ticks=System.currentTimeMillis(); }
b5e45ce1-6805-4ffd-9075-fd2339fe7ee9
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost, msg)) return false; if((msg.tool()==this) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&(msg.value()>0) &&(msg.target() !=null) &&(msg.target() instanceof MOB) &&(weaponClassification()==Weapon.C...
b0e63728-038f-4f96-a333-de6bd8c85d37
7
public void connect(TreeLinkNode root) { if(root == null){ return; } LinkedList<TreeLinkNode> queue = new LinkedList<TreeLinkNode>(); LinkedList<TreeLinkNode> childQueue = new LinkedList<TreeLinkNode>(); queue.add(root); TreeLinkNode preNode = null; wh...
736b55b6-4770-43ff-bb55-e43797495b0e
8
public ArrayList<Request> generateVirtualNetworks(int numberOfNetworks) { ArrayList<Request> requests = new ArrayList<Request>(); int baseTime = 0; int requestsPer100UnitsTime = randomizer.nextPoisson(); for(int idRequest = 0; idRequest < numberOfNetworks; idRequest++) { HashMap<Integer,VirtualNod...
2b9affb4-d5da-457a-a6b9-b38b6166af9e
9
@Override public void nextStep() { Resource res; switch (this.step) { case (0): // Blokuotas, laukiam "Eilutė atmintyje" resurso res = Core.resourceList.searchResource(ResourceType.LI_IN_MEM); if (res != null) { PrintDescriptor descriptor = (PrintDescriptor) res.getDescriptor(); res.setParent(th...
3ade7f57-5cfc-412e-8065-1940fab93767
8
@Override public void paint(Graphics g) { g.clearRect(0, 0, getWidth(), getHeight()); //clears the screen int gridX = getWidth() / gridSizeX; int gridY = getHeight() / gridSizeY; int actual_grid_size = Math.min(gridX, gridY); if (actual_grid_size == 0) { return; ...
b51be9ef-cfd3-4ea6-a0cc-c53750880067
9
public Condition getCondition(String inName) { String strStore="Error opening file"; try { RandomAccessFile rafConditionDef = new RandomAccessFile("defConditions/"+inName.toLowerCase(), "r"); Condition cndStore = new Condition(); cndStore.NAME = inName; strStore = rafConditionDef.readLine(); while...
960e309a-7cb1-4d50-983c-717e5f66b030
5
final void removeImageFetcher(Canvas canvas) { do { try { anInt7906++; if (((NativeToolkit) this).aCanvas7925 == canvas) throw new RuntimeException(); if (!aHashtable8014.containsKey(canvas)) break; method3911(canvas, 1, aHashtable8014.get(canvas)); aHashtable8014.remove(canvas); } catc...
01317739-c6c0-449a-9961-05964bad4907
5
@Override public void execute() { try { boolean newMember = false; String membersList = controller.getConnection().get("members/list/?order=desc&sort=joindate"); Document doc = Jsoup.parse(membersList); Elements links = doc.select("a.username"); Element link = links.first(); String username = lin...
575cbaaa-8f7e-47b3-af83-dee21f4681dc
8
private void sendCommand(int level, String[] keywords, String hostname, String recipient) { if (isAccountTypeOf(level, REGISTERED, MODERATOR, ADMIN)) { if (keywords.length > 2) { if (Functions.isNumeric(keywords[1])) { int port = Integer.parseInt(keywords[1]); String message = Functions.implode(Array...
6ba2307c-d4bf-4dc9-a2e4-719435298f8d
1
public WayOsm(List<Long> l){ if (l == null) this.nodos = new ArrayList<Long>(); else this.nodos = l; shapes = new ArrayList<String>(); }
8a70a384-878e-47b7-9a3f-96eece7eb067
6
public void connect() { new Thread(new Runnable() { @Override public void run() { if(isReconnectWorkerWorking()) { reconnectWorker.shutdownNow(); } preConnect(); sendNewInfo("Connecting to: " + host + ":" + port); if(echoSocket == null) { echoSocket = n...
05a1bc7f-2bb1-492e-93d9-14331ba271a4
4
public ArrayList<String> loadBranch(){ ArrayList<String> branches = new ArrayList<String>(); int startLine = 0; for(int lineNumber = 0;lineNumber < stringLines.size();lineNumber++){ String aString = stringLines.get(lineNumber); if(aString.equals("branches:")){ startLine = lineNumber+1; break; } ...
e1b704b2-fc0f-47d4-9c97-f2cddea12527
8
public void createComponents() { nextOutput = new JButton("Next"); previousOutput = new JButton("Previous"); deleteButton = new JButton("Delete"); leftPanel = new JPanel(); rightPanel = new JPanel(); mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); m...
c6571142-aa79-4e3d-8327-8a91cc210095
3
private void checkMeetings() { Meeting holder = null; if(!pastMeetingList.isEmpty()){ holder = pastMeetingList.get(0); } System.out.println("There are past meetings"); for(int i = 0; i < pastMeetingList.size(); i++){ if(holder.getDate().getTime().after(theCalendar.getTime())){ PastMeeting...
8100f944-e9b2-4b99-a4d4-df224d2e4087
2
public static double countOnes(double[] nums) { int count = 0; for (double num : nums) { if (num == 1.0) { count += 1; } } // Return the negation of the count so we can still choose a hypothesis // by the max return -count; }
2f6cd1ba-a382-49ab-ab7f-5271f362d44b
9
public void turn(long deltaMs) { float targetAngleDeg = MathUtil.radToDeg(targetAngle); float currentAngleDeg = MathUtil.radToDeg(angleRad); WeaponsComponent wc = (WeaponsComponent)owner.getComponent("WeaponsComponent"); if(currentAngleDeg < targetAngleDeg - 1f) { fl...
f42fea0f-0179-4732-9e69-714bc76dd391
9
public Matrix _inverseSide() { /** * If the matrix has been augmented, solve so that the unaugmented * portion is an identity matrix. Currently appears to be unable to * handle zero entries - quite a problem if you ask me! */ if (augmented != null && rows == cols) { Matrix matrix = duplicate(); fo...
de95acf3-127a-45b0-a668-432f7dd9ffc4
1
public void kirjoitaOikeanmuotoinenSisaltoTiedostolle(){ try { PrintWriter kirjoitin = new PrintWriter(tiedosto); kirjoitin.println("dog\t[dog]\tkoira\ttunniste1\tMELKEIN"); kirjoitin.println("cat\t[kät]\tkissa\ttunniste1\tEI"); kirjoitin.println("duck\t[dak]\tankka\t...
ea2da140-ffea-4409-b166-5c3102ac9673
2
protected String getPackage(String uri) { if (uri == null || uri.indexOf("/") == -1) return ""; return uri.substring(0, uri.lastIndexOf("/")); }
3a9d0283-b12f-4533-9c8c-902477100cca
7
public void run() throws IOException { Route53Driver driver = new Route53Driver(awsAccessKey, awsPrivateKey); Zone zone = driver.zoneDetails(route53ZoneId); if (cleanZone) { List<ZoneUpdateAction> deletes = new ArrayList<ZoneUpdateAction>(); for (ZoneResource resource : driver.listZoneRecords(zone)) ...
3b185117-cc31-4510-a0b4-8ccbdda9b6e2
2
public void testWithFieldAdded7() { Partial test = createHourMinPartial(23, 59, ISO_UTC); try { test.withFieldAdded(DurationFieldType.minutes(), 1); fail(); } catch (IllegalArgumentException ex) { // expected } check(test, 23, 59); ...
e08ca691-6bbb-4621-b69d-4fe4aad5ed83
8
public Map(int width, int height, int current_x, int current_y, int heading) { // System.out.println("Test1"); this.width = width; this.heading = heading; this.height = height; mapNode = new Node[width][height]; for (int i = 0; i < this.width; i++) {// initilize nodes for (int j = 0; j < this.height; j++...
9e313146-f04e-48b8-bb32-14b089da6699
9
public long howMany(int size, int[] start, int[] end, int numMoves) { long steps[][][] = new long[size][size][numMoves + 1]; steps[start[0]][start[1]][0] = 1; for (int n = 1; n <= numMoves; n++) { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (steps[i][j][n - 1...
2f1cd277-9ab0-44a2-a859-e3f26d8ee05b
5
public void drawSquareCursor(int xc, int yc, byte size, Graphics bufferGraphics, int winZoom, int realZoom, int Zoom, int ScrollX, int ScrollY) { for (int x = xc; x < xc + size; x++) { if (x == xc || x == xc + size - 1) { for (int y = yc; y < yc + size; y++) { drawCursorPoint(x, y, bufferGraphics, winZ...
e5774294-1b75-44e8-adb5-e5b0b6f2148d
5
public Object makeKey(byte[] uk, int bs) throws InvalidKeyException { if (bs != DEFAULT_BLOCK_SIZE) { throw new IllegalArgumentException(); } if (uk == null) { throw new InvalidKeyException("Empty key"); } int len = uk.length; if (len < 5 || len > 16) { thr...
5923318d-63c6-4d84-bbe7-6b6b328c4d7b
5
public boolean isIdentity() { for (int x = 0; x < sizeX; ++x) { for (int y = 0; y < sizeY; ++y) { if (x == y) { if ( Math.abs( values[ ( y * sizeX ) + x ] - 1.0f ) > 0.1f ) { return false; } } else { if (!Utils.eqFloat(0.0f, values[ ( y * sizeX ) + x ])) return false; ...
aa51ec42-ed6d-43e1-ac99-94d99a4fdc5d
6
public static void loadLanguage(File file) { String dirName = file.getParentFile().getName(); String fileName = file.getName(); String language = fileName.replace(Util.getFileExtension(fileName), "").replace(".", ""); if(!languages.containsKey(language)) { languages.put(language, new Language(language)); }...
0d4c5a29-99cc-4885-8dc0-e44793616254
4
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Action a = event.getAction(); ItemStack item = event.getItem(); if((a == Action.PHYSICAL) || (item == null) || (item.getType() == Material.AIR)) { return; } if (item.getType() == Material.FIREWORK_CHARGE) { } }
b59864eb-df03-4855-89d1-0a0dd95ef5b2
8
private boolean matches(ProcessingEnvironment procEnv, boolean strict, List<? extends TypeMirror> parameterTypes, List<? extends TypeMirror> expectedParameterTypes) { if (parameterTypes.size() != expectedParameterTypes.size()) { return false; } if (strict) { for (int i = 0; i < parameterTypes.size();...
6b1b1ac2-b381-4a95-be95-265fce7002d6
0
public void pidWrite(double output) { set(output); }
454b002b-c689-493e-be8c-cf16fc30f5fc
0
private void swap(int[] array, int left, int right){ int temp = array[left]; array[left] = array[right]; array[right] = temp; }
eece02d3-1f78-43f0-9e69-4e76e4ac294a
0
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); data = stream.readObject(); }
72146e62-5bdd-4fcd-8b50-6322a47f75f8
3
public void run () { while (true) { try { CommandSender sender = queue.take().get(); if (sender == null) break; autoUpdater.updateCheck(); autoUpdater.downloadLatestVersion(); ...
49ba71a8-0856-40ba-ac72-ba3bf3758ee7
3
public void addHero(core.Hero hero) { if (lockCount != 0) return; WidgetChooserButton button; if (heroesSelected != -1) { try { button = (WidgetChooserButton)(heroesInner.itemAt(heroesSelected).widget()); button.setChecked(false); } catch (NullPointerException e) {} } button = new W...
511e1819-660d-46a1-b633-27783e3c373a
5
public static ArrayList<ArrayList<Integer>> Biparticao(Graph grafo) { int[] Cor = new int[grafo.getNlc()]; for (int i = 0; i < grafo.getNlc(); i++) { if (Cor[i] == 0) { Cor[i] = 1; if (!Biparticao_Visit(grafo, i, Cor, 2)) { return null; } } } ArrayList<ArrayList<Integer>> resultado = ...
413d4cb1-1d26-4b96-8139-b563c869ec6c
1
public Node removeFirst() { if(root == null) return null; Node retNode = root; root.next.prev = null; root = root.next; items--; return retNode; }
045377a3-647d-4f69-84ed-a4a6160ba11a
7
public void run(){ BufferedReader br = null; InetAddress addr = null; ServerSocket servSock = null; Socket cliSock = null; try{ addr = InetAddress.getLocalHost(); servSock = new ServerSocket(3110, 5, addr); } catch(Exception e){ System.out.println("Creation of ServerSocket failed."); Sys...
ddca9ab3-b34d-4803-ad3b-86cc7f30fb0b
7
private void setupTopPanel() { final Stage stage = view.getStage(); // File > Load File view.topPanel.mItmLoadFile.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { FileChooser fileChooser = new FileChoos...
896ecd82-01a1-4463-b501-8bd5abdd8309
7
public static int getDirNr(Direction i) { if (i == null) { return 0; } switch (i) { case TOP_LEFT: return 0; case TOP: return 1; case TOP_RIGHT: return 2; case BOT_RIGHT: r...
cfd5dd03-45fb-4d93-ae73-eccbc165e234
6
public void criarProjeto(Projeto projeto) throws SQLException { Connection conexao = null; PreparedStatement comando = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement(SQL_INSERT_PROJETO); comando.setString(1, projeto...
f7fcfa83-51ae-410f-b344-221e707c8900
5
public static Document load(){ File folder = new File(SAVE_PATH); System.out.println(folder.getAbsoluteFile()); File[] listOfFiles = folder.listFiles(); int count = 1; ArrayList<String> files = new ArrayList<String>(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { Syst...
df23679e-129a-4365-8730-a99e47b2c45e
5
public ArrayList<Advogado> Consultar(String id){ ArrayList<Advogado> advogados = new ArrayList<>(); if(id.equals("")){ try { ConsultarSQL("SELECT * FROM tb_advogado", true); while (rs.next()) { ...
ab815666-005f-4cf8-bbde-a65ec0612633
3
public static void main(String[] args) { Scanner input = new Scanner(System.in); int cases = input.nextInt(); for (int q = 0; q < cases; ++q) { int houses = input.nextInt(); int[] addresses = new int[houses]; for (int i = 0;...
868a38f0-6e1f-4221-96aa-400e01741eaf
1
@Override public boolean isOp() { if(User.getOpChannels().contains(Message.getChannel())) return true; else return false; }
981a3313-e03a-45c5-8584-432f15accf92
9
public void getValues() { //Cost for printing conf.printingCosts = new ArrayList<ItemStack>(); List<String> items = c.getStringList("PrintingCosts"); //Custom costs: if (items != null) for (String s : items) conf.printingCosts.add(Utility.getItem(s)); //Default costs: else conf.printingCosts...
0040d8e8-8025-4143-8c06-e8d4c215ccf1
7
private void resetPosition(Tile current, int row, int col) { if(current == null)return; int x = getTileX(col); int y = getTileY(row); int distX = current.getX() - x; int distY = current.getY() - y; if(Math.abs(distX) < Tile.SLIDE_SPEED){ current.setX(current.getX() - distX); } if(Math.abs...
76eea3cb-4af5-47fc-83e8-ab583ff2c536
7
protected static void midpointDisplacement(final HeightField hf, final int L, final int MX, final int MY, int range, final float persist, final long seed) { /* * NOTE: A is (x1, y1) B is (x2, y2) A,B,C,D are the original "corner" * points * * G * * B D * * H E I * * A C * ...
ac1eab74-8de6-4569-a094-70833b2786e2
8
private Handler parseRequest(InputStream inputStream) throws IOException, ServerException { String commandString = StreamUtil.readLine(inputStream); if ("echo".equalsIgnoreCase(commandString)) { Handler handler = new EchoHandler(); return handler; } else if ("reverse".equalsIgnoreCase(commandString)) { ...
df3c3b28-8501-4b53-a186-d1d59bc43d50
7
private boolean searchDownForPrevIntersectionNode( Node node, K key, Object[] ret ) { while( true ) { int c = mComp.compareMinToMax( node.mKey, key ); if( c < 0 ) { // Node does not occur completely after mKey. // Check if right subtree might intersect mK...
c7feeeae-3d09-4a51-bb31-fb23cd97055e
2
@Override public void update(Observable obj, Object arg) { if (arg instanceof IRemovable) { if (((IRemovable) arg).needsRemoved()) { // Stop observing this object as we no longer care about it ((IObservable) arg).deleteObserver(this); remove(arg); } } }
a5cad327-5f52-417f-9ef7-4f41427f23d7
5
public boolean deletePatient(Patient patient) { if (nextPatient == null) { return false; } else if (nextPatient.name.equals(patient.name) && nextPatient.nextPatient != null) { nextPatient = nextPatient.nextPatient; nextPatient.previousPatient = this; retur...
d48ed2ce-83f6-4c86-a75e-c449b2b05752
0
public Validator<T> getValidatorLHS() { return validatorLHS; }
7ed3c07a-8e95-4e74-8459-6814e607dde3
4
public List<Booking> getBookingsByDate(Calendar date) { List<Booking> b = new ArrayList<Booking>(); Iterator<Booking> iter; iter = bookings.iterator(); while (iter.hasNext()) { Booking booking = iter.next(); if ((booking.getDate().get(Calendar.DAY_OF_MONTH) == date .get(Calendar.DAY_OF_MONTH)) &...
5ef28f4e-09cf-4156-a9a1-d452f8b2b8e0
0
private Language() { supportedLanguages = new HashMap<String, Locale>(); supportedLanguages.put("language_english", Locale.ENGLISH); supportedLanguages.put("language_german", Locale.GERMAN); }
7a61c0df-66f1-4166-b699-0652f3daacea
8
static void checkAccess(final int access, final int possibleAccess) { if ((access & ~possibleAccess) != 0) { throw new IllegalArgumentException("Invalid access flags: " + access); } int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1; int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1; int pro = (...
8e94bd80-d31a-489b-bb6e-0b58887166a3
7
public void setMetricType (SelectedTag d) { if (d.getTags() == TAGS_SELECTION) { m_metricType = d.getSelectedTag().getID(); } if (m_significanceLevel != -1 && m_metricType != CONFIDENCE) { m_metricType = CONFIDENCE; } if (m_metricType == CONFIDENCE) { setMinMetric(0.9); ...
5f90c841-d293-4854-8d12-4f9f8d41188d
0
public ConnectionLogger get_logger() { return new ConsoleConnectionLogger("bogus_route", 0); //throw new RuntimeException("not implemented"); }
6a8538d9-9343-48ee-a62f-88ae441db8e5
5
@Override public boolean run() { open(); // Open files // Split size long size = file.length(); if (verbose) Timer.showStdErr("Splitting file '" + fastqFile + "' into " + numSplits + " parts. File size: " + fileSizeStr(size) + " ( " + size + " bytes)."); long step = size / numSplits; if (step < 0) error("...
464b2660-913d-4b2d-ab47-3967a67a6aa8
9
public static void clearFolder(File folder){ if(folder.exists()) { for(String file : folder.list()) { if (new File(folder, file).isDirectory()){ //Logger.logInfo(new File(folder, file).toString()); clearFolder(new File(folder, file)); ...
de117bfd-143f-4606-98e6-814eef159fb2
8
public Location findNearestCorner(Location destination){ //TOP LEFT if (destination.mX < 300 && destination.mY < 300) { return ContactList.cPERSONCORNERS.get(0); } //TOP RIGHT if (destination.mX > 300 && destination.mY < 300) { return ContactList.cPERSONCORNERS.get(1); } //BOTTOM RIGHT if (desti...
503e09fb-f7e6-45b5-ae6d-e8e81bcf8939
8
public static RSInterface readHeaderChunk(JagexBuffer buffer) { try { int parentId = -1; int interfaceId = buffer.getUnsignedShort(); if (interfaceId == 65535) { parentId = buffer.getUnsignedShort(); interfaceId = buffer.getUnsignedShort(); } RSInterface rsi = new RSInterface(); RSInterface....
d47ca78b-41b2-4294-8d90-03df7d9dde39
7
public Point2D echarAdvance(final char ech) { // create a glyph vector for the char float advance; float advanceY; // check cache for existing layout String text = String.valueOf(ech); Point2D.Float echarAdvance = echarAdvanceCache.get(text); // generate metric...
8b1da870-c69f-42c0-b54b-f61755c7ed11
7
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SeviceStrategy service = new MenuService(); String action = null;//action being performed String[] delete = null;//array of deleted entrees Stri...
6f5de135-39fc-4eee-840d-453bd88e8a7b
9
public static List<String> generateAllSentencesWithFilteredDefinitions(GRESCTask task) { List<String> pSentences = new ArrayList<String>(); List<GRESCOption> options = task.getOptions().get(0); for (GRESCOption option : options) { String sentence = task.getSentence().replaceAll("%s", "\\(%s\\)"); String for...
ac938b32-15b4-4c15-a4da-7e34957a8211
7
ResultSetReference getResult(Connection conn, Parameter p) throws SQLException { if (!p.has(1)) { throw new UsageException(getUsage()); } final String cmd = p.asString(); final String tableName = p.at(1); final String option = p.at(2); try { Databa...
f6f05cad-d9b2-48cd-a8fc-3bf715f9e285
9
public void mouseMoved(MouseEvent paramMouseEvent) { if (ImageButton.this.Enabled) { if ((ImageButton.this.MouseOverImage != null) && (ImageButton.this.ImageMap != null)) { if (ImageButton.this.checkMap(paramMouseEvent.getX(), paramMouseEvent.getY()) != null) {...
06553837-03e8-47d0-b81f-caf96ca4de3c
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Pessoa other = (Pessoa) obj; if (this.idPessoa != other.idPessoa && (this.idPessoa == null || !this.idPes...
bc916b5a-f3ba-4810-a2f4-cd854aebdf05
2
public void laggTillFramfor(Punkt horn, String hornNamn) { Punkt[] h = new Punkt[this.horn.length + 1]; for(int i = 0, i2 = 0; i < this.horn.length; i++, i2++) { if(i == findPunkt(hornNamn)) { h[i] = horn; i++; } h[i] = this.horn[i2]; } this.horn = h; }
34b057b3-34c3-46fd-b978-cadf81b7abf1
3
public DrawableComponent drawData() { if (opaque) { RenderUtil.setRenderingMode(this, RenderUtil.NORMAL_MODE); } else if (!opaque && loadAsModel) { RenderUtil.setRenderingMode(this, RenderUtil.MODEL_MODE); } else { S...