method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
990c52c4-438b-45e3-a2a1-7c0763bac812
2
public AlumneVo buscarAlumne(String User) { try { DbConnection conex= new DbConnection(); PreparedStatement consulta = conex.getConnection().prepareStatement("SELECT * FROM alumnes where nomUser='" + User + "';"); ResultSet res = consulta.executeQuery(); if (res.ne...
4ccb0e9f-e849-45fe-93ff-47bf00e5f842
2
private void btnIngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIngresarActionPerformed if (jPContrasena.getPassword().length!=6) { JOptionPane.showMessageDialog(this, "Contraseña Incorrecta", "Error", JOptionPane.ERROR_MESSAGE); jPContrasena.reques...
08ae1244-63ba-46d4-8e7b-6ced59b9a7c1
5
@Override public String load() { try { Class.forName(JDBC_DRIVER).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { log.fatal("Driver failed", e); } Connection connection = null; try { ...
26a127ae-27f5-4ca2-b4d5-bbe57a45670e
0
public long binHasDisk(){ return binHasDisk; }
9c5af6cd-3054-4d6d-bef8-4e154b0055b5
5
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: System.out.println("Stop moving up"); break; case KeyEvent.VK_DOWN: currentSprite = anim.getImage(); robot.setDucked(false); break; case KeyEvent.VK_LEFT: robot.stopLeft(); break; case KeyEv...
160f065a-50c0-4c0d-aaa1-bebeb461ffef
8
public Object getValueAt(int row, int col) { Statement m = (Statement)statements.getBusinessObjects().get(row); if (col == 0) { return m.getName(); } else if (col == 1) { return Utils.toString(m.getDate()); } else if (col == 2) { return (m.isDebit()) ? "(D) -" : "(C) +"; } else if (col == 3) { ret...
77ec7f95-925b-4fe3-9312-255bcff8a975
1
public void setLength(){ if(length == Double.MAX_VALUE) length = Math.sqrt( Math.pow(fromNode.getxCoord()-toNode.getxCoord(),2) + Math.pow(fromNode.getyCoord()-toNode.getyCoord(),2) ); }
1d9633bc-b69f-4ec6-8c00-6fb07816ea3d
1
public int readNoEof() throws IOException { int result = read(); if (result != -1) return result; else throw new EOFException("End of stream reached"); }
884745ee-f183-4faa-b768-2de2b6404587
8
private static Method findSetterWithCompatibleParamType(final Class<?> clazz, final String setterName, final Class<?> argumentType) { Method compatibleSetter = null; for( final Method method : clazz.getMethods() ) { if( !setterName.equals(method.getName()) || method.getParameterTypes().length != 1 ) { ...
1f86695d-2b11-4446-adc2-983c8c0f5fea
4
private static void validateEmail(String email) throws TechnicalException { if (email == null || email.isEmpty() || email.length() > EMAIL_SIZE) { throw new TechnicalException(EMAIL_ERROR_MSG); } String regex = "\\w+@\\w+\\.[a-z]{2,}"; Pattern p = Pattern.compile(regex); ...
016c620e-68fa-4994-9f29-934f91b22435
7
public void proceed(int i, int j) { //Initializing Infofield inf = new Infofield(); mi = new Infofield(deck1); oi = new Infofield(deck2); for (int i1 = 0; i1 < new Random().nextInt(60); i1++) { //Preparing deck1 = shuffle(deck1); deck2 = shuffle(deck2); } if (pif.isShields())...
07d2ef16-9fdf-4d7a-a639-2bfdd57093b2
0
public double getPosY() { return posY; }
ab4a7f15-a536-4f43-a8ce-267417c5182e
3
public GUI(Startup startup, boolean Guion){ guion = Guion; s = startup; users = new JList<String>(s.getUserNames()); channels = new JList<String>(s.getChannelNames()); userpane = new JScrollPane(users); channelpane = new JScrollPane(channels); areapane = new JScrollPane(area); lists.setLayout(...
cb7e537f-b0f0-42a1-aed5-723da51d7612
3
synchronized void newSumLog(int n) { if (n >= sumLog.length) { double sumLogOld[] = sumLog; double sumLogNew[] = new double[n + 1]; // Copy old values for (int i = 0; i < sumLogOld.length; i++) sumLogNew[i] = sumLogOld[i]; // Calc new values for (int i = sumLogOld.length; i < sumLogNew.length;...
ad78c070-92d3-462e-af9a-4cbf9f8134f0
3
public static int triangleAsum1(int x[][]) { int sum = 0; for (int i = 0; i < x.length; i++) { System.out.println(); for (int j = 0; j < x[i].length; j++) { if (i <= j) { System.out.print(x[i][j] + " "); sum = sum + x[i][j]; } else { System.out.print(" "); } } } System.out....
9875f848-a045-4e3a-a6e7-aa8908045d2f
6
public Value merge(final Value v, final Value w) { SourceValue dv = (SourceValue) v; SourceValue dw = (SourceValue) w; if (dv.insns instanceof SmallSet && dw.insns instanceof SmallSet) { Set s = ((SmallSet) dv.insns).union((SmallSet) dw.insns); if (s == dv.insns && dv.size == dw.size) { return v; } e...
4d369b21-e661-4bfe-b287-c52640296985
6
@Override public List<Framedata> translateFrame( ByteBuffer buffer ) throws LimitExedeedException , InvalidDataException { List<Framedata> frames = new LinkedList<Framedata>(); Framedata cur; if( incompleteframe != null ) { // complete an incomplete frame while ( true ) { try { buffer.mark(); ...
4442bdc5-c935-4998-9b25-f51e4d4a93ad
8
@Override public void channelRead(ChannelHandlerContext context, Object message) throws Exception { if (message instanceof HttpRequest && ((HttpRequest) message).getUri().toLowerCase() .startsWith("/redirect?")) { HttpRequest request = (HttpRequest) message; QueryStringDecoder decoder = new Query...
2be645ea-8fac-4f46-bbfd-0a2fee9d446b
7
protected List<Node> expand(Node node, Problem problem, List<State> generatedStates, List<State> expandedStates) { List<Node> successorNodes = new ArrayList<Node>(); Node successorNode = null; State currentState = null; State successorState = null; Node bestNode = null; //If the current node and pr...
f2af02a2-666f-49bd-b157-cab3f5829abd
0
public CheckResultMessage check27(int day) { return checkReport.check27(day); }
b4099f0d-e7d8-4239-bcee-3b03655bf8cd
4
private String[] readTextField1() { int size = 0; String[] s; String temp = jTextArea1.getText(); char c = temp.charAt(temp.length()-1); StringReader sr = new StringReader(temp); try { LineNumberReader lr = new LineNumberReader(sr); lr.skip(Long.MA...
2a30cc1b-5526-48b2-8e6b-39140ad5623c
4
public static ArrayList<Object> parseList(StringBuffer buf, int[] idx) { idx[0]++; ArrayList<Object> into = new ArrayList<Object>(); while (true) { skipSpace(buf, idx); if (idx[0] >= buf.length()) { System.err.println("Unexpected end"); return into; } if (buf.charAt(idx[0]) == ']') { idx[0...
a7655262-f2ef-4a2e-ac58-3e523cbca7e3
7
protected Integer doInBackground() { Benchmark.start("UnreadNews"); int i = 0; try { BufferedReader reader = new BufferedReader(new InputStreamReader(new URL("http://feedthenuketerrorist.fr.nf/newsupdate.txt").openStream())); ArrayList<Long> timeStamps = Lists.newArrayList(); String ...
1e310654-6aa9-4278-b08e-c63663544d01
9
@Test public void testSum() { System.out.println("sum"); Polynomial<Double, Double, Double> instance = this._instance; double[] values; values = new double[4]; for (int i = 0; i < values.length; i++) values[i] = i + 1.0; Polynomial<Double, Double, Double...
67ce46ef-e9b0-439a-8009-e74dd2ada355
9
public void onScheduledTick (World world, int x, int y) { Tile tile = world.getTile(x, y-1); if (tile != null && !tile.solid) { if (tile.id == Tile.water.id) world.setTile(x, y-1, Tile.stone); else world.setTile(x, y-1, Tile.lava); return;...
0be553dd-f0e0-4519-8edf-a7f164b988eb
9
public void exportTMX(String path, String extention) throws IOException { StringBuilder seg1 = new StringBuilder(); StringBuilder seg2 = new StringBuilder(); path = checkPath(path, extention); try { OutputStream fout = new FileOutputStream(path); OutputStream bout = new BufferedOutputStream(fout); Ou...
faaf9c70-0ccc-48d8-ae9d-c159f7733a24
6
public void insert(int key) { Node uusi = new Node(key, false); if (root == null) { root = uusi; return; } Node current = root; Node p = current; while (true) { if (key == current.key) { return; // Jos lisättävä on juur...
0f5d8a4b-3368-46fa-835e-9f84f5add9e2
9
void compress(int init_bits, OutputStream outs) throws IOException { int fcode; int i /* = 0 */; int c; int ent; int disp; int hsize_reg; int hshift; g_init_bits = init_bits; clear_flg = false; n_bits = g_init_bits; maxcode = MAXCODE(n_bits); ClearCode = 1 << (init_bits - 1); EOFCode = ClearCo...
15ada417-69e4-4ec1-b9a9-509a5ae68d50
0
public void drawControlPoint(Graphics2D g){ //adjust later to center of circle = focus point g.drawOval((int)curve.getCtrlX() - 5, (int)curve.getCtrlY() - 5, 10,10); }
cb3a0fbb-a0f1-425b-bb17-211764bf781d
7
@Override public int advance(int target) throws IOException { if (scorerDocQueue.size() < minimumNrMatchers) { return currentDoc = NO_MORE_DOCS; } if (target <= currentDoc) { return currentDoc; } do { if (scorerDocQueue.topDoc() >= target) { return advanceAfterCurrent() ?...
1c4b77b4-be12-48ac-b93a-d3e1cf598b13
4
@Override public Float get(int i) { switch (i) { case 0: return w; case 1: return x; case 2: return y; case 3: return z; default: throw new IndexOutOfBoundsException(); } }
2673825b-d1f8-4490-9dba-6d2845c95503
3
public boolean onCTFCommand(CommandSender sender, Command cmd, String label, String[] args){ //admin command. commands are: session, team if (args.length == 0) { return false; //no just ctf command } if (args[0].equalsIgnoreCase("session")) { return onCTFSessionCommand(sender, cmd, label, args); }...
87172af2-473c-40ae-baf1-1cf8f9001de8
1
public void testConstructor_ObjectStringEx1() throws Throwable { try { new YearMonth("T10:20:30.040"); fail(); } catch (IllegalArgumentException ex) { // expected } }
02c5b02b-c0b9-4f3d-9553-619083212b9e
7
public static void writeSrcProperties(String projN, ArrayList<String> tl, ArrayList<String> wf){ ArrayList<String> srcPpts=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/srcOds/template.properties"),"UTF-8"); StringBuffer content=new StringBuffer(); for(int i=0; i<src...
52c91c7d-1eee-4fe7-a740-498a6a5778a4
8
public static void pdftoText(File file, String outDir) { PDFParser parser; String parsedText = null; PDFTextStripper pdfStripper = null; PDDocument pdDoc = null; COSDocument cosDoc = null; boolean filefound=false; String outFileName = null; String result=""; try { FileInputStream fis = new FileInputStream(file.getAbso...
902760d2-e83c-4421-86f1-35c343b300a1
2
public static SuitabilityEnumeration fromValue(String v) { for (SuitabilityEnumeration c: SuitabilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
94f92000-b213-4acd-8c4b-eb8bae795b38
0
public int getY() { return loc.y; }
5062f6b2-96a4-4bfa-a2f8-c57d943098a8
9
public void update() { ticks++; if (doAnimate) { if (changing) { alpha -= 0.05f; if (alpha < 0.0f) { alpha = 1.0f; changing = false; } else { changing = true; } } if (changingPause) { if (currentState != HELP) { alpha -= 0.05f; if (alpha < 0.0f) { alpha = ...
611bb058-59f7-4089-a40b-8a19da4c4218
4
public void terminated(Pipe pipe_) { int index = pipes.indexOf (pipe_); // If we are in the middle of multipart message and current pipe // have disconnected, we have to drop the remainder of the message. if (index == current && more) dropping = true; // Remove t...
fb6f0f64-1b0f-4b58-a792-830dc1cd5287
2
@Test public void getProjectiles(){ World w = new World(null); Projectile p1 = new Projectile(1,1,1,1, new Position(1,1),true); Projectile p2 = new Projectile(1,1,1,1, new Position(1,1),true); w.addProjectile(p1); w.addProjectile(p2); assertTrue(w.getProjectiles().size() == 2 && w.getProjectiles().co...
8cf4da9a-df0d-4d69-b55b-3014da3c78fa
7
public static int[][] findShortestPathReturnCost(Graph g, int sourceVertex){ int n = g.getVerticesCount(); //keeping space for 1 extra cycle to detect a negative cycle int [][]cost = new int[n+1][n]; Graph.Edge[][] retrackt = new Graph.Edge[n+1][n]; for( Integer i: g.getAllVert...
735c77b6-ea31-4f99-a6a4-fc6a1cf01d0d
3
@Override public Operation create(Scanner scanner) throws FactoryException { try { String metric = scanner.next(); if (metric.equals("pixelcount")) return new SearchOperation(saved, new PixelCountMetric()); else if (metric.equals("uniquechars")) ...
f5d6dbb8-6c2b-4ab0-b9da-eb1f4e8b8641
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ItemSet other = (ItemSet) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return ...
7720f10d-fc69-4388-a2fe-bd6369b5df40
4
private static String getNumberImageFile(int num) { if((2 <= num && num <= 6) || (8 <= num && num <= 12)) { return "images/numbers/small_prob/" + num + ".png"; } else { assert false; return null; } }
3445967c-94fd-4bfb-a86d-b5b9fd516db7
2
@Override public void run() { try { @SuppressWarnings("resource") ServerSocket socketServidor = new ServerSocket(1111); while (true) { Socket socketCliente = socketServidor.accept(); System.out.println("DEBUG: Cliente encontrado!"); Runnable handler = new ClientHandler(socketCliente); Thread...
76bb25b5-ee6a-4b93-9bec-9172f87014da
1
public static Distance getMiDistance() { if (miDistancia == null) miDistancia = new Distance(); return miDistancia; }
5f036976-6a70-4559-885a-a329e6e366be
8
public void drawUntersumme(WindowAndDataProvider windowAndDataProvider, Graphics g) { if(drawLowerSum == true) { double hoehe; DPoint p1, p2; p1 = new DPoint(); p2 = new DPoint(); for(double i=intervalLeft; i<=intervalRight-dx+(dx/4); i+=dx) { int j1, j2; j1 = 0; ...
f04249fd-8c85-46f8-829f-18381b9d6072
4
public BigDecimal convert(String startUnit, BigDecimal in, Type type, String endUnit) { if (type != null && type.isInList(startUnit) != null && type.isInList(endUnit) != null) { if (startUnit.equals(endUnit)) { return in; } else { return convertReferenceTo...
2b14cff8-0bb6-4825-8496-eb08f5a89cf8
6
void setColorProfile(ColorProfile profile) { if (profile.getWhitespaceColor() != null) { whitespaceColor = profile.getWhitespaceColor(); } if (profile.getLineHighlightColor() != null) { lineHighlightColor = profile.getLineHighlightColor(); } if (profile.getMatchingCharColor() != null) { ...
a1f326ab-044b-4598-b792-9d69ffd8c0c8
4
public void run(){ videoIdName = getFirstPropertyValue("video-id-prop"); videoRefIdName = getFirstPropertyValue("video-reference-id-prop"); writeToken = getFirstPropertyValue("write-token"); if((videoIdName == null) && (videoRefIdName == null)){ die("One or both of 'video-id-prop' or 'video-referen...
d38de145-0039-4ed0-a430-31ea84ff641d
5
@Override public boolean valid() { return super.valid() && (ctx.skillingInterface.getAction().equals("Smelt") && !ctx.skillingInterface.select().id(MakeSword.HEATED_INGOTS[0]).isEmpty()) || (!ctx.backpack.isFull() && (ctx.backpack.select().id(options.getIngotId()).isEmpty() && ctx.backpack.select().id(MakeSw...
a8688408-1e6c-45f6-b647-3805764bd0b3
0
public boolean containsValue(Object value) { return this.map.containsValue(value); }
844308e2-a7bf-4a4c-b512-2135824d27af
4
@Override public void updateMovement() { xxa = 0.0F; yya = 0.0F; if(keyStates[0]) { yya--; } if(keyStates[1]) { yya++; } if(keyStates[2]) { xxa--; } if(keyStates[3]) { xxa++; } jumping = keyStates[4]; running = keyStates[5]; }
3028236d-b3e0-4012-994e-3b9795e2b16c
6
private void walk() { setX_Point(getX_Point() + getxVel()); // for graphics if(isWalking()) { if(timer==null){ timer= new Timer(75); } if(timer.isReady()) { if(timeVar==0){ timeVarPosi=1; }else if(timeVar==3){ timeVarPosi=-1; } timeVar+=timeVarPosi; timer= ...
d846601e-fbed-4037-b282-800b24cd134d
4
public void quickSort(int left, int right) { if (right <= left) return; int lt = left, gt = right; int i = lt; int pivotIndex = (int) (Math.random() * (right - left)) + left; T pivot = this.array[pivotIndex]; swapArrayValues(left, pivotIndex); whi...
f203e7d8-f9b2-400f-8f48-fb02512b76dd
8
public HashMap<Character, Integer> kVecinosMasCercanos(String ficheroTest) { HashMap<Character, Integer> mapaco = new HashMap<>(); // Inicializo el vector de vecinos try { Character letra = 'A'; // Inicializo el map a 0; for (int i = 0; i < 26; i++) { mapaco.put(letra, 0); letra++; } Bu...
c7e82eff-dd87-4cf8-9df0-c4e02d19a9f6
0
public void setContent(JPanel content) { this.content = content; }
601d0642-f432-4672-8f48-93cb09f6a8dc
8
private void validarCategoriaConTipoDeComprobante() throws InvalidInvoiceException, InvalidIDException{ if(tipoDocumentoDeCliente==null) throw new InvalidInvoiceClientIDTypeException("Missing ID Type"); if(categoria==null) throw new InvalidInvoiceException("Invalid Invoice Category"); if(categoria.equals(TipoCate...
fc343f20-98b8-4c94-a4dd-a87cefd028b2
6
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (taskId >= 0) { return true; } // Begin hitting the se...
21ff2a44-41cf-4f6c-b1ff-291b357cdae5
7
@Override synchronized public void init () { Game = getParameter("Game"); Games = getParameter("Games"); setLayout(new BorderLayout()); if (Games != null && !Games.equals("")) { L = new java.awt.List(); add("Center", L); Urls = new Vector(); try { BufferedReader in = null; if (Games.s...
c02915c6-8f27-4ac0-b9e5-a78194f34c1f
4
public static String StripColor(String str) { if(str == null) return ""; StringBuilder sb = new StringBuilder(); char colorChar = ColorPrefix.charAt(0); boolean colorMode = false; for(int i=0; i<str.length(); i++) { char ch = str.charAt(i); if(ch == colorChar) { colorMode = true; con...
b91e8331-6b7c-4d01-bae5-eef6de205876
6
private void printTimeStamp(int level) { switch(level) { case ALWAYS: { psOut.print(MSG_ALWAYS+LOG_SEP); break; } case ERROR: { psOut.print(MSG_ERROR+LOG_SEP); break; } case INFO: { psOut.print(MSG_INFO+LOG_SEP); break; } case VERBOSE: { psOut.print(MSG_...
977483f3-4f47-4121-b736-89614bc6bf4e
2
private Integer createUser(Criteria criteria, AbstractDao dao) throws DaoException{ Criteria loginCrit = new Criteria(); loginCrit.addParam(DAO_USER_LOGIN, criteria.getParam(DAO_USER_LOGIN)); Criteria emailCrit = new Criteria(); emailCrit.addParam(DAO_USER_EMAIL, criteria.getParam(DAO_US...
bf9b5055-0ab6-4108-b453-35f81fc0ba97
6
public boolean updateFFmpegArgumentsName(String name, String arguments, String extension) { boolean ret = false; if (connection == null || name == null || !hasFFmpegArgumentsName(name)) return ret; try { PreparedStatement stat = connection.prepareStatement("UPDATE " + FFmpegArgumentsTableName + " SET Argum...
dbc06199-54b6-4d11-b089-2a0bd15c76a8
2
public void localModify(String local_path, java.sql.Timestamp local_update, int user) { DBLikeFileObject data = new DBLikeFileObject(local_path, local_update, user); DBLikeFileObject search = null; Iterator<DBLikeFileObject> itr = localDB.iterator(); for (int i = 0; i < localDB.size(); i++) { search ...
6ef2ec28-beb1-4c42-a7b1-f715f7880df8
2
public GUI getGUI(String title) { for (GUI g : GUIs) { if (g.getTitle().equalsIgnoreCase(title)) { return g; } } return null; }
2f9ce84f-d29a-4266-a02f-dbcdb87ac429
2
public void createNodePossibilities(ArrayList<Rod> rodList) { int currLen = 0; int priceListLength = rodList.size(); for(int index = 0; index < priceListLength; index++) { currLen = rodList.get(index).getLength(); for(int eachRod = 0; eachRod < totalLength/currLen; eachRod++) { possibilities.add(new Rod...
c92e4596-3242-4efd-a90f-a592691df821
2
public static void print(char[][] board,int rows, int cols){ for(int i=0;i< rows;i++){ for(int j =0;j < cols;j++){ System.out.print(board[i][j]+ " "); } System.out.println(); } }
63ec90cf-2615-484a-8b64-e162472a3fe1
4
public void writeInformation(Description d, int categoryID, HUD UI) { if (categoryID == 0) describeCondition(d, UI) ; if (categoryID == 1) describePersonnel(d, UI) ; if (categoryID == 2) describeStocks(d, UI) ; if (categoryID == 3) describeUpgrades(d, UI) ; }
02b43b40-0994-4d0c-89bc-6578c884f389
6
protected void processGlobalResourceARList(Sim_event ev) { LinkedList regionalList = null; // regional GIS list int eventTag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_LIST; boolean result = false; // for a first time request, it needs to call the system GIS first, // then asks...
9802cf7f-65d1-4317-92aa-b3f4bee4cad5
1
public void onFirstStat(Stat stat) { if (!stat.isNormalState()) onStatStateChanged(stat); }
982bce8f-2606-49e2-b56b-2b71b86a69b9
6
*/ public 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...
27ce667e-4685-431a-a169-addaead77607
4
public void moveNorth() throws InterruptedException{ if (isDoor[0] && !isLocked[0]){ currentY--; currentRoom = rooms[currentY][currentX]; currentRoom.playerVisits(); setAdjacentRooms(); Game.printMessage("You walk through the northern door\n"); } else if (!isDoor[0]) Game.printMessage("There is no...
ea11734d-eca6-4694-ae47-110303c789a0
0
protected void _setDistance(Distance distance) { _distance = distance; _setTarget(_targetFromDistance(distance)); }
7b0e0a9c-0148-46e8-a044-7b37bc4f4a38
1
public void addDay(String weekNumber, String day, Boolean value) { Map<String, Boolean> existingInner = data.get(weekNumber); if (existingInner == null) { existingInner = new HashMap<String, Boolean>(); } existingInner.put("day-" + day, value); data.put("week-" + wee...
ca534ca7-38f3-41f2-87bc-ecca86b2629f
0
public TernaryST() { N = 0; }
ea286886-6213-4f8b-b511-19a8a619f028
0
public String toString() { return "[Item object: id=" + this.id + " name="+ this.itemName + " desc=" + this.desc + " obtained=" + this.obtained + " cost=" + this.cost + "]"; }
787b4806-e66a-4c0e-9969-59cc5ca7ade5
5
public boolean mouseOver(int x, int y) { if (bounds.contains(x, y)) { if (!animating) { if (!beingClicked) currentIndex = 1; } } else if (buttonMode && !animating) currentIndex = 0; return false; }
dbca40b5-46e4-4361-aa0a-a6a7789ba210
3
private boolean isDirectory( String path ) { File f = new File( path ); if ( f.exists() ) { return f.isDirectory(); } else { char flag = path.charAt( path.length() - 1 ); if ( flag == '/' || flag == '\\' ) { return true; } else { return false; } } }
4a19405b-f3a2-4b86-a33b-c248a6c56e7d
4
public short open_serial() { // the next line is for Raspberry Pi and gets us into the while loop and was suggested here was suggested http://www.raspberrypi.org/phpBB3/viewtopic.php?f=81&t=32186 System.setProperty("gnu.io.rxtx.SerialPorts", COM_PORT_NAME); Enumeration portEnum = CommPortIdentifier.getPo...
f65d27ba-a2b6-483c-8204-23880128cc53
5
private void dfs(Graph<?> G, Object v, Object w) { this.marked.put(v, true); this.path.add(v); System.out.println(path); for (Object temp : G.getAdjacentVertices(v)) { if (temp.equals(w)) continue; if (path.contains(temp)) { break; } ...
e40a49e2-4124-46f5-ac99-f41016de0e2b
0
public String getPrice() { return price; }
c05537d5-0393-46a1-9a05-3e038ee46f48
2
RoomOutput[][] printScheme(int i, int j, Schedule s){ RoomOutput[][] r = new RoomOutput[s.schedule[0][0].rooms.length][s.schedule[0][0].rooms[0].length]; for(int k=0; k<r.length; k++){ for(int m=0; m<r[0].length; m++){ r[k][m] = new RoomOutput(s.schedule[i][j].rooms[...
197f2756-88bf-4876-aa87-cd3fcd262352
9
public InputSource resolveEntity(String pid,String sid) { if(log.isDebugEnabled()) log.debug("resolveEntity("+pid+", "+sid+")"); URL entity=null; if(pid!=null) entity=(URL)_redirectMap.get(pid); if(entity==null) enti...
89a13b8d-4688-457a-885a-3575a63c7293
7
protected <T> Subject createSubject(final SudoAction<T> c) { Subject s = c.getSubject(); if(s == null) { final Set<Object> credsPrivate = new LinkedHashSet<Object>(); final Set<Object> credsPublic = new LinkedHashSet<Object>(); final Set<Principal> principals...
e888d2fc-83ac-4fd3-ac37-3393499671bb
8
public Node closeBra(int bras,int wasBraL,int firstbras,Node n){ if(n.getRN() == null){ int aux = wasBraL; while(true){ if(n.getnrB() > 0 && n.getownB() > aux){ n.setB(n.getnrB() - aux); n.setownB(n.getownB() - aux); break; } if(n.getnrB() > 0 && n.getownB() <= aux ){ aux -= n.ge...
d108953b-d966-4160-abb8-d669525485be
0
private void loadPowerUpSprites() { // create "goal" sprite Animation anim = new Animation(); anim.addFrame(loadImage("heart1.png"), 150); anim.addFrame(loadImage("heart2.png"), 150); anim.addFrame(loadImage("heart3.png"), 150); anim.addFrame(loadImage("heart2.png"), 150)...
28120e0e-12ab-4f88-808c-c3bd3c361f82
4
public static final void setup(Class<?> theClass) { BundleInfo.setDefault(new BundleInfo(theClass)); Path path; try { URI uri = theClass.getProtectionDomain().getCodeSource().getLocation().toURI(); path = Paths.get(uri).normalize().getParent().toAbsolutePath(); if (path.endsWith("support/jars")) { //$NON...
91762a95-cba5-4a81-bdf7-77d10937a20c
2
private boolean isBestScore(long l) { for(Map.Entry<Player, Long> entry : speeds.entrySet()) { entry.getValue(); if(l > entry.getValue()) return false; } return true; }
d487de6d-7179-4efa-8619-1f905126157b
3
public void entrar() { try { int cedula = Integer.parseInt(usuario.getText()); String password = contraseña.getText(); DAO_Login login = new DAO_Login(cedula, password); login.conexion.conectar(); int tipoUsuario = login.login(); login.cone...
edb565a8-95a7-45d0-ad61-cc428d4cbf36
1
@Override boolean offerStop() { if (getPoints() >= 17) { setStop(true); System.out.println("AI stopped"); } else System.out.println("AI refused to stop"); return isStop(); }
9bdb1426-0949-4c0a-a815-e7c01d3955b4
4
public static void main(String[] args) throws InterruptedException { final int numberOfTrees= 10; final int numberOfDucks= 20; final int numberOfHunters= 10; HuntField field= new HuntField(12,24); //12x24 Swing swing = new Swing(field); for(int i=0; i<numberOfTrees; i++) new Tree(field); fo...
cc9a84e0-074e-401c-853e-c7c20a9131c1
1
public void visitUCExpr(final UCExpr expr) { if (expr.expr == from) { expr.expr = (Expr) to; ((Expr) to).setParent(expr); } else { expr.visitChildren(this); } }
34196503-ab06-45a8-982c-dcee656568cf
0
protected void setX(int _x) { this.x = _x; }
86ea80f5-eb69-44e9-8992-0c7d045f3f2f
5
private void mergeListaServidores(List<InetAddress> IPServidores) { for (InetAddress IP : IPServidores) { boolean found = false; for (InetAddress IP2 : servidoresArquivo) { if (IP.equals(IP2)) { found = true; ...
f247f76f-c175-4290-9e2d-a821dfa7640d
4
protected void select( int posX, int posY ){ this.selected = boardController.select(posX, posY); if(this.selected.getUnit() != null){ // One unit if(this.selected.getUnit().getLoyalty() != this.loyalty){ // Unit 0 different loyalty try the nex one ;) if(this.selected.getUn...
bd08a937-a00c-4446-9ac3-281720c2d7c4
8
public Ventana(InterfazJuego tipoJuego, int AnchoVentana, int AltoVentana, int DiametroImagen, int NumeroEnemigos, int NumeroObstaculos, int NumeroLocos) throws IOException{ //Creamos la ventana principal JFrame jf = new JFrame("Ventana Juego"); jf.addWindowListener(new WindowAdapter() { pub...
ff4a91ee-a089-40ed-bba5-c39db360a758
4
public void setCurrentPawnInfo(String pieceID) { char color = pieceID.charAt(0); if (color == 'g') { startPosition = greenStartPosition; homePosition = greenHomePosition; safetyZoneIndex = greenSafetyIndex; currentStart = greenStart; currentHom...
0a41ffbf-ce5f-41ee-a792-7624b2bb6796
0
public static void write(String output) { Date d = new Date(); String timeStamp = String.valueOf(d.getTime()*1000); String outStep = timeStamp + ", " + output; p.println(outStep); }
d3973163-8faf-4732-9ebe-d43fb343f73c
6
private boolean compareParallelSequential (AbstractModel m1, AbstractModel m2) throws InterruptedException, ExecutionException{ //make steps on models for(int i = 0; i < TEST_FRAME_LIMIT; i++){ m1.step(); m2.step(); } //if lists are different sizes we can fail right away if(m1.p.size() != m2.p.siz...