method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e19c993a-280e-41d3-9791-1e62095046ee
3
@Override public Object clone() { try { ExtendedGeneralPath result = (ExtendedGeneralPath) super.clone(); result.path = (GeneralPath) path.clone(); if (values != null) { result.values = new float[values.length]; System.arraycopy(values, 0, result.values, 0, values.length); } result.numV...
9787da88-0fe6-4a11-8733-e39ce7a55256
6
public static void initCells(){ //populate(); for(int i =0;i < GameClass.WIDTH; i++) { for(int j =0;j <GameClass.HEIGHT; j++) { Map[i][j] = new cell(i,j,6340095 - random.nextInt(j+1) + random.nextInt(j+1)*255,1); } } int floatdepth = 33; for(int i =0;i < GameClass.WIDTH; i++) ...
078989d7-e5ad-416c-835c-43e7b9a289c3
4
public static boolean isDown(String action) { List<Integer> keys = actions.get(action); if(keys == null) { logger.error("Key not registered; returned false"); return false; } boolean result = false; Iterator<Integer> it = keys.iterator();...
7f50f9d7-dbf5-4785-956c-9052cb40d350
1
@Override @Command public Response topThreeDownloads() throws IOException { if(initRMI()) return proxyRMI.topThreeDownloads(); else return new MessageResponse("Cannot connect to Proxy via RMI"); }
bed183fb-3de5-478e-941e-83ec7b7af57b
7
public FileBestScoreManager() { file = new File("Bscores.txt"); FileReader fr =null; try { fr = new FileReader(file); String str = ""; int i = 0; //Reading data while((i = fr.read()) != -1) str += (char)i; best = Integer.parseInt(str); //System.out.println(best); } catch (FileNotF...
a3d346f7-9902-490a-aa96-2a7297dfb5b5
4
public boolean incluirEmOrdem(ContaCorrente conta) { if(!this.estaOrdenado) return false; int kn = conta.getNumero(); int j = this.quantasContas; while(j > 0 && this.aContas[j-1] != null && this.aContas[j-1].getNumero() > kn) { this.aContas[j] ...
1e17336b-43d4-42f2-91b9-f305158b2fcf
7
public int toInt(Piece p) { if (p.toString().charAt(1) == 'P') return 0; if (p.toString().charAt(1) == 'N') return 1; if (p.toString().charAt(1) == 'B') return 2; if (p.toString().charAt(1) == 'R') return 3; if (p.toString().charAt(1) == 'Q') return 4; if (p.toString().charAt(1) == 'K') re...
518419a0-5c36-4bb3-8b15-f2f56fc0e051
9
private static boolean deleteDirectory(String dir) { if (!dir.endsWith(File.separator)) { dir = dir + File.separator; } File dirFile = new File(dir); if (!dirFile.exists() || !dirFile.isDirectory()) { return false; } boolean flag = true; File[] files = dirFile.listFiles(); for (int i = 0; i < file...
91d16f09-1c09-4400-894e-bf71ab0c40a8
5
public static JSplitPane setDividerLocation(final JSplitPane splitter, final double proportion) { if (splitter.isShowing()) { if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { splitter.setDividerLocation(proportion); } else { splitter.addComponent...
cca0b638-d7fe-47ab-88d6-a3570dca35f9
2
@Override public void actionPerformed(ActionEvent e) { if ("power".equals(e.getActionCommand())) { Card card = new Card(Card.CardType.POWER); Main.openCardEditor(card); } else if ("feat".equals(e.getActionCommand())) { Card card = new Card(Card.CardType.FEAT); Main.openCardEditor(car...
198460c7-995e-45c3-9de8-df1e95c00192
4
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In login user handler"); String responseMessage = ""; boolean successfulRequest = false; if (exchange.getRequestMethod().toLowerCase().equals("post")) { BufferedReader in = new BufferedReader(new InputStreamRe...
f80c5c9c-0831-4512-9a62-608940799bc9
9
public static URL getUrlOfZippedVersion(URL repoURL, String suffix, boolean returnAlternateArchives) throws MalformedURLException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(repoURL.openStream())); suffix = suffix.trim(); String line; String toReturn =...
6d5c91fd-4de8-4074-b303-22b6823989b8
2
private String createTableName() { ClassInspect inspector = getClassInspector(); Table tableAnnotation = (Table) inspector.findAnnotation(Table.class); if(tableAnnotation == null) return ""; StringBuilder builder = new StringBuilder(); String schema = tableAnnotation.schema().trim(); String tableName = t...
ff3f8fe0-0c6f-4828-a865-eca488ed4f7b
9
private void handleKeyboard() { //todo: interpolation - queue movement? final float movementSpeed = 1.5f; final float runModifier = 2.0f; float distance = timer.getDeltaTime() * movementSpeed; //unbuffered input if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ...
3cd97456-237f-4985-bb81-65d769fbe537
4
@Override public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { Term x = args[0]; Term y = args[1]; Term newX = args[2]; Term newY = args[3]; Term direction = args[4]; double vx = ((NumberTerm)x).solve(); double vy = ((NumberTerm)y).solve(); double vNewX = ((Nu...
6c14127a-8635-472e-be3a-1268c068c2f6
5
boolean promoteLifeLocals(LocalInfo[] newLife, InstrInfo nextInfo) { if (nextInfo.lifeLocals == null) { nextInfo.lifeLocals = (LocalInfo[]) newLife.clone(); return true; } boolean changed = false; for (int i = 0; i < maxlocals; i++) { LocalInfo local = nextInfo.lifeLocals[i]; if (local == null) ...
7c059fa6-cdc5-47e4-af43-92c8b383a566
9
private void performStatusChange(final FTPDownloadThread source, final FTPDownloadThread.State state) { final boolean finished = (state == FTPDownloadThread.State.Finished); boolean merge = false; //ignore these states, because they are set from this class if (state != FTPDownloadThread...
79de43fa-0837-46f0-a237-1bc15a16b2a8
1
public static void main(String[] args) { int sum=0; double average; int lowerbound = 1; int upperbound = 100; for (int number = lowerbound; number <= upperbound; ++number){ sum += number; } //System.out.println(sum); float avg = sum/100; ...
71c3b065-d7e3-43b9-b441-d62b96be2ae6
4
public boolean search(String word) { boolean res = true; char[] arr = word.toCharArray(); TrieNode next = this.root; for (int i=0;i<arr.length;i++){ TrieNode child = next.getChild(arr[i]); if( child!=null){ next = child; }else{ res = false; break; } } if( res && !next.isWord) res ...
1e117f81-39aa-4ac7-bc7f-f27c0b206179
7
public int compareTo(Object o) { int row1 = modelIndex; int row2 = ((Row) o).modelIndex; for (Iterator it = sortingColumns.iterator(); it.hasNext(); ) { Directive directive = (Directive) it.next(); int column = directive.column; Object...
215113e5-2ce0-4445-bf02-6fef5afd484d
3
public void drawLine(List<mxPoint> pts, Map<String, Object> style) { String strokeColor = mxUtils.getString(style, mxConstants.STYLE_STROKECOLOR); int strokeWidth = (int) (mxUtils.getInt(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale); if (strokeColor != null && strokeWidth > 0) { mxPoint last =...
33f536b9-0844-41be-a6da-7e1135e0d364
5
public static ArrayList<Vin> readListeVins(String fileName) { ArrayList<Vin> vins = new ArrayList<Vin>(); BufferedReader br; try { br = new BufferedReader(new FileReader(fileName)); String line = br.readLine(); // We ignore the first line (only the attribute names) line = br.readLine(); while (l...
ca204e42-c599-458f-a8ff-36ee2c364c09
9
public Data waitForReply(int requestIndex) throws RequestException { if(_subscribeReceiver) { Data reply = null; synchronized(_replyList) { long waitTime = CommunicationConstant.MAX_WAITING_TIME_FOR_SYNC_RESPONCE; try { while(reply == null) { if(_closed) throw new RequestException("Verbindung...
3e947df6-c487-4d59-910c-12a09ac259c6
3
public static void asm_incfsz(Integer akt_Befehl, Prozessor cpu) { Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6); // zum speichern Integer result = cpu.getSpeicherzellenWert(f) + 1; // Speicherort abfragen if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) { // in f Register speichern cpu.setSpeicherzell...
0b4aee8c-eabd-4fd2-89fe-920b56afb13c
8
public void run() { while(true) { try { checkResults(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if(requests.size() > 0) { try { doRequ...
060affd2-58ec-49dc-a723-34e1065574a5
4
private void drawTabArea() { aGraphicsBuffer_1163.initDrawingArea(); Rasterizer.lineOffsets = anIntArray1181; invBack.drawIndexedSprite(0, 0); if (invOverlayInterfaceID != -1) { drawInterface(0, 0, Interface.cachedInterfaces[invOverlayInterfaceID], 0); } else if (tabI...
d6a3bc6e-5505-4095-800e-3ecd7129f8c3
3
public void convert(String fName) throws IOException{ TextFile in = new TextFile(fName, false); TextFile out = new TextFile(fName.replace(".txt", ".bed"), true); GeneNameConverter converter = new GeneNameConverter(); converter.makeIdToHUGOmap(); String[] spl; String hugo;...
12a35177-c0b7-4d90-b5b3-c12a3d1aa5cc
0
@Test public void getGetWords_whenWordsHaveDuplicatedCharacters() { trie.add("aaa"); trie.add("a"); assertTrue(trie.contains("a")); assertTrue(trie.contains("aaa")); assertFalse(trie.contains("aa")); }
41a353ce-3679-48ff-bbc0-b98aea4bb0ae
8
public Map<String, F1Measure> evaluateExamples(ExampleInput[] inputs, ExampleOutput[] corrects, ExampleOutput[] predicteds) { // Temporary sets to store the correct and predicted entities within // each example. HashSet<TypedEntity> correctEntities = new HashSet<TypedEntity>(); HashSet<TypedEntity> predicte...
f2edb139-c184-43d3-bdc0-e15eab2f5b76
3
public String getHealthText() { double health = getHealth(); if (health > 0.75) { return "excellently"; } else if (health > 0.50) { return "well"; } else if (health > 0.25) { return "decently"; } else { return "poorly"; } ...
ac9b8b1c-dc67-4e02-9d13-7f877b9d7384
6
public final void shade(int intensity, int fallOffset, int x_lightness, int y_lightness, int z_lightness) { for (int i = 0; i < triangleCount; i++) { int k1 = facePointA[i]; int i2 = facePointB[i]; int j2 = facePointC[i]; if (faceTypes == null) { int i3 = triangleColors[i]; VertexNormal vertexNorm...
13f8ee65-7521-420d-a2a2-184d7d1ad6ee
6
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; ChunkyPlayer chunkyPlayer = ChunkyManager.getChunkyPl...
ffa41cc4-bd86-482a-a850-b4d456df9867
7
private TestSuite createTestSuite(String tsfilePath, String tssheetName,List<String> tscolNames, String tsqWhereClause) { TestSuite testSuite = new TestSuite(); Connection conn1 = null; Statement stmnt = null; try { //Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ); conn1 = DriverManager.getConne...
3f3678eb-f315-42a1-813f-e6df71bc4df7
4
public synchronized String readLine(PipedInputStream in) throws IOException { String input=""; do { int available=in.available(); if (available==0) break; byte b[]=new byte[available]; ...
2d4a1f49-60a3-4e6f-b2cd-af84eb379a03
6
int possibleMovesNum(Point[] grid, Pair pr) { int possible = 0; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { Point currentPoint = pointAtGridIndex(grid, i, j); if (currentPoint.value == 0) { continue; } for (Pair d : directionsForPair(pr)) { if (isValidBoardIndex(i ...
a91d1122-e02e-4586-bb9e-505a40f759f3
5
public Divider(Poly num, Poly den) { double tp = den.p[0]; if (Math.abs(tp) < epsilon) throw new RuntimeException("Divide Poly by Zero!"); if (den.p.length > num.p.length) { quo = new Poly(); rem = den; } else { double[] quo = new double[num.p.length - den.p.length + 1]; Poly tmp = num; ...
f787c2d2-bf2a-4bdf-a017-2388fe68d464
2
public Slide showPreviousSlide() { if(slidePanel.currentSlide.getSlideID() > 0){ nextSlideButton.setBorderPainted(true); if (slidePanel.currentSlide.getSlideID() ==1){ previousSlideButton.setBorderPainted(false); } int previousSlideID = slidePanel.currentSlide.getSlideID() - 1; Slide previousSl...
1768b6ab-fa09-4eed-82cc-9b165c47ff47
5
public int linkIndexForNode(int id){ // check for existence of lookup if(TM != null) { return (Integer)TM.get(id); } if(link == null) { return -1; } Link L = link; if(L.node.id == id) { return 0...
38d65f1b-6a96-498a-aafc-e77dd1040613
3
@EventHandler public void onSignChange(SignChangeEvent event) { World world = event.getBlock().getWorld(); int x = event.getBlock().getX(); int y = event.getBlock().getY(); int z = event.getBlock().getZ(); String string = stringBuilder.BuildString(world, x, y, z) + "_exists";...
ff2348a8-6a3d-4d9c-846a-bf96dd376ea8
0
public int hashCode() { return this.code.hashCode(); }
4735685d-5902-4eba-a135-7f1d9fdb4a49
2
public void back() throws JSONException { if (usePrevious || index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.index -= 1; this.character -= 1; this.usePrevious = true; this.eof = false; }
d25e5a0a-82aa-4bd1-be56-effc5bad2bfb
3
public String toString(){ DecimalFormat pay = new DecimalFormat("$#,##0.00"); String str = super.toString(); str += "\nShift"; if(shift == DAY_SHIFT) str += "Day"; else if(shift == NIGHT_SHIFT) str += "Night"; else ...
4a7096f9-eecb-4a03-b51f-d09f6bd3637e
8
public int toGPIONumber() { int n = 0; switch (this) { case GPIO_0: n = 0; break; case GPIO_1: n = 1; break; case GPIO_2: n = 2; break; case GPIO_3: n = 3; break; case GPIO_4: n = 4; break; case GPIO_5: n = 5; break; case GPIO_6: n = 6;...
680547d9-c455-40f7-816f-47ec51f4a9ae
3
public static void SelectionSort (int[]v){ for (int indexItem=0; indexItem<v.length - 1; indexItem++){ int IndexMin= indexItem; for(int index=1; index<v.length;index++){ if( v[index]< v[IndexMin]) IndexMin= index; int aux=v[IndexMin]; v[indexItem]=v[IndexMin]; v[IndexMin]=aux; } } ...
98fd5a0d-6596-4a66-a942-7ef5fd330b54
4
public void startSimulation() { int counter = 0; while (!allRatsOnTarget() && counter < maxSimulationStep) { for (MazeRat rat : rats) { rat.performStep(); } counter++; } if (allRatsOnTarget()) { System.out.println("Rats finished! It took " + counter + " steps"); } else { System.out.printl...
739e3d32-6f93-4f7f-97ba-d57e67615cfb
1
@BeforeClass public static void setUpClass() throws Exception { try { cyc = new CycAccess(); } catch (Exception e) { cyc = CycAccess.getNewCycAccessInteractively(); } System.out.println("Connected to " + cyc); }
fec563c6-c8ba-4195-8c9c-5747fb561177
0
public void setImie(String imie) { this.imie = imie; }
3a9eec94-b217-4f31-8c66-097fa4b67938
2
static void checkException(Exception e, String errmsg) { if (errmsg != null) { if (!e.getMessage().equals(errmsg)) { System.out.println("Expecting exception '" + errmsg + "' but got '" + e.getMessage() + "'"); e.printStackTrace(); (new Throwable()).printStackTrace(); ...
34e8763f-cfee-4f9d-91e3-319b0ba2a074
4
public SwitchGate getCellSwitch(int x, int y) { for (int i = 0; i < switchGates.length; i++) { if (switchGates[i] == null) continue; for (int j = 0; j < switchGates[i].getSwitchSize(); j++) { if (switchGates[i].getNearSwitch(x, y)) { return switchGates[i]; } } } return null; }
01bfd4a9-9fdd-4618-b7d6-a4b84fb2fac2
4
public void drawGrav(Graphics g){ for (int i = 0; i < Main.SIZE; i+=10){ for (int j = 0; j < Main.SIZE; j+=10){ Pair force = new Pair(0,0); for (int q = 0; q < arr.size(); q++) { Pair temp = new Pair(i, j).getDifference(arr.get(q).position); ...
e64e2da4-8961-4a4b-bceb-f3d214cbfd97
2
@Override public boolean remapInstrument(Instrument from, Instrument to) { boolean didItWork = true; for (Synthesizer s : theSynths) if (!s.remapInstrument(from, to)) didItWork = false; return didItWork; }
f90bf6be-741a-4cb0-88a9-4a8d77eaf38d
3
public void save() { Database database = new Database(familyService.getStudents(), familyService.getHousehold(), activityService.getActivities(), bookingService.getBookings(), bookingService.getDiningHall()); // AQUI GUARDO LOS OBJETOS (usarlo cuando cierras la iu) try { FileOutputStream fs = new File...
0260813e-3ac9-4577-b9d4-7e18e6d7266f
3
private String accessString() { String retVal = ""; if ((accessFlags & 0x0001) > 0) retVal += "public "; if ((accessFlags & 0x0010) > 0) retVal += "final "; if ((accessFlags & 0x0400) > 0) retVal += "abstract "; return retVal; }
b30e4aa0-d820-4b07-81eb-2621872e9c85
3
public static void main(String[] args) { Log.print(Log.system, "Hello, GraphSolver!"); Log.print(Log.system, "Graph's presents: " + Arrays.toString(States.values())); Graph graph = null; try { graph = GraphParser.parseGraph(new File("bipartite.txt")); } catch (FileNotFoundException e) { Log.print(Log.e...
e9f5bb5a-bbeb-4d23-a419-9898b4b96780
1
@Override public void draw(Graphics g) { // If the alien is alive, draw the ship if (Alive) { g.drawImage(img1, pos_x, pos_y, width, height, null); } // Otherwise draw an explosion else { g.drawImage(img2, pos_x, pos_y, width, height, null); } }
62a418ae-9c97-49ef-8e86-86899ad55960
6
public void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth(); int height = getHeight(); g.setColor(Color.white); g.drawRect(0, 0, width, height); ArrayList<Integer> areas = getAreas(BackgroundColor.RED); g.setColor(m_red); for (int i = 0; i < areas.size(); i += 2) { int s...
57133618-7c71-474c-a605-320365e45562
2
public void ajoutTroisTuileBonus(Set<Province> hprovince, LinkedList<TuileBonus> lltb){ for(Province p : hprovince){ LinkedList<TuileBonus> llp = new LinkedList<TuileBonus>(); int i = 0; while(i < 3){ llp.add(lltb.getLast()); ...
50f029b5-31c8-4e82-95b0-cdfc7bbd3ca3
4
private void parseValue(String line, int lineNum) { // skip a comment line if (line.startsWith(COMMENT)) { return; } String[] sp = line.split("\\s+"); // split the fields based on a space int i; // a counter int len = 0; // length of ...
0926908a-2061-4b51-9beb-9c7fb1454037
4
public static String getMD5StringWithSalt(String password, String salt) { if (password == null) { throw new IllegalArgumentException("password不能为null"); } if (StringUtil.isEmpty(salt)) { throw new IllegalArgumentException("salt不能为空"); } if ((salt.toString().lastIndexOf("{") != -1) || (salt.toString(...
64ca6151-090c-4133-84d6-18a31ac9fe33
1
private void PrevBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PrevBtnActionPerformed setResponse(); if(qIndex > 0) { ShowQuestion( quiz.questionList.get(qIndex -1)); qIndex--; } }//GEN-LAST:event_PrevBtnActionPerformed
bf8914e4-ef13-472b-9e0f-771642b076ec
8
public static String selectCols(String fileName,HashSet<Integer> colIndexs,ArrayList<int[]> mergeCols) throws IOException{ String outf = fileName.substring(0, fileName.indexOf(".")) + "_selectCols.txt"; BufferedReader br = new BufferedReader(new FileReader(fileName)); BufferedWriter bw = new BufferedWriter(new...
1e369336-36ed-4096-a9be-8a08cd0dd9e2
6
private boolean add2(int num) { ArrayList<int[]> zeros = new ArrayList<int[]>(); for (int c = 0; c < col; c++) { for (int r = 0; r < row; r++) { if (board[c][r] == 0) { int[] temp = { c, r }; zeros.add(temp); ...
c9ad70f3-dcf8-4a43-a51a-3b5fb8134a86
3
public double getTotalOverlaps() { if(cachedTotalOverlap != null){ return cachedTotalOverlap; } GeometryFactory factory = Helper.getGeometryFactory(); double totalOverlap = 0; for (LabelGene gene : this) { double overlapArea = getGeneOverlap(gene, factory); if (overlapArea > 0) { totalOverlap = t...
5589f4be-7359-4c1d-84cb-af5c67d985dc
6
protected static void calebAndMatthewClaws(){ for (Person person : people.values()){ if (person.sch.openings.size() > 5){ if (person.name.contains(MF) && person.name.contains(ML)){ person.sch.restrictTime(0); } else if (person.name.contains(CF) && ...
6952ceba-b37e-434f-9a70-6404b55e5413
3
final void printValue(final JTextField textField) { if (this.content.isEmpty()) { textField.setText(getTooltip()); textField.setForeground(Color.GRAY); } else { textField.setForeground(Color.BLACK); if (this.show) { textField.setText(this.content.toString()); } else { this.sb.clear(); fin...
8534d4f3-6d3c-4516-876c-03d8c2a865c9
7
private void initialize() { agenda = new LinkedList<Edge>(); chart = new Chart(); edges = new HashMap<Edge,Edge>(); for (int wordI = 0; wordI < sentence.size(); wordI++) { String word = (String) sentence.get(wordI); List<String> tagList = lexicon.getTags(word); if (tagList == null || t...
de99a158-1456-4cc0-a792-9860ae2fcea8
6
private synchronized void startTransaction(boolean haveReadLock) throws IOException { boolean success = false; try { if (infoStream != null) message("now start transaction"); assert docWriter.getNumBufferedDeleteTerms() == 0 : "calling startTransaction with buffered delete terms not ...
e21ffdb5-017b-492c-9bb0-3ee50ce08c7b
9
private void setAddedPartProperties(Part addedPart) { if (Float.isNaN(previousProperties.temperature)) previousProperties.temperature = model.getBackgroundTemperature() + 20; addedPart.setTemperature(previousProperties.temperature); if (!Float.isNaN(previousProperties.thermalConductivity)) addedPart.setTher...
f448de12-3fa7-4f58-bc91-aab705515bf8
7
public void replace(int i, int num) { try{ if (num < 0) { throw new NegIntegerException("Number is negative"); } }catch(NegIntegerException e){ System.out.println("Error: Negative number!"); } try{ if (i >= index && i < 10) throw new NullPointerException(); }catch(NullPointerException e){ ...
a595a5fa-47a8-47dd-96b7-f61fe9ac6b54
9
public String getIndexAddString(String table, IDbManager manager) { List<Map> showDescribe = compareDb.showDescribe(table, manager); StringBuilder sql = new StringBuilder(); if (ObjectHelper.isNotEmpty(showDescribe)) { for (Map describe : showDescribe) { String column...
23f9592d-b031-4a64-883f-889349f4bd42
9
public boolean blockingQueen(Piece piece, int destX, int destY){ //SAME AS TEST FOR KING, and bishop if(!piece.validMove(destX, destY)){ return true; } //need to have this part first, b/c the other ifs might pass if it wants to do an angle move. if(destX != piece.getX() && destY != piece.getY()){ //l...
7f9b493e-e47e-4943-9116-89e32cdd1028
1
private Card[][] getRandomTableCards(ArrayList<Card> cardStack) { Card card; int randomArraylistPosition; Card[][] displayCards = new Card[A1Constants.NUMBER_OF_ROWS][A1Constants.NUMBER_OF_COLS]; for(int j = 0; j < NUMBER_OF_COLS; j++){ randomArraylistPosition = (int) (...
516a958d-124e-4fa9-bff6-16aaa701eeb8
5
public void mouseReleased(MouseEvent e) { int relY = e.getY() + getLocation().y; int dy = undoY - relY; //SANJANA /* if (dragMode == EAST_ROLLUP_STRETCH_DRAG) { chart.last_int.setUndoSlide(BaseTableContainer.this, dy, relY, true); }*/ ...
6656d32c-5b67-475b-9d72-f157ee7eabe4
2
public void reload() { voteKits = new File(getDataFolder().getAbsolutePath()+ "/kits.yml"); configFile = new File(getDataFolder().getAbsolutePath()+ "/config.yml"); if(!configFile.exists()) { firstRun(); } YamlConfiguration pluginYML = YamlConfiguration.loadConfiguration(this.getResource("plugin.yml"))...
b755ea19-b36d-44a5-84e3-5ee2b37e3048
8
private void handleAction() { if(actionButton.getText().equals("Find IP")){ Integer ip = dnsDB.findIP(nameText.getText()); if(ip == null){ JOptionPane.showMessageDialog(GUI.this, "Could not find an IP address with host name: " + nameText.getText()); } else{ ipText.setText(DNSDB.IPToString(ip)); ...
793da172-d299-48ab-810a-0f9537904e05
2
public void testFactory_parseSeconds_String() { assertEquals(0, Seconds.parseSeconds((String) null).getSeconds()); assertEquals(0, Seconds.parseSeconds("PT0S").getSeconds()); assertEquals(1, Seconds.parseSeconds("PT1S").getSeconds()); assertEquals(-3, Seconds.parseSeconds("PT-3S").getSec...
90a0ebbc-78b0-4c3f-877f-602a01bdf9dc
5
public boolean ExisteElEvento(int idCliente, int idMesaDulces, String fecha, int idEmpleado) throws SQLException { boolean existe = false; LinkedList<EventosSociales> listaDeEventos = dao.obtenerTodosLosEventos(); //EventosSociales eventoAverificar = new EventosSociales(idCliente, idMesaDulces, ...
cda5c9a8-2887-42b4-b896-77c47aa3ee6b
1
public float getMaxGain() { GameSong gs = getCurrentSong(); if(gs != null) { maxGain = gs.getMaxGain(); } return maxGain; }
0805ee46-89e3-426d-a666-cffebfac2a5e
8
public String reverse(String str) { char charsOfStr[] = str.toCharArray(); Stack<Character> stack = new Stack<>(); // first iteration to populate stack for(char ch : charsOfStr) { if(ch >='0' && ch<='9') { if(ch % 3 == 0) { stack.push(ch)...
21090143-cb50-4096-bbfc-2e0a7bd10137
5
@Override public void onInvalidCommand(CommandSender sender, String[] args, String command) { tickets = plugin.getTicketHandler(); if (sender instanceof Player) { if (sender.hasPermission("modreq.check")) { if (args.length == 1) { int id; ...
172a22a7-9f4c-44b7-ae3d-8d786065b743
1
public void setImage(int id, boolean faceUp) { if (faceUp) { setIcon(new ImageIcon(getClass().getResource( "resources/" + id + ".png"))); } else { setIcon(new ImageIcon(getClass().getResource("resources/52.png"))); } revalidate(); repaint(); }
ead4f185-55b8-48d1-88b6-5eded42914aa
8
public void breadthFirst(Queue traversal) /* Pre-condition: the given game tree (which may be empty) holds the current state of maze solution, the given queue (which may also be empty) holds all game tree nodes which await expansion (i.e. branches/forks within the maze) Post-conditi...
bdd738ac-c2ff-4702-80b0-a626881cced6
3
@Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { if(args.length > 0) return false; Set<String> s = ChannelsConfig.getChannels().getConfigurationSection("channels").getKeys(false); sender.sendMessage(ChatColor.DARK_PURPLE + "------------------------------...
59ec9900-8c93-40bf-b4dc-8c593c6f9af2
7
public void addPlayers(Player player, final String arenaName) { player.sendMessage(arenaName); if (getArena(arenaName) != null) { //If the arena exsists Arena arena = getArena(arenaName); //Create an arena for using in this method if (!arena.isFul...
7cc56644-a145-45c7-bb7e-40233ce94588
7
protected String readCommandResponse(BufferedReader in) { boolean internalBuffer = false; String response = ""; String output; // Checking the param if (in == null) { try { in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()...
ef4b1d2c-fa94-49e0-aa53-63612d5713bc
9
public void update() { //TODO update UI if (getTimer().getDay() != day) { day = getTimer().getDay(); } if (getTimer().getDay()) { if (getTimer().getHour() != hour) { hour = getTimer().getHour(); if (hour == 0) { // new day days++; for (Settlement s : settlements) { s.levelU...
80b43935-d81f-4b20-8226-10b138d68fb3
5
public DataInputStream getChunkInputStream(int x, int z) { try { byte[] data; int read; int offset; int length; synchronized (file) { file.seek((7 * (x + (z * 32))) + 5); offset = file.readInt(); length ...
b9b41332-758f-493f-a0d6-6e73f38fd15e
1
protected void processValueChangeEvent(ValueChangeEvent e) { if(valueChangeListener != null) { valueChangeListener.valueChanged(e); } }
3b5f6713-f8d5-4d82-a731-419d5b8aa7fa
1
public static void main(String[] args) { factory = Persistence.createEntityManagerFactory(PERSISTANCE_UNIT_NAME); EntityManager manager = factory.createEntityManager(); EntityTransaction transaction =manager.getTransaction(); TypedQuery<Object> query = manager.createQuery("SELECT COUNT(c) FROM Audienc...
4acb2b1e-cea9-449d-8bbc-e58e00e797b0
9
public void newParallelJob(Object o) { if(o.getClass().isAnnotationPresent(Job.class)) { Job job = o.getClass().getAnnotation(Job.class); JobInfo info = new JobInfo(); if(job.jobType() != JobType.PARALLEL) return; info.isProgress = job.progress(); info.jobType = job.jobType(); info.name = job.na...
8de78312-9b10-44ba-bc4e-85984cdea0d9
4
public static void main(String[] args) { Provider provider = ProviderService.getProvider(); //Print all the available addresses of the system. try { Address[] addresses = provider.getAddresses(); System.out.println("Avaialable Addresses : "); for (int i = 0; i < addresses.length; i+...
09a3fe91-2170-440c-b557-51676d5b683f
0
public void setPerfilidPerfil(Perfil perfilidPerfil) { this.perfilidPerfil = perfilidPerfil; }
151ebfbc-e8b5-458f-94ac-68bde6e42432
6
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { generarTabla(); //cargo Parametros del Reporte Map parametros = new HashMap(); parametros.put("name_empresa", r_con.getRazon_social())...
567af5cb-5c52-47b4-a288-fe3f584fefb7
5
private void oilAccumBuffer(CPRect srcRect, CPRect dstRect, int[] buffer, int w, int alpha) { CPLayer layerToSample = sampleAllLayers ? fusion : getActiveLayer(); int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dst...
7b938855-dec4-460b-8cac-2f8090b65f5b
0
public void setDistance(int distance) { this.distance = distance; }
369da06f-1a14-40e2-94d6-4d8b33ab5265
3
void attackPlaceDiagonallyBelowLeft(int position, char[] boardElements, int dimension, int attackPlacesOnTheLeft) { int positionLeftBelow = 1; while (attackPlacesOnTheLeft > 0) { if (isPossibleToPlaceDiagLeftBelow(boardElements.length, position, dimension, positionLeftBelow) ...
7a9d5faf-9cfd-4c59-8b95-b481e40044cb
3
@SuppressWarnings("boxing") public static String valueOf(String str) { String ret = str; if (str.startsWith("\\u")) { ret = ((Character)((char)Short.parseShort(String.format("0x%s", str.substring(2))))).toString(); } else { for (int c = 0; c < S_ESCAPES.length; c++) { if (S_ESCAPES[c]....
921df962-4b34-4ce3-b04b-92090c3a5135
0
public void setCantPerson(int cantPerson) { CantPerson = cantPerson; }
f45559f1-a852-4b6b-9a01-155cac95910f
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
7bd72a9c-4c01-4671-8d68-bdcc8443ef99
0
public FSAStepByStateSimulator(Automaton automaton) { super(automaton); }