method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
df47f194-4478-4b5f-93ad-1180ced9ba16
9
static public <EX extends Throwable> EX throwDeepCauseChecked(Throwable t, Class<? extends EX> clazz) throws EX { if (t == null ) { throw new NullPointerException(); } Error firstError=null; EX firstEX=null; RuntimeException firstRTE=null; // Walk chain finding first item of each interes...
788b5986-a62e-4be4-8827-8c5a8d36ebfb
4
private void passCards() { while ((pack.getCardAmount() > 0)&&(currentPlayer.getAmountOfCards() < opponentPlayer.getAmountOfCards())) { currentPlayer.receiveCard(pack.getNextCard()); } while ((pack.getCardAmount() > 0) && (currentPlayer.getAmountOfCards() < CARDS_FOR_EACH)) { ...
3062bc90-371c-48b5-bede-51601539dba9
1
public void setJob(DownloadJob job) { this.job = job; if (job != null) job.updateProgress(); }
e69c971e-6961-4fed-9393-514b8818cfdd
0
@Override public void selectionChanged(TreeSelectionEvent e) { calculateEnabledState(e.getTree()); }
e659d9df-fcd8-44f7-a4ee-a14cfb445007
1
public static void InitializeDefaultClient(AprilonIrc plugin) { if(DefaultClient == false) return; IrcClient defaultclient = new IrcClient(plugin, "defaultclient"); defaultclient.setServer(Server); defaultclient.setPort(Port); defaultclient.setNick(Nick); def...
eef8e53d-db0a-447d-80db-81e55a526d27
7
public void start() { try { configParser.parse(); } catch (IOException e) { e.printStackTrace(); } System.out.println("-------------------- Variables Set --------------------"); System.out.println("CREATE_INDEX = " + IndexConfig.createIndex); Sys...
108f0000-2d20-4e6e-bb98-b8a41a6ee1e8
5
public RuleGenerator(SLDescription sl, ElapsedCpuTimer time) { this.usefulSprites = new ArrayList<String>(); this.random = new Random(); String[][] currentLevel = sl.getCurrentLevel(); //Just get the useful sprites from the current level for (int y = 0; y < currentLevel.length; y++) { for (int x = 0; x < cu...
5e4f6cd5-ebc2-4af2-b79e-ea8a3df3a5f3
8
@Test public void drawLineSamePointWidth(){ Whiteboard wb = new Whiteboard(); Color newColor = new Color(5, 12, 40); Color white = new Color(); ArrayList<Point> expectedPoints = new ArrayList<Point>(); for (int i = 99; i < 101; i ++){ for (int j = 99; j < 101; j +...
1f3a5eb8-8225-4601-904c-f8efdcd41e78
0
public void setCompanyApplications(CompanyApplication companyApplications) { CompanyApplications.add(companyApplications); }
cae31985-4d2b-4683-9b5b-a60f246ef37b
3
public Set<String> getKeys(boolean deep) { Set<String> result = new LinkedHashSet<String>(); Configuration root = getRoot(); if (root != null && root.options().copyDefaults()) { ConfigurationSection defaults = getDefaultSection(); if (defaults != null) { ...
d9527e56-17bd-47a4-887b-d0d6c507fd49
5
public static synchronized File getFileGivenNameOnCurrentDirectory(String directoryName){ // Proceed only if the directory name is not null and is not empty if(directoryName != null && !directoryName.trim().isEmpty()){ // Get the current directory and list all its contents File[]...
165613a1-ef18-4564-bf3b-6ac58b495fb5
9
@Override public Broker createPersistence(IPersistente objP, Object arg) { if (arg == null) { if (objP.getClass() == Linea.class) { return new BrokerLineasAccess((Linea) objP); } else if (objP.getClass() == Estacion.class) { return new BrokerEstacion...
fcfaeecb-9ecc-452c-ae40-ec69a3a76217
6
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); JSONObject result; Pattern p = Pattern.compile("/db/api/([\\w]+)/([\\w]+)...
6b370a02-dd38-4e23-aaa8-46856f5d8faf
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { boolean anythingDone=false; for(final Enumeration<Ability> a=mob.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null)&&(A instanceof Language)) { if(((Langua...
9b3acf85-9e81-4a80-bb85-0fe57e184c4e
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if (APPLET.currentlyLoggedIn) { String post = ""; for (int i = 0; i < cloths.length; i++) { post+=cloths[i]; post+=","; ...
efbdd3ca-2be3-4988-a1f3-b88585d9fb7c
4
public static String replaceVariable(String line, String varName, String replacement) { String result = ""; String rest = line; boolean done = false; while (!done) { Matcher m = VAR_PATTERN.matcher(rest); if (m.matches()) { String var = m.group(2);...
691a04cf-28dc-4620-af26-6729aae5607c
3
@Override public boolean equals(Object object) { if (object instanceof RSTile) { RSTile other = (RSTile) object; return x == other.x && y == other.y && other.z == z; } return false; }
44e629ba-84f7-49b7-8333-80f4fd350b39
0
private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed //Cierra la interfaz de Eliminar setVisible(false); }//GEN-LAST:event_btnCerrarActionPerformed
0ec1e6db-d8b9-470e-b3a6-f1aa2cf787d4
0
public void setEnabled() { enabled = true; }
d742bf9e-a75d-4ae3-8302-bb7fa5d0111c
8
protected void loadScoreMatrix(int scoreMatrix) { ScoreHash wholeMatrix = null; switch (scoreMatrix) { case SCOREMATRIX_ORIGINAL: wholeMatrix = m_passedHash; break; case SCOREMATRIX_PAM250: wholeMatrix = new ScoreHash(); wholeMatrix.setS...
06696154-28c1-4af1-b22f-1c15df2c7c56
7
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) { int rounds, i, j; int cdata[] = (int[])bf_crypt_ciphertext.clone(); int clen = cdata.length; byte ret[]; if (log_rounds < 4 || log_rounds > 31) throw new IllegalArgumentException ("Bad number of rounds"); rounds = 1 << log_rounds; ...
2ee1a898-dc87-44d0-b8a6-e805744b2718
6
static final void method797(int i, int i_29_, byte i_30_) { anInt1379++; if ((i_29_ ^ 0xffffffff) != (Class348_Sub40_Sub6.anInt9139 ^ 0xffffffff)) { Class318_Sub6.anIntArray6432 = new int[i_29_]; for (int i_31_ = 0; (i_29_ ^ 0xffffffff) < (i_31_ ^ 0xffffffff); i_31_++) Class318_Sub6.anIntArray6432...
70683f32-67f5-4245-9905-0b73c9daf2be
3
private void processBack() { if (intervals == null || intervals.size() == 0) { return; } getFictitiousInterval().setY(y_shift); for (int i = 1; i < intervals.size(); i++) { getInterval(i).setY(getInterval(i).getY() + y_shift); } // System.out.print...
4282ea05-73ef-4160-a038-ddda845257e1
8
public static int[] getStatsTripleList(ArrayList<Triple> triples, HashSet<String> blankNodes, HashSet<String> USUs){ int[] stats=new int[6]; stats[0]+=triples.size(); //Iterate over all triples for (Triple t:triples){ //Check subject, predicate and object for (int i=0; i<3; i++){ String resource=t....
ab187622-a5a0-41cd-9f26-924c63b8ef2f
1
private static void badExample() throws IOException { try { npe(); } catch (MyException e) { // should never happen e.printStackTrace(); } }
a8a7bb06-7059-47dd-b60c-1dd063de9035
8
public Collection<Comune> donwloadAndParse() { try { List<Comune> comuni= new ArrayList<>(); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(ZIP_URL); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { ...
50a401a2-bccb-4e12-a18c-5f75ea19f6d7
7
public void loadObjects() { objectTiles.clear(); for (final SceneObject o : SceneEntities.getLoaded(new Filter<SceneObject>() { @Override public boolean accept(SceneObject o) { return o != null && objIds.contains(o.getId()); } })) { if (o == null || o.getLocation() == null) { continue; } ...
1ef95e2e-0059-47f3-9422-b2d3c7d50c35
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (command.getName().equalsIgnoreCase("activitystats")) { if (args.length == 0) { if (plugin.perms().has(sender, "activitystats.view.self")) { if (sender instanceof Player) { return reportActiv...
099a105e-fda4-4b65-a60b-6e65e6922857
2
public static void saveData() { try { ObjectOutputStream objectOut = new ObjectOutputStream(new FileOutputStream( new File(RESOURCE_LOCATION))); if(clientRecent == null) { clientRecent = new ArrayList<InetSocketAddress>(); } objectOut.writeObject(clientRecent); objectOut.close(); } catch(Exc...
ebe977a9-2295-40d4-9882-0c6b9db42c86
7
@Override public ExpressionTree next() { ExpressionTree result = stack.peek(); if (!stack.isEmpty()) { ExpressionTree temp = stack.pop(); if (!stack.isEmpty() && stack.peek().left().getRoot() != temp.getRoot() && stack.peek().right().getRoot() != temp.getRoot()) { ...
cc7655cf-89ef-4797-a81b-80b47a37b216
1
static public String addMarker(int x,int y) { double lat = latitude - yToMap[zoomIndex]*y + imageSizeH/2*yToMap[zoomIndex]; //double lat = 51.111565; double lon = longtitude + xToMap[zoomIndex]*x - imageSizeW/2*xToMap[zoomIndex]; if(markers<20){ markersArray[markers]...
1f086766-0227-44b1-b1dd-2e2fc589841a
3
public void add(T t) throws SQLException{ Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(t); session.getTransaction().commit(); } catch (Exception e) { J...
17dd8529-c38e-4e5a-8b6c-c94447f59a16
3
@Override public void update(long delta) { float pI; System.out.println("particle start"); for (pI = particlesPerTick; pI >= 1; pI--) { Particle p = new Particle(pos.getX() + Util.randomInRange(-xsize, xsize), pos.getY() + Util.randomInRange(0, ysize), 320, 60, 20, lifespan, Texture.getTexture("raindrop"...
76c5b227-706e-4dfc-97a5-11383bb6c9a1
2
public static void loadAllAchievements() { String statement = new String("SELECT * FROM " + DBTable + " WHERE type = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, PRACTICE_TYPE); ResultSet rs = stmt.executeQuery(); while (rs.next()) { Practi...
acf39147-e7b1-46b2-9f0e-4cd51c0e348a
3
@Override public void addMeetingNotes(int id, String text) { if(text != null) { Meeting newMeeting = getMeeting(id); if(newMeeting != null) { if(newMeeting.getDate().before(timeNow())) { throw new IllegalStateException(); } else { ...
4a2d7112-61ac-490c-9af8-90b4ebbc7ecf
1
public WinWarn(String mess) { super(Game.getInstance(), false); //setModal(true); setBounds(Game.getInstance().getBounds().x+(1274-500), Game.getInstance().getBounds().y+33, 500, 30); setResizable(false); setUndecorated(true); // Fond d'écran JLabel background = new JLabel(); background.setBackgroun...
34c93db0-f13e-45e4-928a-bf029a6af27c
5
public static ArrayList<BookCopy> searchBookByTitle(String title){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<BookCopy> books =...
c3210f6d-8d03-4634-a4e0-a0ab270db305
3
@SuppressWarnings("unchecked") private static HashMap<String, Integer> addFile(File cardFile, HashMap<String, Integer> m) throws FileNotFoundException { HashMap<String, Integer> newMap = (HashMap<String, Integer>) m.clone(); Scanner sc = new Scanner(cardFile); sc.useDelimiter("\\s*\n"); while(sc.hasNext(...
aaa0c675-0871-434d-abc3-a9ece01397d6
4
public void printStackTrace( Exception e, int indent ) { printExceptionMessage( e, indent ); importantMessage( "STACK TRACE:", indent ); if( e == null ) return; StackTraceElement[] stack = e.getStackTrace(); if( stack == null ) return; ...
ea38483a-7a1e-43eb-a6fa-751dde74b854
6
public int PositionRelative(Player p){ if(p.boundingBox.y+p.boundingBox.height<this.y+p.boundingBox.height/2 && p.boundingBox.y<this.y) return DESSUS; else if(p.boundingBox.y>this.y+this.height-p.boundingBox.height/2 && p.boundingBox.y+p.boundingBox.height>this.y+this.height) ...
f07bbb27-12fe-4faa-96fd-50300a3c32f2
9
@SuppressWarnings("unchecked") private void addInlineDiffs(Delta delta) { List<String> orig = (List<String>) delta.getOriginal().getLines(); List<String> rev = (List<String>) delta.getRevised().getLines(); LinkedList<String> origList = new LinkedList<String>(); for (Character charact...
db816533-8220-4dd5-85da-369cc2d64ce7
1
public void finwait() throws InterruptedException { synchronized(this) { if(eof) return; wait(); } }
96a4361d-2999-4824-81d0-8dc8fd50d6f1
6
protected void swimlaneAdded(Object swimlane) { mxIGraphModel model = getGraph().getModel(); Object parent = model.getParent(swimlane); int childCount = model.getChildCount(parent); mxGeometry geo = null; // Finds the first valid sibling swimlane as reference for (int i = 0; i < childCount; i++) { Ob...
940e2c11-77bc-4b6f-9de9-816bcd06a482
9
@Override public int hashCode() { int hash = 0; if (fixtureId != 0) { hash += fixtureId; } if (date != null) { hash += date.hashCode(); } if (round != 0) { hash = +round; } if (spectators != 0) { hash +=...
4c33ebf4-36e2-416a-8280-b92843dde7d3
9
@GET @Path("get") public Observation get(@QueryParam("observationUri") String observationUri) { Observation obs = new Observation(observationUri); List<PropertyValue> additionalProperties = new ArrayList<PropertyValue>(); List<String> additionalTypes = new ArrayList<String>(); String queryStr = ObservationQu...
efd8e61f-f3c0-4811-bad1-d77b6ebd20ed
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
396720b0-1628-4c44-a456-b333910b9bf8
3
public Edge getEdgeByVertices(Vertex start, Vertex end) { for (int i = 0; i < edges.getSize(); i++) { if (edges.get(i).getStart() == start) { if (edges.get(i).getEnd() == end) { return edges.get(i); } } } return null; ...
705d60dd-55e0-4127-914c-c553a1d3045d
6
private void updateApple() { Random rand = new Random(); int x = rand.nextInt(476); int y = rand.nextInt(426); while (x % 25 != 0 || y % 25 != 0) { if (x % 25 != 0) { x = rand.nextInt(476); } if (y % 25 != 0) { y = rand....
95aca10a-486b-4a92-9b15-45b99f43b966
2
private void checkRotate() { if (rotate) { String newFilename = calculateFilename(); if (!filename.equals(newFilename)) { filename = newFilename; super.publish(new LogRecord(Level.INFO, "Log rotating to: " + filename)); ...
e9eceddb-9c04-4a2e-8bbf-1845b38739ee
4
public void viewImages(Connection conn, Study study, int index, DisplayState.States state, List<Command> commands) { this.conn = conn; this.study = study; executedCommands = new LinkedList<Command>(); redoCommands = new LinkedList<Command>(); ImagePanel p; ...
c8219376-3b6e-4e05-bb9e-cf2e8683774f
6
public boolean computeAssignments(Set<String> symbols){ String[] elements = new String[symbols.size() * 2 ]; int k = 0; int j = symbols.size(); for(String s : symbols){ elements[k] = s; elements[k + j] = "~" + s; k++; } int[] indices; CombinationGenerator x = new Combinat...
e2ebc1d0-a5c5-4c1e-a7ca-855b670d2482
5
private double run_model(Model model, List<Output> out, File folder, String simName, double[] x) throws Exception { Map<String, Object> parameter = model.getParameter(); Object comp = model.getComponent(); // spatial params ParameterData[] pd = Step.create(params, parameter); f...
1d1f8bd8-a643-401b-ae9a-2ff9efbd7abb
4
public static void main(String[] args) { List<String> list1 = new ArrayList<String>(); List<String> list2 = new ArrayList<String>(); list1.add("1"); list1.add("3"); list1.add("8"); list1.add("9"); list2.add("2"); list2.add("3"); list2.add("7"); for(String s2:list1) { boolean flag = false; ...
42cdb6b4-d2c1-4307-b1f9-b8ceb50f8179
5
public boolean HasChanged() { if(m_parent != null && m_parent.HasChanged()) return true; if(!m_pos.equals(m_oldPos)) return true; if(!m_rot.equals(m_oldRot)) return true; if(!m_scale.equals(m_oldScale)) return true; return false; }
7434e85d-9685-4491-91b6-f4c363a968b1
8
@Override public void validarSemantica() { Tipo var=null; if(InfSemantica.getInstancia().tablaGlobal.containsKey(id)) { var=InfSemantica.getInstancia().tablaGlobal.get(id); } else{ try { throw new Exception("Error Semantico, la vari...
91f94aaf-e568-4577-b891-dc16b4547f97
4
public static boolean contains(Object objectToFind, Object... array) { if (array != null && array.getClass().getComponentType().isInstance(objectToFind)) { for (int i = 0; i < array.length; i++) { if (objectToFind.equals(array[i])) { return true; } } } return false; }
1e926d86-343a-452f-9865-50439f589df5
9
public void handleMouseDown(MouseEvent evt) { int x = evt.getX(); int y = evt.getY(); if (!drawing.layers[controlPanel.getCurrentLayer()].visible && !menuBar.colorPicker.isSelected()) { JOptionPane.showMessageDialog(null, "The current layer is invisible.", "Can't draw there", JOptionPane.ERROR_MESSAGE); ...
f8a1589c-352e-49ec-acd9-2ec32a958b19
0
@Override public String getCivilState() { return super.getCivilState(); }
16e6687a-f72c-4ca0-90b7-d50f1b4032e9
5
void allOneDown() { for(int y=_arrows.length-1;y>=0;y--) for(int x=0;x<_arrows[0].length;x++) if(_arrows[y][x]!=null) { if(y==_arrows.length-1) _arrows[y][x]=null; else if(y<_arrows.length-1) { _arrows[y+1][x]=_arrows[y][x]; _arrows[y][x]=null; } } }
3c12a5cd-254a-4719-895d-7d58d5427246
5
public void collision(Robot player) { float eps = (float) 1e-01; float n = player.getTaille(); if ((Math.abs(player.getY() - center.getY()) - (getHeight() / 2 + player .getTaille() / 2)) < eps) { float x_gauche = player.getX() - n / 2; float x_droite = player.getX() + n / 2; float p_gauche = center.g...
0be4536e-14a5-442f-8217-b4d2c028fd27
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
84fbbfe3-c4c0-4c76-98ec-6e8fb94ce28f
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, IsDeleted__typeInfo)) { ...
20cea758-1ba3-4ec1-9a88-aadd0dab1347
7
public boolean connect() throws IOException { if (socket!=null || ircWriter!=null || ircReader!=null) { disconnect(); } String[] channels = getChannels(); // The server to connect to and our details. String server = "irc.wikimedia.org"; String nick = "academic_record"+(int)(Math.random()*1000); ...
d00af5f1-592b-438b-b1a6-9d85c4006e84
3
public void removeIsDead() { for (int index = 0; index < animalFactory.getQuantityOfVictims(); index++) { if (animalFactory.getVictim(index).isDead) { animalFactory.removeVictim(index); if (animalFactory.getQuantityOfVictims() == 0) { Statistic.end...
0bea7f5c-28aa-4c8d-a212-6d182791bdfe
3
public static byte[] readclip(InputStream in) throws java.io.IOException { AudioInputStream cs; try { cs = AudioSystem.getAudioInputStream(fmt, AudioSystem.getAudioInputStream(in)); } catch(UnsupportedAudioFileException e) { throw(new java.io.IOException("Unsupported audio encoding")); } java.io.ByteArra...
38fb849d-c16c-44e5-95d3-e8ffb701c789
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Proceso other = (Proceso) obj; if (this.pid != other.pid) { return false; } r...
9ce5dc11-f1a0-44ef-a89f-b596b22e5f64
3
public BigDecimal getMinimumDifference_as_BigDecimal(){ BigDecimal diff = BigDecimal.ZERO; if(this.type==12){ ArrayMaths am = this.sort(); BigDecimal[] sorted = am.getArray_as_BigDecimal(); diff = sorted[1].subtract(sorted[0]); BigDecimal minDiff = diff; ...
c7b257f2-b630-49d5-8c07-5466484c305d
3
public Object clone() { LinkedTreeMap<K,V> clone = null; try { clone = (LinkedTreeMap<K,V>) super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } // Put clone into "virgin" state (except for comparator) clone.root = ...
177c862c-5381-4098-8437-6903376ac2d2
2
private double[] log10(double[] array){ int n = array.length; double[] ret = new double[n]; this.nPlot = this.nAnalyteConcns; for(int i=0; i<n; i++){ if(array[i]==0.0){ ret[i] = Double.NaN; this.nPlot--; } else{ ...
daa098cf-a25e-4218-a561-fe3b70847ecd
8
public boolean inWild() { if(absX > 2941 && absX < 3392 && absY > 3518 && absY < 3967 || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366) { return true; } return false; }
0cb3fd63-8318-4ad8-b5fc-7a42b5fc7cf0
8
private static String getCombatLevelDifferenceColour(int localLevel, int otherLevel) { int difference = localLevel - otherLevel; if (difference < -9) return "@red@"; if (difference < -6) return "@or3@"; if (difference < -3) return "@or2@"; if (difference < 0) return "@or1@"; if (difference > ...
7279f53a-ed70-42b5-8f15-2e4cf0a7002c
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
6b1b70c2-8c9e-4657-90ba-e04ca75a53da
1
private boolean jj_2_75(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_75(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(74, xla); } }
27b4351a-2609-4615-9c2c-a5d545108889
6
public static Vector<float[]> getPossiblePoints(Vector<int[]> Lines, float[] position, int[] goal) { //Rueckgabevektor Vector<float[]> Aims = new Vector<float[]>(); //Gerade s in Richtung des Ziels konstruieren float[] s = new float[4]; s[0] = position[0]; s[1] = position[1]; s[2] = goal[0] - position...
38d1abed-4410-401e-9b6c-57e9b28c3658
9
static byte EnderChestFix(byte data, String kierunek) { if (kierunek.equals("right")) { if (data == 2) { return 5; } if (data == 4) { return 2; } if (data == 5) { return 3; } if (data == 3) { return 4; } } ...
02b6d5ea-4f17-4e08-b6dd-e70c1ad87f70
4
public static void graficar(double []aptitudProm){ double [] auxiliar ; int cont=0; for(int i=0; i<aptitudProm.length;i++){ if(aptitudProm[i] == 0 && i!=0){ i=aptitudProm.length; } cont++; } auxiliar = new double [cont]; ...
67540bde-98f1-48eb-86e6-6b10adcc5b98
5
private void doVote(int sender, int target) { if (players2.isDead(sender)) { this.sendNotice(sender, "You are dead. You cannot vote."); return; } if (!votes2.hasVoted(sender)) { try { if (target != -1) { if (players2.isDead(target)) { this.sendNotice(sender, "Your choice is already dead."...
cbc7cc4a-c5c3-477f-aa7c-9931252f2463
4
public void linkLayer(final int l1, final int l2) { // final Layer layer1 = this.layers.get(l1); final Layer layer2 = this.layers.get(l2); // for (int i = layer1.arrayslbd; i <= layer1.arraysubd; i++) { final CellArray a1 = this.arrays.get(i); if ((a1.ilct...
2a333a09-bf03-4166-8ad9-1c1b29d68eba
3
@SuppressWarnings("resource") public static void main(String[] args) { ServerSocket server = null; try { server = new ServerSocket(12346); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } while (true) { // transfer location change Single User or Multi User D...
51988796-5007-4377-a093-a3b3cb782a8f
1
public static Session fromSessionId(String sessionId) { if(sessions.containsKey(sessionId)) { Session rtn = sessions.get(sessionId); rtn.recordActive(); return rtn; } else { return newSession(); } }
9e14da9b-908e-407d-a0d0-59f440b9ca18
4
protected int getKnownAttributeCount() { int count = 0; if (sourceFile != null) count++; if (innerClasses != null || outerClasses != null || extraClasses != null) count++; return count; }
e81813a8-3e66-45f9-b0d1-c3eafdc17df3
4
public void draw(Graphics g) { GameTool.drawBackground(g, ImageResource.getBackground()); if (player != null) player.show(g); // show for (Bullet bullet : bullets) bullet.show(g); for (Enemy enemy : enemies) enemy.show(g); for (EnemyBullet eb : eBullets) eb.show(g); }
16b36165-3776-42be-b950-47b1511677cb
6
@Override public boolean equals(Object o) { if((o instanceof Coordinate<?>)) { Coordinate<?> c = (Coordinate<?>) o; return getX().equals(c.getX()) && getY().equals(c.getY()) && getTimestamp()==c.getTimestamp(); } return false; }
c7cf4777-8420-4603-943a-d8389a29cca1
8
public String toString() { if( isCircularError() ) { return "#CIR_ERR!"; } byte b = record[1]; // duh, should have done a switch if( b == ERROR_NULL ) { errorValue = "#ERROR!"; } else if( b == ERROR_DIV_ZERO ) { errorValue = "#DIV/0!"; } else if( b == ERROR_VALUE ) { errorValue = ...
d22f82df-fe38-4b4c-9a52-675bfa5aa8db
6
@Override public void mouseMoved(MouseEvent e) { if (this.circuit.getJBreadBoard().getMode().equals("drawingwire")) { if (WireDrawer.current != null && this.circuit != WireDrawer.current.getCircuit()) { WireDrawer.current.getCircuit().getJBreadBoard().setMode("wire", "Wire Removed. Wiring Mode. Click to Start...
4803139d-0dff-4035-815f-8187549d6715
6
public static IKeyAgreementParty getPartyAInstance(String name) { if (name == null) { return null; } name = name.trim(); IKeyAgreementParty result = null; if (name.equalsIgnoreCase(Registry.DH_KA)) { result = new DiffieHellmanSender(); } else if (name.equalsIgnoreC...
b3fa757b-f426-47a8-8978-1f2c54c96ef5
6
public static boolean compareSubstringHydrated(String ion, int ii){ boolean test = false; if(IonicRadii.hydratedIons1[ii].indexOf(ion)>-1||IonicRadii.hydratedIons2[ii].indexOf(ion)>-1||IonicRadii.hydratedIons3[ii].indexOf(ion)>-1||IonicRadii.hydratedIons4[ii].indexOf(ion)>-1||IonicRadii.hydratedIons5[ii...
27e25bcf-b5a4-455e-bef9-d054019379d9
7
private boolean isBinaryOp(String string) { if(string.replace(" ", "").equals("add") || string.replace(" ", "").equals("sub") || string.replace(" ", "").equals("mult") || string.replace(" ", "").equals("div") || string.replace(" ", "").equals("and") || string.replace(" ", "").equals("or") || string.replace...
9936ec54-a078-42ed-9998-58c31daf98de
5
private void btnGuardarMesaDeDulcesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarMesaDeDulcesActionPerformed // TODO add your handling code here: //Primero obtenemos los datos de la mesa de dulces //y las guardamos en las siguientes variables: //Primero obt...
72213c2c-36c2-4dc0-ac49-26334f1ea43b
7
private boolean flagienMaaraOikein(int x, int y) { Solu solu = kentta.getSolu(x, y); int miinaLippuja = 0; for (int i = x - 1; i < x + 2; i++) { for (int k = y - 1; k < y + 2; k++) { if (onKartalla(i, k) && kentta.getSolu(i, k)==solu) { k+...
baab4523-ce71-4aa6-ad09-f8f64b652995
2
public void setOrdByTag( String tag ) { I = -1; for(int i=0; i<TagNames.length; i++) if(tag.toUpperCase().equals(TagNames[i])) I=i; nNode = 0; nKey = 0; sRecno = 0; found = false; }
78014537-0073-4f96-9a4a-e5649c9c9d2d
8
public static Graph readFromInputFile(String fileName) { BufferedReader bufferedReader = null; Graph userInputGraph; try { String currLine; bufferedReader = new BufferedReader(new FileReader(fileName)); int lineNumber = 0; int vertices = 0; int edges = 0; int vertice1 = 0; int vert...
3d8e44ea-62df-4f55-9ca6-938a724e2b6d
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...
7b877f70-7c44-4fff-b451-9e03a5f33538
5
public void loadProperties(Element currentElement, Graph graph, DiagramPanel window) { nameText.setEnabled(true); widthText.setEnabled(true); heightText.setEnabled(true); this.element = currentElement; heightText.setEnabled(true); widthText.setEnabled(true); //thi...
2f6a0520-4cfb-421e-8bf8-de8d5cf9c7ff
9
public void update(Observable o, Object arg) { SessionInfo sessionInfo = (SessionInfo) arg; if (sessionInfo.getOutput() != null) { XStream xstream = new XStream(); logger.debug("Message from server: " + sessionInfo.getMessage() + " from XML"); String message = session...
13cbb45d-0b36-4aa7-9db4-80ce08a75124
4
void updateAnsSet(String s, int a, int b) { for (int i = 0; i < checkSet.length; i++) { if (!checkSet[i]) { continue; } if ((getA(s, answerSet[i]) != a) || (getB(s, answerSet[i]) != b)) { checkSet[i] = false; } } }
6d0aedb5-2761-4c1a-b404-be5e92f53a2e
8
public void SetConsoleColor(Color newcolor) { if (newcolor == Color.BLACK) { System.out.print("\033[30m"); } else if (newcolor == Color.WHITE) { System.out.print("\033[39m"); } else if (newcolor == Color.RED) { System.out.print("\033[31m"); } else if (newcolor == Color.GREEN) { System.out.print(...
554ac699-da33-4b79-aa8e-6a9461fae222
5
public Behaviour jobFor(Actor actor) { if ((! structure.intact()) || (! personnel.onShift(actor))) return null ; if (actor.vocation() == Background.SOMA_VENDOR) { final Service needed[] = { SOMA, CARBS, PROTEIN } ; final Delivery d = Deliveries.nextCollectionFor( actor, this, needed, 5, null...
302e1f77-0c7e-4a6d-9799-05aea727cc62
1
@Override public void handleResult() throws InvalidRpcDataException { String result = getStringResult(); if (result.equalsIgnoreCase(STATUS_STRING_OK)) { EventBusFactory.getDefault().fire(new RemoteDownloadsChangedEvent()); } else { // TODO: handle ...
e7f5c6c4-9217-465c-b3da-d8ca0fb9e36b
4
@Override public boolean valid() { if (super.valid()) { if (!getAncestor().isEmpty()) { return !updateAbilities().isEmpty(); } if (ctx.combatBar.expanded()) { ctx.sleep(600); if (ctx.combatBar.expanded(false)) { ctx.sleep(600); } } } return false; }