method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e3faa108-689b-47e4-a46d-6a08db0a0e84
7
@Override public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { String method = request.getRequestLine().getMethod() .toUpperCase(Locale.ENGLISH); if (!method.equals("GET") && !method.equals("HEAD") && !method.equals("POST")) { throw n...
93bf22c0-dc88-49de-9b91-d1897c9062de
6
public String displayGW_ShipMMSI (List<Integer> mm,int totalDigits) { StringBuilder sb=new StringBuilder(); int a,digitCounter=0; for (a=0;a<6;a++) { // High nibble int hn=(mm.get(a)&240)>>4; // Low nibble int ln=mm.get(a)&15; // The following nibble int followingNibble; // Look at the next b...
13d9d883-7e06-46f1-89ae-71d684529f9f
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Paciente)) { return false; } Paciente other = (Paciente) object; if ((this.idPaciente == null && other.idPacien...
2aadf3e0-296d-478c-bc15-c2c0d795ed26
2
@Override public void run() { ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); lastSample = System.nanoTime(); lastCPUSample = threadMXBean.getThreadCpuTime(monitoredThread.getId()); while (true) { try { Thread.sleep(interval); } catch (InterruptedException e) { Thread.cu...
d5d4e39c-6758-4094-9553-3a9d5a5b1a23
8
public static TruthValue strengthenTruthValue(TruthValue tv1, TruthValue tv2) { if (((tv2 == Logic.TRUE_TRUTH_VALUE) || (tv2 == Logic.FALSE_TRUTH_VALUE)) && ((tv1 == Logic.DEFAULT_TRUE_TRUTH_VALUE) || (tv1 == Logic.DEFAULT_FALSE_TRUTH_VALUE))) { if ((tv1 == Logic.TRUE_TRUTH_VALUE) || ...
aeeaf83f-bfea-4bf3-babe-c23135560e19
2
private final AStarNode obtainOpenWithLowestCost() { Iterator<Entry<Float, Vector<AStarNode>>> entries = open.entrySet().iterator(); if (!entries.hasNext()) return null; Vector<AStarNode> costEntry = entries.next().getValue(); int lastCostEntry = costEntry.size() - 1; AStarNode lowestCostNode = costEntry.g...
08b78069-887b-452b-b475-7eb280a29c25
5
public void commit() { Connection conn = getConnection(); try{ conn.setAutoCommit(false); for(EntityBase ent : added.keySet() ) { switch(ent.getOperation()) { case insert: { added.get(ent).persistAdd(ent); } case delete: { added.get(ent).persistDelete(ent)...
fbbda191-d9bc-40c8-afa7-3e6459b225cf
9
private void detectAnnotation(Method method, int index, Annotation annotation, Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexMap, Class<?>[] paramTypes) throws DaoGenerateException { Class<? extends Annotation> annotationType = annotation.annotationType(); if (Param.class.equals(annotati...
60e1c5d3-badb-4d3e-95b8-d38652f0c130
5
public static ClauseSet get(File file) { ClauseSet clauseSet = new ClauseSet(); Scanner scan = null; try { scan = new Scanner(file); while (scan.nextLine().startsWith("c")) {/* skip commments */ } Clause clause = new Clause(); while (scan.hasNextInt()) { int var = scan.nextInt(); if (var ==...
6ccf4e25-5bb9-4f99-8d00-ff68aca7d0de
7
public void loadProperties(String fileName) throws FileNotFoundException { InputStream in = null; try { in = PropertiesReader.class.getClassLoader().getResourceAsStream(fileName); if(in == null ){ in = new FileInputStream(System.getProperty("user.dir")+ File.separ...
6b08a614-97d0-4fcd-8b03-fb9ab6e16815
0
public CommandWarn(CreeperWarningMain plugin) { this.plugin = plugin; this.pds = new playerDataSave(plugin); }
53730ed2-7d3b-426f-8884-59c64c84c2e7
6
protected boolean collidingWithGround() { if(!collidable) return false; if(!crouch || !crouchable){ if(game.getCurrentLevel().isBlockAtPixelCollidable(x,y-(height/4)) ){ return true; } } else if(crouchable){ if(game.getCurrentLevel().isBlockAtPixelCollidable(x,y-(height/4)+(int)((tempHeight/crouch...
c7428ad7-7a46-4909-9d70-af133d324377
4
public String toString() { if (kind.equals(Kind.ERROR)) { return String.format(error, kind, lexeme, lineNumber, charPosition); } if (kind.equals(Kind.INTEGER) || kind.equals(Kind.FLOAT) || kind.equals(Kind.IDENTIFIER)) { return String.format(responseValue, kind, lexeme, lineNumber, charPosition); ...
d3f6d8fe-15d7-41ff-adfe-6b4033855091
2
public AStarNode obtainOpenNodeWithLowestCost() { Iterator<Entry<Float, Vector<AStarNodeVector3D>>> entries = open.entrySet().iterator(); if (!entries.hasNext()) return null; Vector<AStarNodeVector3D> costEntry = entries.next().getValue(); int lastCostEntry = costEntry.size() - 1; AStarNode lowestCostNode ...
80fb0491-de54-42a9-9c4f-f497d85afdbf
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...
e10bbf16-56df-4118-8d0c-840049866b89
5
@Test public void testRecursion() { Recursion recursion = new Recursion(); assertTrue(recursion.nthFibonacci(0) == 0); assertTrue(recursion.nthFibonacci(1)==1); assertTrue(recursion.nthFibonacci(2)==1); assertTrue(recursion.nthFibonacci(3)==2); assertTrue(recursion.nthFibonacci(10)==55); Set<String> s...
06b6e5b8-c9d5-45b5-91c9-569ae6c8510c
4
public void mouseDoubleClicked(Point p){ //update current index curr=mygraph.findIndex(p); //pop up the curr location's property if(curr!=-1){ JOptionPane mypane=new JOptionPane(); String display="Name:"+getCurrName()+"\n(x,y)=(" +getCurrPoint().getX()+","+getCurrPoint().getY()+")\...
244bc489-70b8-4b08-8304-0cdb9413300b
6
protected void doAction(int type, int bonus) { if (!mapGenerate) if (type == 1) { isAttack = true; attackDamage = getAttack(bonus); if (Parameters.getInstance().isDebug()) logger.info("Attack damage = " + attackDamage); ...
8d938907-d8de-4203-916d-bc7c831d8e81
1
public void push(ArrayList<Card> list, int card) { try { list.add(this.card[card]); } catch (Exception ex) { // if arrayList becomes empty handle exception here... } }
a6bed60e-76ab-46ef-bc20-9183ccbddaf8
8
public boolean addFFmpegArgument(FFmpegArguments arguments) { boolean ret = false; if (connection == null || arguments == null || arguments.getName() == null || arguments.getArguments() == null || arguments.getFileExtension() == null || hasFFmpegArgumentsName(arguments.getName())) return ret; try { ...
f33e40e0-1832-44a9-94b6-2e77f3163bbd
3
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] da = a.get2DData(px, pz, sx, sz); double[] db; if(a == b) db = da; else db = b.get2DData(px, pz, sx, sz); int s = sx*sz; for(int i = 0; i < s; i++) da[i] = da[i] < db[i] ? da[i] : db[i]; ...
f9101fb0-0120-48ba-b80f-397f7d7a3d67
4
private Run prepInsertionRun(int x, int y) { Run currentRun = getFirst(); int insertionPoint = wrap(x, y); int position = 0; int totalLength = width * height; while(position < totalLength) { if(insertionPoint > currentRun.getRunLength() + position - 1) { position += currentRun.getRunLength()...
2529afd5-b942-4809-8daa-348321b9d1c4
8
List<CourseListing> getByType(String selectedType) { List<CourseListing> courseListing = new ArrayList<CourseListing>(); try { //Connect to database conn = DriverManager.getConnection(url, userName, password); stmt = conn.createStatement(); ResultSet r...
27a9fcbc-6bd4-4fd2-99aa-28d87be8a5a3
2
final public void setFooter(String firstLine, String... additionalLines) { footer.clear(); footer.add(firstLine); if (additionalLines != null) { for (String line : additionalLines) { footer.add(line); } } onChange(); }
913eb818-9f6b-46eb-809b-ec69dc27062c
8
public ArrayList<Gridspot> findVertices(Gridspot take, Gridspot goal) { ArrayList<Gridspot> retur = new ArrayList<Gridspot>(); int x = take.getXIndex(); int y = take.getYIndex(); if (!getG(x+1,y).occupied || getG(x+1,y) == goal ) { retur.add(getG(x+1,y)); } if (!getG(x-1,y).occupied || getG(x-1,y) ==...
b512a863-43d5-4e53-a5f4-7b965ac87151
8
public boolean irrigated(int r, int c) { boolean temp = false; if (c > 0) { temp = temp || verticalRivers[r][c-1]; } if (c < cols - 1) { temp = temp || verticalRivers[r][c]; } if (r > 0) { temp = temp || horizontalRivers[r-1][c]; } if (r < rows - 1) { temp = temp || horizontalRivers...
ba754bf0-1d19-4383-b6cd-9abd8283187a
1
public static int[] generate(int n) { Random random = new Random(); int[] list = new int[n]; for (int i = 0; i < n; ++i) { list[i] = random.nextInt() % n; } return list; }
fb49e2f0-3f54-4762-b5f6-a7e5fac9222c
7
protected int getCorrectDirToOriginRoom(Room R, int v) { if(v<0) return -1; int dir=-1; Room R2=null; Exit E2=null; int lowest=v; for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--) { R2=R.getRoomInDir(d); E2=R.getExitInDir(d); if((R2!=null)&&(E2!=null)&&(E2.isOpen())) { final int dx=com...
07f3b785-3613-4ae0-8ec0-ef27d1073b8a
9
public String getAnswer() throws Exception { Map<Integer,Integer> cache = new HashMap<Integer, Integer>(); Stack<Integer> currChain = new Stack<Integer>(); int[] digitFactorials = getDigitFactorials(); int retVal = 0; for (int i = 1;i<1000000;i++) { if (cache.contain...
99b957c9-de1d-4899-a48e-a81ece687953
0
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { throw new RuntimeException(); }
46b3bb00-386a-49f9-a21f-6eb5268af4bc
0
@Test @TestLink(externalId = "T2") public void testFailed() { assertTrue("Failed", false); }
4e070ebc-4d0b-41eb-a42f-15fe42090d3b
5
public String encrypt(String word){ if(word == null||word.length()==0) throw new IllegalArgumentException(); String result = ""; String wordLower = word.toLowerCase(); for(int i=0; i<wordLower.length(); i++){ if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122) throw new IllegalArgumentException(); i...
86669aa3-8373-44bc-b718-09767c73e3a2
8
public void fillDeck() { int z = 0; for(int i = 0; i < 20; i++) { switch (z) { case 0: addCard(new pieThrow()); z++; break; case 1: addCard(new attack()); z++; break; case 2: addCard(new fireEverythin...
5e4326aa-7f06-4662-b0c5-1c5e46c45112
0
public void makePayment(int amount) { this.balance = this.balance - amount; }
72fbf82b-6a0e-4a48-841d-3e020c55580a
4
protected Transition createTransition(State from, State to, Node node, Map e2t, boolean bool) { String read = (String) e2t.get(TRANSITION_READ_NAME); String pop = (String) e2t.get(TRANSITION_POP_NAME); String push = (String) e2t.get(TRANSITION_PUSH_NAME); if (read == null) read = ""; // Allow lambda trans...
97b15def-76d1-46b7-bd68-1d5645975088
0
public void setDesc(String value) { this.desc = value; }
be0b6d20-bade-4ff8-bec4-c4e86402fca7
2
public boolean isSheetExist(String sheetName){ int index = workbook.getSheetIndex(sheetName); if(index==-1){ index=workbook.getSheetIndex(sheetName.toUpperCase()); if(index==-1) return false; else return true; } else return true; }
c4f3df2e-7c1f-44f4-8a23-f37f74a56b93
6
public void openFacts(){ int returnVal = fileChooser2.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser2.getSelectedFile(); String filepath = file.getAbsolutePath(); factsLocation.setText(filepath); try{ ...
97703175-cd28-4f2d-9a06-af68c22e795a
6
public void generateComb2(ArrayList<ArrayList<Integer>> result,ArrayList<Integer> list,int[] num,int target,int index){ if (target == 0){ ArrayList<Integer> temp = new ArrayList<Integer>(); for (int i = list.size()-1;i>=0;i--){ temp.add(list.get(i)); } ...
58bfdbb4-144f-49ea-9546-739ee378997e
4
public String hornGen(){ rand = new Random(); int hornRoll = (rand.nextInt(100)+1); if(hornRoll <= 40){ horn = "Silver"; } else if(hornRoll <= 75){ horn = "Brass"; } else if(hornRoll <= 90){ horn = "Bronze"; } else if(hornRoll <= 100){ horn = "Iron"; } return horn; }
22d2063c-85fd-4888-b41c-bcbefad2c457
8
private DrawableTree phyloXMLToTree(org.w3c.dom.Document doc) throws FileParseException { Node documentRoot = doc.getDocumentElement(); Node child = documentRoot.getFirstChild(); DrawableNode root = null; //Search for (the first) phylogeny element while(child != null) { if (child.getNodeType() == Nod...
d777c14f-faa6-499d-84d7-7a88ec2461dd
6
public void deleteTask(jpvmTaskId tid) { if(tasks == null) return; jpvmTaskListRecord tmp = tasks; // Check head if(tmp.tid.equals(tid)) { if (iter == tmp) iter=tmp.next; tasks = tasks.next; num_tasks --; return; } // Check body while(tmp.next != null) { if(tmp.next.tid.equals(tid)) { ...
f83aa09b-eafa-4a96-8e76-b565bc72b25a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WifiId other = (WifiId) obj; if (BSSID == null) { if (other.BSSID != null) return false; } else if (!BSSID.equals(other.BSSID)) ...
9f94ead5-b0bb-4e5a-9071-5173c0e474ab
4
public Proceso(int pid, boolean esTiempoReal, int prioridadEstatica, ArrayList<Integer> tiempoCPU, ArrayList<Integer> tiempoIO, int tiempoEntrada) { this.pid = pid; this.esTiempoReal = esTiempoReal; this.prioridadEstatica = prioridadEstatica; this.tiemposCPU = tiempoCPU; this.tie...
da308666-532e-45ed-b15e-771efa9365ad
2
private void moveDown() { int[] rows = table.getSelectedRows(); DefaultTableModel model = (DefaultTableModel) table.getModel(); try { if (model.getRowCount() >= 2) { model.moveRow(rows[0], rows[rows.length - 1], rows[0] + 1); table.setRowSelectionInterval(rows[0] + 1, rows[rows.length - 1] + 1); ...
2afa492b-6813-46b1-a789-1cb61c7ee67d
6
public static long[] getKPrimes(int k, boolean print) { long[] primes = new long[k]; primes[0] = 2; int currPrimeCount = 1; for(int i=3;currPrimeCount<k;i+=2) { // even number cannot be prime boolean isPrime = true; long sqrt = (long) Math.sqrt(i); for(int j=0; j<currPrimeCount && primes[j]<=sq...
0ccd5757-0661-430c-aa69-b79dc464abc6
0
public String getName() { return name; }
5b967b32-0765-47e0-ba9b-60153cab9637
9
@Override public long split(long count, LongBitSet rightTree, PointWriter left, PointWriter right, boolean doClearBits) throws IOException { if (left instanceof OfflinePointWriter == false || right instanceof OfflinePointWriter == false) { return super.split(count, rightTree, left, right, doClearBi...
73c2c0ac-9a03-44fc-8fee-1fb07ba1cc86
7
protected void readAttribute(String name, int length, ConstantPool cp, DataInputStream input, int howMuch) throws IOException { if ((howMuch & KNOWNATTRIBS) != 0 && name.equals("ConstantValue")) { if (length != 2) throw new ClassFormatException("ConstantValue attribute" + " has wrong length"); int ...
532668ae-0719-4e7d-b51e-ee5dd04f30ed
7
public void setCombination(int x, int y, int z){ if(x < 0 || x > dialSize){ throw new IllegalArgumentException(x + " is not a valid combination number"); }else this.x = x; if(y < 0 || y > dialSize){ throw new IllegalArgumentException(y + ...
0cd9aecb-26d4-4f3e-b098-4d3df8ac2e07
8
private boolean inPoly(FastVector ob, double x, double y) { int count = 0; double vecx, vecy; double change; double x1, y1, x2, y2; for (int noa = 1; noa < ob.size() - 2; noa += 2) { y1 = ((Double)ob.elementAt(noa+1)).doubleValue(); y2 = ((Double)ob.elementAt(noa+3)).doubleValue(); if (...
5e148537-70e6-4ebd-bb50-c045f647fa29
1
public void setExceptionHandlers(final Catch[] handlers) { if (code != null) { code.setExceptionHandlers(handlers); } }
d801809b-926a-42d4-bad6-44225993129a
0
@Test public void findHandFromCardSet_whenFlushOrStraightPossible_returnsFlush() { Hand hand = findHandFromCardSet(sixFlushWithStraight()); assertEquals(HandRank.Flush, hand.handRank); assertEquals(Rank.Jack, hand.ranks.get(0)); assertEquals(Rank.Ten, hand.ranks.get(1)); assertEquals(Rank.Nine, hand.ranks.ge...
bbbdda17-669b-45d3-8f32-3512905a0778
1
private void registerAll(final Path start) throws IOException { // register directory and sub-directories Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOExc...
6546040e-bc1c-4da4-bd04-fbe6a2161dbf
6
static boolean sqlQueryP(String sqlExpression) { { int start = 0; int end = 0; String operator = ""; while (Stella.$CHARACTER_TYPE_TABLE$[(int) (sqlExpression.charAt(start))] == Sdbc.KWD_WHITE_SPACE) { start = start + 1; } end = start; while (Stella.$CHARACTER_TYPE_TABLE...
ffe49b7e-9443-43cd-b2a7-8d690a20837c
3
public boolean findAtNorth(int piece, int x, int y){ if(x==0 || b.get(x-1, y)==EMPTY_PIECE) return false; else if(b.get(x-1, y)==piece) return true; else return findAtNorth(piece,x-1,y); // there is an opponent } // end findAtNorth
f7cc0b95-7c97-48b4-9874-e5b208e7314c
4
public void dumpStrings(String filter) throws FileNotFoundException { System.out.println("Dumping Strings"); PrintWriter writer = new PrintWriter("Ressources.txt"); for(Map.Entry<String,ArrayList<RAFFile>> file : archives.entrySet()) { for(RAFFile rafFile : file.getValue()) ...
08fc2ef7-1dee-4240-9ead-1edf63d50aa8
2
public static double logNormalPDF(double mu, double sigma, double x) { if (sigma < 0) throw new IllegalArgumentException("The parameter sigma, " + sigma + ", must be greater than or equal to zero"); if (x < 0) { return 0.0D; } else { return Math.exp(-0.5D * Fmath.square((Math.log(x) - mu) / sigma)) / (x * s...
f9debfa4-96dd-4111-b7e3-6e099f1d7b25
5
private void doStuff(Point temp){ if(!ifOutOfMaze(temp)){ if(pathSize[temp.x][temp.y] == -1){ if(Game.get().level.getBlock(temp.x, temp.y).getType() == Block.AIR){ toCheck.add(temp); } for(Teleporter t : teleporters){ if(t.type.equals("in")) toCheck.add(new Point(t.toX, t.toY)); } ...
7ec92963-11e1-4d7f-b56c-01ee8eb05f9a
7
@Override public void actionPerformed(ActionEvent e) { if(e.getSource().equals(playButton)) { if(gui.getSimulator().isPaused()) { if(gui.getSimulator().play()) { playButton.setIcon(pauseIcon); stepButton.setEnabled(false); } } else { if(gui.getSimulator().pause()) { ...
500ce1eb-017a-4d90-86dc-7815d47a062c
4
private List<T> calcPath(T start, T goal) { // TODO if invalid nodes are given (eg cannot find from // goal to start, this method will result in an infinite loop!) LinkedList<T> path = new LinkedList<T>(); T curr = goal; int i = 0; boolean done = false; while (!done) {...
0db482c8-0c9a-4399-a997-9743f069ee4d
7
public int[] addInstance(BallNode node, Instance inst) throws Exception { double leftDist, rightDist; if (node.m_Left!=null && node.m_Right!=null) { //if node is not a leaf // go further down the tree to look for the leaf the instance should be in leftDist = m_DistanceFunction...
9d352258-7e8a-4846-8cc6-35e92200fbc4
5
@Override public boolean selectFileToOpen(DocumentInfo docInfo, int type) { // we'll customize the approve button // [srk] this is done here, rather than in configureForOpen/Import, to workaround a bug String approveButtonText = null; // make sure we're all set up lazyInstantiation(); // Setup the Fi...
1c394286-7f00-4cf3-9d7a-8e0ae586389e
4
public void addPlayer(int playerID, String name, Team t) { Area spawnArea = board.getSpawnArea(t); Location spawnLoc = new NullLocation(); for (Tile tile: spawnArea.getTiles()) { if (tile.isClear()) { spawnLoc = tile.getCoords(); if (isFree(spawnLoc)) { break; } } } server.queuePlayerUp...
534a4bed-6b04-4c52-aadb-887aa2abf6f6
1
@Override public void addExperienceRecord(StatisticDto statisticDto) { if (warehouse.containsKey(statisticDto.userId)) { List<StatisticDto> userRecords = warehouse.get(statisticDto.userId); userRecords.add(statisticDto); } else { List<StatisticDto> userRecords = new ArrayList<StatisticDto>(); userReco...
af381ad7-f3fd-40a3-9f57-90307fa14bc1
9
public int selectCount(BoardModel boardModel) { int totalCount = 0; String searchType = boardModel.getSearchType(); String searchText = boardModel.getSearchText(); String whereSQL = ""; try { // 검색어 쿼리문 생성 if (!"".equals(searchText)) { if ("ALL".equals(searchType)) { whereSQL = " WHERE SUBJECT ...
ee521d11-ff96-4678-be5a-bacfb53c409f
4
public boolean setPlayer1(Player p) { boolean test = false; if (test || m_test) { System.out.println("FileManager :: setPlayer1() BEGIN"); } m_player1 = p; if (test || m_test) { System.out.println("FileManager :: setPlayer1() END"); } return true; }
8a2c3542-d9e9-47bb-943d-0a1b2e4ce19c
0
public void updateTxtBoard(String message){ txtBoard.append(message); txtBoard.setCaretPosition(txtBoard.getDocument().getLength()); }
204180ee-823a-4c0a-b5cf-3bab16e8ca0c
5
private void btnEkleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEkleMousePressed if(!btnEkle.isEnabled()) return; HashMap<String, String> values = new HashMap<>(); values.put("ad", txtAd.getText().trim()); values.put("soyad", txtSoyad....
cb8dcbf8-ca1e-4789-9eed-54d2b396732b
4
public void switchPhase(){ if(this.gamePhase!=null){ switch(gamePhase){ case BlockPhase1: this.gamePhase = GamePhase.PowerupPhase; break; case PowerupPhase: this.gamePhase = GamePhase.BlockPhase2; break; case BlockPhase2: switchTurn(); this.gamePhase = GamePhase.BlockPhase1; br...
0c93c19b-9b9b-4f42-a34c-a90712f339bc
1
private void initialize(QuadTree quadTree, List<PolygonShape> landShapePolygons, List<PolygonShape> landUsePolygons) { quadTreeToDraw = quadTree; visibleArea = new VisibleArea(); this.landShapePolygons = landShapePolygons; this.landUseShapePolygons = landUsePolygons; this.routeNodes = new ArrayList<>(); ti...
1b5e2c4d-89ab-4668-bdd6-ddd7a33bb0a3
4
public static String getString(Node node, String xpath) { NodeList nodeList = getNodeList(node, xpath); if (nodeList == null || nodeList.getLength() == 0) { return ""; } if (xpath.endsWith(ELEMENT_NAME_FUNC)) { if (nodeList.getLength() > 0) { ret...
c028aae5-9ceb-4992-b7fa-608a10cef67e
0
public AutomatonDrawer getDrawer() { return pane.getDrawer(); }
b0442e1b-7671-4d4d-abf0-44232bcc9deb
0
public int getFileIndex() { return fileIndex; }
c20f2cde-9d37-4250-9258-3cbfe02a8c9e
8
@Override public void run() { initializeLogger(); this.log.fine("Start FileReceiver"); this.log.fine("Get current thread"); Thread currentThread = Thread.currentThread(); if (currentThread.isInterrupted()) return; ServerSocket fileServerSocket = null; try { fileServerSocket = new ServerSocket(this.por...
6fe5c10e-ad37-4a58-81a3-66321f731345
1
private void btnAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarActionPerformed UsuarioSistema usuario = null; UsuarioSistemaDAO daoUsuario = new UsuarioSistemaDAO(); try { usuario = dao.Abrir(this.idUsuarioRemover); } catch (Exception ex) { ...
d04a1487-6bcd-4516-b7f5-f5c7dc9371e9
1
private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } }
5508833e-104e-4d82-b22b-3d297cbe8f61
9
public static Method findMethod(Class<?> clazz, String name, Object... args) { if (args != null && args.length > 0) { int size = args.length; Class<?>[] argsClazz = new Class<?>[size]; for (int i = 0; i < size; i++) { argsClazz[i] = args[i].getClass(); } try { return clazz.getMethod(name, argsC...
939d5d7e-6ee1-4856-a532-d18010d30d31
6
public void alterar(Medico medicoAnt) throws Exception { if(medicoAnt.getNome().isEmpty()){ throw new Exception("Nome Invalido !!"); }else{ this.verificarNome(medicoAnt.getNome()); } if(medicoAnt.getCpf().equals(" . . - ")){ throw new Exception(...
35401b94-5ae7-49e4-bcfd-f32386623ab0
5
public static Set<String> getClassName(String packageName, boolean isRecursion) { Set<String> classNames = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); String packagePath = packageName.replace(".", "/"); URL url = loader.getResource(packagePath); i...
45c796fa-016a-4df8-8f36-cc2da0489df9
7
public static void main(String[] args) { String s = "aaabbbbcccaab"; List<String> result = new ArrayList<String>(); for (int i = 0, j = i + 1, l = s.length(); i < l; i = j) { char temp = s.charAt(i); for (; j < l; j++) { if (temp != s.charAt(j)) { ...
bd446bf4-5f3b-46e4-9a23-06f50d8c7e6a
7
public String loginAction() { String returned = null; FacesContext context = FacesContext.getCurrentInstance(); User user = userService.getUserByEmail(userName); if (user == null){ user = userService.getUserByUserName(userName); if (user == null){ context.addMessage(nul...
59d67923-8a22-49b6-bb1b-449eaed8f38a
8
node mutateRecurse(node nodeptr, doublePointer ratioptr , mutations newmuts, double tree_age, double threshold, double loc) { node mutatenode = null; if (nodeptr.getDescendents()[0] != null) { if (segFactory.segContains(nodeptr.getDescendents()[0].getSegment(), loc)) { double temp = (dou...
598d8622-52e3-4c16-90a4-6dd4ec0d5f74
1
public void requestBlock(int pieceIndex, int pieceOffset, int length) { if (this.peer_choking) { return; } // busy = true; byte[] message = Message.buildRequest(pieceIndex, pieceOffset, length); sendMessage(message); // TODO }
8ce808ee-7dc1-4401-80a2-7233ff0f4b0b
1
protected void setLabel(String label) { /* * The null check should not be needed as label should not be null * so this is being too careful. */ if(label == null) myLabel = ""; else myLabel = label; }
94ce920e-0371-481f-a4b9-27555d6c1c6a
7
public void maskRect(int x, int y, int w, int h, int[] pix, byte[] mask) { assert data instanceof int[]; int maskBytesPerRow = (w + 7) / 8; for (int j = 0; j < h; j++) { int cy = y + j; if (cy < 0 || cy >= height_) continue; for (int i = 0; i < w; i++) { int cx = x + i; ...
d7addf14-175b-4108-8337-a24df3c73c90
5
protected void multiply(int rows) throws MatrixIndexOutOfBoundsException { //temporary variable double temp = 0; //It is one-tenth of the number of rows of the matrix int stepProgress = rowsA / 10; //this quantity of rows which the thread takes int step = matrixA.getStepR...
8d43c6ce-9049-4f5d-b221-cdf33ede94ef
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProductList other = (ProductList) obj; if (maxIndex != other.maxIndex) re...
d69db03f-705c-4c72-ab1e-ec82ffdd2e69
7
private float computeTempObj(List<JstatItem> subList, JvmModel fPhaseMax, Reducer fReducer) { float tempObj = 0; float shuffleBytesMB = (float) ((double)fReducer.getReducerCounters().getReduce_shuffle_raw_bytes() / (1024 * 1024)); JstatItem lastJstat = subList.get(subList.size() - 1); if(lastJstat.getFGC() =...
1f554841-b965-489c-993f-6cd3cb9ee81d
6
static final void method587(int i, int j, int k, int l, int i1, int j1, boolean flag, int k1, int l1, int i2) { if (flag) { method585(null, 72); } if (k == l && i == i1 && ~i2 == ~l1 && k1 == j1) { Class1.method70(i, j1, i2, j, false, k); return; } ...
11bd31c2-4439-46d1-8b45-d7260efcd619
7
private Expression matchDesignator(DesignatorType designatorType) { dispatchEvent(ParserEvent.BEGAN_PARSING_NON_TERMINAL_SYMBOL, "Designator"); SyntacticValidator.getInstance().matchNextToken(ProductionRule.REQUIRED, Token.Type.IDENTIFIER); SemanticValidator.getInstance().validateDeclarationIsNotAType(SemanticVa...
4bc58a59-bc83-44e3-a483-74dfd23e4024
2
@Override public byte[] getContent() throws IOException { if (content == null) { try (BufferedInputStream is = new BufferedInputStream(fullUrl.openStream())) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int n; byte[] data = new byt...
07a20790-c925-4342-9c99-187edad6af3b
2
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { if (!ClassReader.ANNOTATIONS) { return null; } ByteVector bv = new ByteVector(); // write type, and reserve space for values count bv.putShort(newUTF8(desc)).putShort(0); AnnotationWriter aw = new AnnotationWriter(thi...
98eee2db-d8a5-4cc1-9b23-6841bf7cea26
5
private void processSelectedKeys(Set keys) throws Exception { Iterator itr = keys.iterator(); while (itr.hasNext()) { SelectionKey key = (SelectionKey) itr.next(); if (key.isReadable()) processRead(key); if (key.isWritable()) processWrite(key); if (key.isC...
0c29acd0-f49e-45c2-aa0e-231416ecd5ea
7
private void sendGuessSet() { Dot[] dots = guessSet.getDots(); boolean isInvalid = false; // Check if dots in guess set are default color (not changed). for (int i = 0; i < dots.length; i++) { if (dots[i].getColor().equals(GameColor.DEFAULT.getColor())) isInvalid = true; } // Send guess set to sess...
e06067c3-aaa2-4aa5-bb85-0fa03ae88686
0
public int getPlayerGem() { return karel.getGemCount(); }
c9284e3e-07a0-494b-a592-bb78795a4eb6
0
public void saveConfig() { this.plugin.saveConfig(); }
0d3b77fc-d56a-4382-ab42-4df00a958254
1
private ArrayList<Pawn> getAllPawn(Board board) { ArrayList<Pawn> pawns = new ArrayList<Pawn>(); int numberOfPawns = board.numberOfPawns(); for (int i = 0; i < numberOfPawns; i++) { pawns.add(board.getNextPawn()); } return pawns; }
9dbc3127-44d8-4fc0-a396-e1633bc2bd71
6
private void promoteAvatarToDrawable(List<DrawableAvatar> drawables, int x, int y, int width, int height, int offset) { double spacing = offset * avatarSpacing; double avatarPosition = this.avatarPosition + spacing; if (avatarIndex + offset < 0 || avatarIndex + offset >= avata...
fbae70d2-bd27-4ecd-9eca-c3373c1e166b
1
public void write(char[] b, int off, int len) throws IOException { if (!initialized) { area.setText(""); initialized = true; } // /#ifdef AWT10 // / area.appendText(new String(b, off, len)); // /#else area.append(new String(b, off, len)); // /#endif }