method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e64bb90f-d207-4189-b031-d18e346ab079
2
public void encodeRegisterBinary(String reg,int pos, int[] encode) { String regNum = Integer.toBinaryString(Integer.parseInt(reg.split("r")[1]))+""; int j=3; while(regNum.length()<4) { regNum = 0+regNum; } System.out.println(regNum); for(i...
9c065633-70f7-4c8c-81b6-90922805b91d
5
protected boolean setPlayer1Score(int score) { boolean test = false; if (test || m_test) { System.out.println("Game :: setPlayer1Score() BEGIN"); } if (score < 0) { throw new IllegalArgumentException( "Game::AddPlayer1Score - Invalid integer(" + score + ") to a...
a3849930-3c45-4d5e-9d88-81fe9f8e4f89
7
public void createTable(){ //table list of participants registered from the workshops - from WKSHP_REGISTRATIONS int numParticipants = 0; ArrayList<String>registrations = ReadFromFile.getRegistrationList(); columnNames = new String[4]; columnNames[0] = "Type"; columnNames[1] = "First"; columnNames[2] ...
d6eda87f-5f4d-4b5f-8a32-e29c3d5ffd42
7
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(stage == INIT_STAGE) { System.out.println("Init Stage click " + clickCount); setInitButtonImage(); clickCount++; stage = FIRST_STAGE; } else if(stage == FIRST_STAGE) { System.out.println("first St...
d004e956-342e-4196-bf10-b7fb6f63b8cb
3
public void resetTurn() { for(Player p : playerList.getList()) { List<AbstractMatter> units = p.getUnitList().getAbstractMatterList(); List<AbstractMatter> cities = p.getCityList().getAbstractMatterList(); for(int i = 0; i < units.size(); i++) { ...
8b7e6307-1bb5-4bf8-afc0-fc5238c59712
7
protected static String normalizeUrl(String url) throws URISyntaxException { URI uri = new URI(url); String scheme = uri.getScheme().toLowerCase(); String authority = uri.getAuthority().toLowerCase(); boolean dropPort = (scheme.equals("http") && uri.getPort() == 80) ...
6dd43ffd-1e4a-49ac-bb08-45b2d7fd1182
0
@Override public ConnectionInfo getCurrentConnectionInfo() { return (ConnectionInfo)localConnectionInfo.get(); }
f9596777-ea61-4e5a-a910-71754c7a648a
0
public void openMainPage() { driver.get(baseUrl + "/addressbookv4.1.4/index.php"); }
8995de12-45d5-46b8-bd5b-f641fbf5de46
8
private void drawMenu() { int offsetX = menuOffsetX; int offsetY = menuOffsetY; int width = menuWidth; int height = menuHeight; int colour = 0x5d5447; DrawingArea .drawFilledRectangle(offsetX, offsetY, width, height, colour); DrawingArea.drawFilledRectangle(offsetX + 1, offsetY + 1, width - 2, 16,...
558e2c0e-b198-47e0-a623-feb90c90ed85
1
void removePiece(int p, int row, int col) { // удаляем паззл p, с позиции (row, col) board.setColor(row,col,null); for (int i = 1; i < 9; i += 2) { board.setColor(row + pieces[p][i], col + pieces[p][i+1], null); } }
c7731114-91d4-4836-94c2-f76e2b1617e4
3
protected void fireClientDisconnectEvent(DisconnectOnServerEvent evt) { if (clientDisconnectListenerList != null) { Object[] listeners = clientDisconnectListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (listeners[i]==DisconnectOnServerListener.class) { ((Dis...
5270c6b5-c45d-4172-9b39-5eebdda53ea6
6
static private void doLookup(SoftTFIDFDictionary dict,double d,String s,boolean compare,double[] stats) { System.out.println("lookup: "+s); long start1 = System.currentTimeMillis(); int n1 = dict.lookup(d,s); double elapsedSec1 = (System.currentTimeMillis()-start1) / 1000.0; ...
6e745154-b512-4423-ba52-252bf3b24751
2
public CtClass getAndRename(String orgName, String newName) throws NotFoundException { CtClass clazz = get0(orgName, false); if (clazz == null) throw new NotFoundException(orgName); if (clazz instanceof CtClassType) ((CtClassType)clazz).setClassPool(this); ...
45564aa4-3412-4cab-a007-ae23e79a0bf4
9
private ActionListener initEditListener() { // the actionlistener for the Edit menu ActionListener editListener = new ActionListener() { public void actionPerformed(ActionEvent event) { String clicked = event.getActionCommand(); if (clicked.equalsIgnoreCase("Undo")) { if (m_undoManager.ca...
ed8cc5f9-702f-4ac7-93db-5d6f9d051547
8
public Markers queryDeep(Marker marker) { if (Config.get().isErrorOnMissingChromo() && isChromosomeMissing(marker)) throw new RuntimeEOFException("Chromosome missing for marker: " + marker); boolean hitChromo = false; Markers hits = new Markers(); Markers intersects = query(marker); if (intersects.size() > ...
7aa41172-3463-4485-b649-d82282592ef3
5
private static int runmisc(String[] args) { String path = null; for (int i = 1; i < args.length; i++) { String arg = args[i]; if (path == null && arg.startsWith("-")) { usage(); } else if (path == null) { path = arg; } else { usage(); } } if (path ==...
e1dc3aef-7ee6-4d99-b137-338eb19026e1
4
public void renderTo(Rendering rendering) { if (showing.size() == 0) return ; final Vec3D flatPoint = new Vec3D(position) ; rendering.port.isoToScreen(flatPoint) ; float fontScale = LINE_HIGH / FONT.map[' '].height ; GL11.glDepthMask(false) ; rendering.port.setScreenMode() ; BUBBLE...
8af342f6-d1f6-41d8-8da3-ac35c7593a4b
6
@Override public boolean accept(File f) { String name = f.getName(); if( name.endsWith(".jpg") || name.endsWith(".png") || name.endsWith(".pdf") || name.endsWith(".jpeg")|| name.endsWith(".png") || f.isDirectory() ...
aaaa74da-8754-469c-aa21-8398b2034de1
3
public void updateViewFlags() { if( (memory[STATUS_ADDRESS] & (1<< 0)) == 0) zeroFlag = false; else zeroFlag = true; if( (memory[STATUS_ADDRESS] & (1<< 1)) == 0) negativeFlag = false; else negativeFlag = true; if( (memory[STATUS_ADDRESS]& (1<< 2)) == 0){ carryFlag = false; } else carryFlag = t...
5a5e0524-6285-4d1f-a507-dba713b92851
1
public static void massHordes (Scanner console, HashSet<Horde> entities) throws FileNotFoundException { System.out.println("You have chosen to load a group of enemy types into the program. \n Enter the filename to load from: "); //Create a new Scanner to read the chosen file. String fileName = "src/" + console...
f2fc1d21-3e45-4971-a347-0df066c74dc2
4
@Override public String buscarDocumentoPorEstado(String estado) { ArrayList<Venta> geResult= new ArrayList<Venta>(); ArrayList<Venta> dbVentas = tablaVentas(); String result; try{ for (int i = 0; i < dbVentas.size() ; i++){ if(dbVentas.get(i).getEstado()....
70cf8ab4-6c5c-4882-8688-e8ceeeaed8bc
9
public static void YM_DELTAT_ADPCM_CALC(YM_DELTAT DELTAT) { /*UINT32*/int step; int data; int old_m; int now_leveling; int delta_next; DELTAT.now_step += DELTAT.step; if ( DELTAT.now_step >= (1<<YM_DELTAT_SHIFT) ) { step = (int)(DELTAT.now_step >> YM_DELTAT_SHIFT); DELTAT.now_step &= (1<<YM_DELTAT_SHIFT)-1...
26b1b616-0ab8-433f-9dca-f6c090571703
1
public SkinPropertiesVO(Path skinImageDir, SkinPreviewVO preview) { assert (this.imageDir != null) && (preview != null); this.imageDir = skinImageDir; this.skinPreview = preview; this.somethingChanged = false; }
a7e7bda0-a4f1-474f-85a1-7b98f989f600
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 DesignationCategory)) { return false; } DesignationCategory other = (DesignationCategory) object; if ((this.id ...
4f9f00e2-8e75-4977-9415-a57497125ae9
1
private String getPrefix(String fnm) { int pos; if ((pos = fnm.lastIndexOf(".")) == -1) { EIError.debugMsg("No prefix found for filename: ", EIError.ErrorLevel.Error); return fnm; } else { return fnm.substring(0, pos); } }
fc63f2df-ca25-4a9c-87a9-2a27b3124986
5
private static Collection<String> getResourcesFromJarFile(final File file, final Pattern pattern) { final ArrayList<String> retval = new ArrayList<String>(); ZipFile zf; try { zf = new ZipFile(file); } catch (final ZipException e) { throw new Error(e); } catch (final IOException e) { throw new Error(...
5c962b3c-c642-4a75-94ae-ca15a3425b38
7
public CadastrarConsultaUI(Consulta consulta) { initComponents(); comboBoxProcedimento(); this.zerarModeloMedico(); try { this.listaMedico = MedicoController.obterInstancia().listarMedico(); } catch (Exception ex) { Logger.getLogger(CadastrarConsu...
c9ee9d25-7686-4c52-a96a-cccb73d5787e
0
@Test public void test_letter(){ assertNotNull(pawn); assertEquals(letter, pawn.getLetter()); }
6f60c4d0-0716-4049-8bbc-e45b93f5d465
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Attribute<?> other = (Attribute<?>) obj; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } return this.type...
96b193b1-5471-4cd0-8f50-bb161fbeef0e
9
public Object getValueAt(int rowIndex, int columnIndex) { Assignment as = assignments.get(rowIndex); switch(columnIndex){ case 0: return as.getName(); case 1: return as.getType(); case 2: return as.getGradedPoints(); case 3: return as.getTotalPoints(); case 4: return as.getDescription();...
1e0c20e9-5d19-454e-bd3e-43832119de9b
2
@SuppressWarnings("unused") private void checkMail(String mail) throws Exception { if(mail != null && !mail.matches("([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)")) { throw new Exception("Adresse mail non valide."); } }
88f2b776-b33c-40c9-bd25-847d55e8f897
8
public static <T extends DC> Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> getAllPairs(Set<Pair<T,PT<Integer>>> baseSetA,Set<Pair<T,PT<Integer>>> baseSetB) { Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> res; if(baseSetA==null||baseSetB==null) { return null; } else//baseSetA!=null&&baseSetB!...
572fb262-e5fb-4eef-8ad2-e516dbf8286d
1
public void addTray(Tray tray) { if (!this.trays.contains(tray)) { this.trays.add(tray); tray.setProductType(this); } }
17d1970e-7f78-45d4-89d5-7e4cc3c237f9
4
@Override public int read() throws IOException { if (!closed && readChars.isEmpty()) synchronized (mutex) { try { mutex.wait(); } catch (InterruptedException e) { throw new IOException(e); } } if (closed) return -1; return readChars.pollFirst(); }
aa3c0558-4a06-4c4c-b796-feab650ffda8
3
public void dfs(){ int depth; for(int i=0; i<graphNodes.size(); i++){ if((graphNodes.get(i).getColour()==0)&&(graphNodes.get(i).getChildren()!=null)){ depth = 1; buffer.clear(); dfsVisit(graphNodes.get(i), depth); } } }
e08535ae-6c9f-4388-b245-ebc7f370004d
7
public void paint (Graphics g) { if (fm == null) { fm = g.getFontMetrics (font); titleFm = g.getFontMetrics (titleFont); minSize.width = titleFm.stringWidth (title); minSize.height = 1 + TITLE_ABOVE_SPACE + titleFm.getHeight() + TITLE_BELOW_SPACE; for (int i = 0; i < items.length; i+...
096644f8-6717-4004-95a1-715b87fd642b
9
public static void main(String[] args) throws Exception { // TODO Auto-generated method stub Scanner in = new Scanner(new File("d:\\programDATA\\Rope Intranet\\A-large-practice.in")); System.setOut(new PrintStream(new File("d:\\programDATA\\Rope Intranet\\A-large-practice.out"))); int Numcase = in.nextInt(); ...
e764abed-6de9-4537-9fb6-7186f6a2de49
3
public void setReal(TReal node) { if(this._real_ != null) { this._real_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
cbfafe32-a176-4fdb-afdb-fab034b87a57
2
public Board generateFromStringArray(String[][] input) { AState[][] map = new AState[input.length][input[0].length]; for(int rowNum = 0; rowNum < input.length; rowNum++) { for(int colNum = 0; colNum < input[rowNum].length; colNum++) { boolean block = input[rowNum][colNum].equals("x"); boolean st...
6baf09e5-33a9-4aa1-8a1f-84035663612c
0
public Tpv getTpv() { return tpv; }
f02b18f9-952f-4c10-9311-ed2653b8565e
0
public ObstacleType getObstacleType() { return obstacleType; }
383b3c5b-4350-45d1-a5bf-682fb3736c4d
4
public Vector<Vector<Object>> calendarTable() { try { data.clear(); String[] keys = {"calendar", "active"}; crs = qb.selectFrom(keys, "calendars").all().executeQuery(); while(crs.next()) { Vector<Object> row = new Vector<Object>(); ResultSetMetaData metadata = crs.getMetaData(); int numberO...
0907c91c-c8de-4030-bfda-9ed41f337a46
2
public void sanitise() { //clean method and host this.method = this.method.toUpperCase(); this.host = this.host.toLowerCase(); //find www prefix and port int wwwIndex = this.host.indexOf(RequestHeader.WWW_PREFIX); int portIndex = this.host.indexOf(RequestHeader.PORT_IDENTIFIER); //remove if (wwwI...
8420bbd3-1dbd-428b-8951-4c2bcc8ac368
6
@Override public Iterable<Borrower> findBorrowers(SearchFilter filter) { Statement stmt = null; List<Borrower> borrowers = new LinkedList<Borrower>(); try { stmt = con.createStatement(); String constraints = ""; for (String attributeName : filter.getAttributeNames()) { if (attributeName.equals("Issu...
f216e398-a60e-48b1-889c-7ac1cbc79142
6
public static IKeyPairGenerator getInstance(String name) { if (name == null) { return null; } name = name.trim(); IKeyPairGenerator result = null; if (name.equalsIgnoreCase(Registry.DSA_KPG) || name.equals(Registry.DSS_KPG)) { result = new DSSKeyPairGenerator(); } ...
100e1753-0aeb-47ef-aeb2-278cc00814f3
4
public void transformSuperIfaces() { if ((Main.stripping & Main.STRIP_UNREACH) == 0) return; Collection newIfaces = new LinkedList(); ClassIdentifier ancestor = this; while (true) { addIfaces(newIfaces, ancestor); ClassIdentifier superident = Main.getClassBundle() .getClassIdentifier(ancestor.sup...
43c05099-aee4-4daa-ba33-af0c43815915
8
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof Item) { Room R=CMLib.map().roomLocation(affected); if(R!=null) R.showHappens(CMMsg.MSG_OK_VISUAL,L("The favorable winds die down.")); } if(affected instanceof BoardableShip) { final Area A=((BoardableS...
2887cf14-586a-4612-a7f8-6d2635385952
7
@Override protected int findPrototypeId(String s) { int id; // #generated# Last update: 2007-05-09 08:15:24 EDT L0: { id = 0; String X = null; int c; int s_length = s.length(); if (s_length==11) { c=s.charAt(0); if (c=='c') { X="constructor...
df73a146-befa-4c69-85ff-474c0ac240d8
8
private boolean isSibling(BSTNode<T> root, BSTNode<T> node1, BSTNode<T> node2 ) { // any node being null will return false if(root == null || node1 == null || node2 == null) { return false; } // if root;s left child and right child are both these nodes oor vice versa .. ret...
cf92f8a5-3d53-4573-a068-5155fe869d0e
4
public StackLocalInfo dup(int count, int depth) { ConstValue[] newStack = new ConstValue[stack.length + count]; ConstValue[] newLocals = (ConstValue[]) locals.clone(); if (depth == 0) System.arraycopy(stack, 0, newStack, 0, stack.length); else { int pos = stack.length - count - depth; System.arr...
6e3fa8da-2792-41cf-a732-92ba2f1012d4
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://downl...
94f7bf0a-952b-437b-af4e-e96d5b240313
4
public boolean isEqual(Grid g) { if (this.size != g.size) { return false; } for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length; j++) { if (grid[i][j] != g.grid[i][j]) { return false; } } } return true; }
5e329c7b-661f-4a36-bc49-c2463688a605
1
private void afficherMenu() { if (ctrlConnexion == null) { ctrlConnexion = new CtrlConnexion(vueC, vueA); } VueMenu vueM = new VueMenu(ctrlA); ctrlMenu = new CtrlMenu(vueM, vueA); // Affichage de la vue Menu ctrlMenu.getVue().setVisible(true); }
a36763e4-c06d-4bd1-bb74-8d1fe1ba3ad7
0
public double getWidth() { return _width; }
282cc1c5-9cee-40d3-81d5-795535d99649
0
public String getNote() { return note; }
fbbe8ad9-8494-4e63-bf8c-92e395d356dc
0
public CompanyPerson(Company company, Person person, String workPosition, String area) { super(); this.company = company; this.person = person; WorkPosition = workPosition; Area = area; }
6b12ad89-3bfd-4891-8676-4b4033150336
3
@Override public Vector3d getForceAt(Vector3d position, Matrix3d rotation, Vector3d point) { Vector3d localPoint = getLocalPoint(position, rotation, point); Vector3d worldAxis = new Vector3d(localAxis); rotation.transform(worldAxis); Vector3d axisComponentPoint = new Vector3d(localAxis); axisComponentP...
3717f4df-1920-4f62-97b1-2755c94b48aa
4
public static void merge(int[] array, int p, int q, int r) { int n1 = q - p + 1; int n2 = r - q; int[] al = new int[n1 + 1]; int[] ar = new int[n2 + 1]; for (int i = 0; i < n1; i++) { al[i] = array[p + i]; } for (int j = 0; j < n2; j++) { ar[j] = array[q + j + 1]; } al[n1] = Integer.MAX_VALUE;...
8d4928d6-29a9-4bdf-a897-6f99d27f1415
4
public PanelSearch(final ModelTable modelTable) { this.modelTable = modelTable; GridLayout gridLayout = new GridLayout(2, 5); gridLayout.setHgap(5); gridLayout.setVgap(5); setLayout(gridLayout); JLabel lblFirstName = new JLabel("First Name:"); JLabel lblLastName = new JLabel("Last Name:"); JLabel ...
1d9d58f6-57ba-4969-b582-0af72db7f6a9
4
private void step(int actualSpeed, int x, int y) { if (map[x][y].isWalkable() && buildings[x][y]==null) { //can only walk if no building or walkable int newSpeed = (int) (actualSpeed - map[x][y].getGroundFactor()); //Hotfix by Simi, because I changed groundFactor to double if (newSpeed >= 1) { temp...
69808b3f-944f-4302-8dbb-05b0096bcefb
2
public void writeFile(File file) { try { FileInputStream req = new FileInputStream(file); byte[] buffer = new byte[1024]; int b = 0; while ((b = req.read(buffer, 0, 1024)) != -1) { output.write(buffer, 0, b); } req.close(); output.close(); } catch (Exception ex) { ex.printStac...
b9f07573-7a73-405e-9469-9961cd4a6faf
9
private static Class<?> forName(String spec) { try { String name = pArray.matcher(spec).replaceAll(""); int dim = (spec.length() - name.length()) / 2; Class<?> c = primitives.get(name); name = pAnonymousInnerClass.matcher(name).replaceAll("\\$$1"); if (c == null) { try { c = Class.forN...
45643ab3-7481-499f-bc78-b92be9ea70a0
4
private boolean nakedSingleSolver() { boolean solvable = true; while (nakeds.size() > 0 && solvable) { solvable = false; int i=0; while (i < nakeds.size()) { NakedCandidates candidate = nakeds.get(i); if (candidate.values.size() == 1) { nakeds.remove(i); board.setValue(candidat...
a0120b18-a075-4428-8035-551a55b9f5ca
4
@Override @SuppressWarnings("unchecked") public void distributePacket(int id,final byte[] data, IIOHandler sender) { APacket p = IMH.getPacketRegistrie().getNewPacketOfID(id); log.fine("Distributing Packet\nID:" + id + "\nClass:" + p.getClass()); log.fine("Incoming Packet with " + data.length + " bytes!" + Sy...
44633cab-624e-4262-b42e-ced5a3310751
0
public int getMaxSpyDepth() { return miningDepth; }
799989f0-b111-4518-a5e7-dae67808ce9f
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TabelProdCategory other = (TabelProdCategory) obj; if (!Objects.equals(this.categoryId, other.categoryId)...
45533029-b62a-4e57-8230-c4f95fc91f23
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
8272f050-1d3a-47ee-9cfd-4c187835877d
2
public boolean msgUser(String user, String msg) { boolean success = true; String[] msgArr = msg.split("\n"); for(int j=0;j<msgArr.length;j++) { /* * Meaning if one call to sendln returns false * This entire function will return false */ if( !sendln("PRIVMSG " + user + " :" +...
2c5d8407-e676-4f40-b4d8-e6d742b425b6
4
private boolean checkPng() throws IOException { final byte[] PNG_MAGIC = {0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a}; byte[] a = new byte[24]; if (read(a) != 24) { return false; } if (!equals(a, 0, PNG_MAGIC, 0, 6)) { return false; } format = FORMAT_PNG; width = getIntBigEndian(a, 14); height = getIntB...
17519626-f0c2-41b3-82ef-4e425f4c1758
6
private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) { if (value != null && (type == Object.class || type instanceof TypeVariable<?> || type instanceof Class<?>)) { type = value.getClass(); } return type; }
eca4f82e-ec0d-4add-a0d1-61a77d21f164
2
public void removeFact(int id) { PreparedStatement ps = null; try{ stat.setQueryTimeout(30); String sql ="SELECT * FROM Fact Where Id ="+id; ResultSet rs = stat.executeQuery(sql); int count = rs.getInt("Counter"); ...
19af38ce-428e-45ac-8052-a11910c75036
9
private static void variedEdgeRecombinationCrossoverForRoutes(Individual child, Individual parent1, Individual parent2) { int coin; for(int period=0;period<problemInstance.periodCount;period++) { // Step 1. Assign client to vehicle // Step 2. Create Neighbour/Adjacency List // Step 3. Create Route ...
1f253669-9774-4dd5-b7c1-b7bde6670027
8
private void updateCurSpot (final char[][] newMap, final boolean[][] newIsFalling, final Point pos) { final char curSpot = getSpot(pos, DIRECT_NONE); if (curSpot == ROCK) { final Point newPosOfRock = new Point(pos); boolean isRockMoved = true; if (fallDown...
68aaa058-f9bd-48d9-af27-a0a5600e5a2f
8
public void finishRect(int x, int y){ selectionflag = true; if(x<0){x = 0;} if(y<0){y=0;}if(x>xdim-1){x = xdim-1;} if(y>ydim-1){y = ydim-1;} if(rectx > x){rectxc = rectx; rectxb = x;}else{rectxc = x; rectxb = rectx;} if(recty > y){rectyc = recty; rectyb = y;}else{rectyc = y; rectyb = recty;} for (int a = recty...
76f7a85d-3414-4887-a9ee-9c62ffcc823c
4
private boolean dentroPueblo(int x, int y, Point rangoPueblo){ if(x > rangoPueblo.x && x < rangoPueblo.y) return true; else if(y > rangoPueblo.x && y < rangoPueblo.y) return true; return false; }
b6f4040e-2996-448b-bfbd-217c1e3d9e78
3
public void drawName(Graphics2D g, int cSize) { Font font = g.getFont(); Font nf = new Font(Font.DIALOG, Font.PLAIN, font.getSize() * 3 / 4); g.setFont(nf); FontMetrics fm = g.getFontMetrics(); Color cSave = g.getColor(); int sWd = fm.stringWidth(this.getName()); int sHt = fm.getAscent(); Point p = thi...
122060f5-b92f-43fd-bcbb-9d04af01a9a0
9
private static int generatePushParam(ClassFileWriter cfw, int paramOffset, Class paramType) { if (!paramType.isPrimitive()) { cfw.addALoad(paramOffset); return 1; } String typeName = paramType.getName(); switch (typeNam...
cb392892-739d-47c6-bafb-6972981768f2
9
void hitmiss(int xe, int ye, int [][] pixel2, int [][]pixel, int [] lut){ int x, y; // considers the pixels outside image to be 0 (not set) for (x=1; x<xe-1; x++) { for (y=1; y<ye-1; y++) { pixel[x][y]+= lut[( pixel2[x-1][y-1] + pixel2[x ][y-1] * 2 + pixel2[x+1][y-1] * 4 + pixel2[x-1][y ]...
5c7f63fd-837e-482c-a51f-8e7c209227b7
5
public void run() { time = System.nanoTime(); roadDistance = 0; FastConvexHull fastConvexHull = new FastConvexHull(); conjunct = fastConvexHull.execute(geoRefs); // Obtenemos el complemento geoRefs.removeAll(conjunct); // Listado de puntos cercanos. Map...
2bd413a0-27d3-4b42-bf70-221fadb79e5f
1
public boolean hasHunter() { if (hunters.size() > 0) return true; return false; }
aeea0574-26f1-4674-8988-05e9404190ca
9
private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch(curChar) { case 97: ...
7d6b7f44-4c4e-4e80-883f-9f20188562f6
7
public Integer insert(PalletsBeans pallets) throws DAOException { PreparedStatement pst = null; ResultSet generatedKeys = null; try { pst = con.prepareStatement(sql.getString("INSERT_PALLETS"), Statement.RETURN_GENERATED_KEYS); pst.setString(1, pallets.getNombre()); pst.setInt(2, pallets.getActi...
7ddbd83a-27ef-4b10-88e5-f3f377674dc0
1
@Test(enabled = false) void testB() { if (false) throw new RuntimeException("This test always passed"); }
4e5f49b3-bc93-4b12-abcb-3f25aefa2d32
6
@Override public void run() { if (Updater.this.url != null) { // Obtain the results of the project's file feed if (Updater.this.read()) { if (Updater.this.versionCheck(Updater.this.versionName)) { if ((Updater.this.versionLi...
f5a4e012-5a6d-4229-8e3d-f6bdb5ad1750
4
@Override /** * Checks whether a user has supplied valid credentials */ public boolean authenticate(String username, String password, ServerSession session) { renameThread(); if (username.equals(DEFAULT_USER) && password.equals(DEFAULT_PASS)) { SSHManager.limitedUser = true; SSHManager.username = DEF...
f087b4a6-80c3-4481-a546-9b9738e7e57c
5
public static String formatMCMessage(final String message) { String msg = message; if (true) { //TODO: Implement option to enable/disable colros for (IrcColor c : values()) { if (msg.contains(c.getMinecraftColor())) { msg = msg.replace(c.getMinecraftColor(), c.getIRCColor()); } } } else { f...
62cbb65b-7bd1-4fc4-9c35-87b0f2d2345a
4
public void update() { long l = System.currentTimeMillis(); long deltaMillis = l - lastUpdateMillis; long millis = System.nanoTime() / 1000000; double secs = millis / 1000D; if (deltaMillis > 1000L) { lastUpdateSecs = secs; } else if (deltaMillis < 0L) { lastUpdateSecs = secs; } else { syncCount...
4d8bb211-0fd3-44cf-92a1-67c613b58651
7
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if ((sender instanceof Player)) { player = (Player)sender; } else { sender.sendMessage("You need to be a player !"); return true; } if(cmd.getName().equalsIgnoreCase("oitc")){ if(a...
83f468e9-ea2a-4cf1-9bee-f195ef15c717
7
@Transactional public int process(InputStream inputStream, ModelClass modelClass, RecordHandler recordHandler, AuditFields auditFields) throws UploadException { CsvBeanReader csvBeanReader = null; String[] headers = null; try { csvBeanReader = new CsvBeanReader(modelClass, inputStream); ...
4c8557d1-107f-4633-aac1-f07dfef18f1b
9
@Override public Object getValueAt(int rowIndex, int colIndex) { if(rowIndex>teams.size()) throw new IndexOutOfBoundsException("Row does not exist"); Team team = teams.get(rowIndex); switch (colIndex){ case 0: return team.getName(); case 1: return team.getPlayed(); case 2: return team.getWon...
3fe6c4e4-a5fd-4c09-94e4-b8fc3af61855
1
private void printADigit(final String aDigitView) { int theRealDigit = new Integer(aDigitView).intValue(); int i; for (i = 1;i<=theRealDigit;i++) { System.out.println(this.viewTempDigit(i)); } }
da1f6588-cf70-4c49-8cfb-31e1301ac7be
1
public boolean containsPacket(Class<? extends APacket> p) { return PList.contains(p); }
bbed2dc1-3b97-485d-a294-a2d0f393ea3b
8
public void save(boolean isPublic) { // Custom added mods are handled differently from mods already in the spreadsheet StringBuilder bldr = new StringBuilder(); if(name.getText().equals("") || name.getText().equals("Unknown")) { bldr.append("Can't save a mod without a name\n"); } if(author.g...
c5c86dec-6059-4713-8176-86a0837f0d4f
0
private void handleError(String message, Exception e) { MessageDialog.getInstance().showError(message); LOGGER.error(message, e); }
fdd2beb2-fade-409c-ab95-69200fdf73ef
4
@Override public void run() { System.out.println("Execute"); try { OutputStragegy st; if (output == null) { st = new SimpleDirectoryOutput(new File(System.getProperty("user.dir")), getName()); } else { st = output.getOutputStrategy...
b627519f-5920-4e3b-b5c5-085afd2d1857
7
public int compareTo(GraphEdge that) { final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; if (this == that) return EQUAL; if (this.target.getCompareToIndex() < that.target.getCompareToIndex()) return BEFORE; if (this.target.getCompareToIndex() > that.target.getCompar...
05422557-16af-405b-aaae-425ecbf2e01c
3
@Override public Notice updateNotice(Notice notice) throws RemoteException { Notice updated = null; for(Notice info : news.getNews()){ if(info.getId() == notice.getId()){ updated = info; break; } } if(updated != null){ updated.setSubjects(notice.getSubjects()); updated.setText(notice....
ccc325ea-c4a8-47a9-9558-04516dd78592
2
int[][] LerArquivo(String nome) throws Exception { String line, tokens[]; BufferedReader file = null; int k = 0, i; file = new BufferedReader(new FileReader(nome)); line = file.readLine(); tokens = line.split(","); l = Integer.parseInt(tokens[0]); c = Integer.parseInt(tokens[1]); mundo = new int[l...
db1c9851-e963-49ff-9389-ed59b910a86e
4
private void handleResponse(WorkerHeartbeatResponse resp) { if(resp.getCommand() == Cmd.IDLE) { currentTask = null; } else if(resp.getCommand() == Cmd.POLL) { //Do nothing } else if(resp.getCommand() == Cmd.RUN_NEW_TASK) { //TODO: //Spawn a new thread and start running the task //On any exception, ...
3f164a03-cf4f-4bb3-808f-bc26862b5dfc
5
public static ClassContent parse(Class<?> cls) { ClassContent cc = new ClassContent(); Annotation[] annotationList = cls.getAnnotations(); Method[] methodList = cls.getMethods(); boolean found = false; cc.setName(cls.getName()); // Parsing class annotation for(Annotatio...