method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9045468b-9093-41e3-89f8-5835c26ec2c2
9
private int defaultResultType(char convertCode) { switch (convertCode) { case 'i': case 'o': case 'd': case 'x': { return Record.LONG; } case 'c': { return Record.CHAR; } case 'v': case 'b': { return Record.BOOLEAN; } case 'f'...
d126e0fa-91c2-4703-a5ba-0acb5bb3a6e3
2
public int getMaxProfit(ArrayList<Transaction> transByDate) { int maxProfit = 0; for (int i = 0; i < transByDate.size(); i++) { if (transByDate.get(i).profit > maxProfit) maxProfit = transByDate.get(i).profit; } return maxProfit; }
acc696a0-db7f-48a2-ad73-a54fd3690ba2
0
@RequestMapping(value = "/room-event-slides-list/{roomEventId}", method = RequestMethod.GET) @ResponseBody public CreativeMaterialListResponse roomEventSlidesList( @PathVariable(value = "roomEventId") final String roomEventIdStr ) { return typedCreativeMaterialList(roomEventIdStr, Creati...
8c7f71ab-0522-43ad-b8ac-4c991e08f223
4
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == inicialView.getjButtonSair()) { int fecha = JOptionPane.showConfirmDialog(null, "Deseja fechar o sistema?", null, JOptionPane.YES_NO_OPTION); if(fecha == JOptionPane.YES_OPTION) { System.exit(...
8c092118-8f97-427b-8bfb-2bd3843baaac
7
static public final String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String s = Double.toString(d); if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < ...
219af710-6fd9-4a5f-acc9-84fa0fa86c42
1
public void setStatustextFontsize(int fontsize) { if (fontsize <= 0) { this.statustextFontSize = UIFontInits.STATUS.getSize(); } else { this.statustextFontSize = fontsize; } somethingChanged(); }
80dead31-3ea6-4457-99b0-340589d22323
9
public void createMonster(){ Random numGenerator = new Random(); int i = 0; while(i < maxNumOfMonsters){ int xPos = numGenerator.nextInt(79); int yPos = numGenerator.nextInt(23); int n = (int)(Math.random()*monsterPieces.length); if(floor[xPos][yPos]==null...
2037b0a7-4227-46f8-9d35-c19087281401
3
public List<Position> getAlleEreichbarenNachbarn(Position position) { List<Position> erreichbarePositionen = new ArrayList<Position>(); int[][] erreichbar = new int[7][7]; erreichbar[position.getRow()][position.getCol()] = 1; erreichbar = getAlleErreichbarenNachbarnMatrix(position, erreichbar); for (int i = 0...
17ab2482-3413-4b1e-aca3-8314a30e2341
3
public void initialize() { Debug.println("Cannon initialize()"); if (GameApplet.thisApplet != null) { Enumeration localEnumeration = getEnvironment().getObjects().elements(); while (localEnumeration.hasMoreElements()) { PhysicalObject localPhysicalObject = (PhysicalObject)localEnu...
1fcf70ad-f7b6-41a9-9a06-0c75dbc40eaf
6
@Override public boolean equals(Object obj) { boolean res = false; if (obj instanceof ProtectionEntry) { ProtectionEntry other = (ProtectionEntry) obj; if ((this.propertyTableNameId == null && other.propertyTableNameId == null) || (this.propertyTableNameId != null && (this.propertyTableNameId....
2a0bdb49-9282-4ccc-bd42-83951d10a736
0
@Id @Column(name = "name") public String getName() { return name; }
2b627645-c907-4ced-aba9-61b2a0f3fb74
7
public static boolean nullWrapperP(Stella_Object self) { { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_THING)) { { Thing self000 = ((Thing)(self)); return (self000 == null); } } else if (Surrogate...
fc255c0d-8cbd-4764-bd71-b539e8731638
5
private Type type() { Type t = null; if(currentToken.type() == Token.Type.Int) t = Type.INT; else if(currentToken.type() == Token.Type.Bool) t = Type.BOOL; else if(currentToken.type() == Token.Type.Float) t = Type.FLOAT; else if(currentToken.type() == Token.Type.Char) t = Type.CHAR; else if(c...
5a339b92-0ee7-4f9c-b8d1-9f91d729eda8
3
@Override public Vehicule getVehicule(String vId) throws BadResponseException { Vehicule v = null; JsonRepresentation representation = null; Representation repr = serv.getResource("intervention/" + interId + "/vehicule", vId); try { representation = new JsonRepresentation(repr); } catch (IOException...
5714965d-015c-436c-b780-b0a8f2f4ca0d
7
public void libreta(int cc,Date min) throws IOException{ rLog.seek(0); double tDeposito = 0,tRetiro=0,tInt=0,tAct=0; boolean tiene1 = false; while(rLog.getFilePointer() < rLog.length() ){ int cod = rLog.readInt(); double m = rLog.readDouble(); ...
8f0ca036-3142-405d-bffb-b4aeeed167aa
2
@Override public void keyPressed(KeyEvent e) { // On fais tourner le bateau selectionner si c'est possible if(e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_LEFT) { this._partie.rotationBateau(); } } // keyPres...
90dbe98a-aa41-412d-95d7-74fdbd953c6c
5
private void loadMouse() { mouseList.clear(); for (Class<?> clz : MouseLoader.load()) { try { Constructor<?> struc = clz.getConstructor((Class<?>[])null); Mouse mouse = (Mouse)struc.newInstance(); MouseController controller = new MouseController(mouse); controller.setNumberOfBombs((int...
70907352-2668-45ee-a00d-aa5798a9bbc4
4
public double evaluateState(StateObservation stateObs) { boolean gameOver = stateObs.isGameOver(); Types.WINNER win = stateObs.getGameWinner(); double rawScore = stateObs.getGameScore(); if(gameOver && win == Types.WINNER.PLAYER_LOSES) return HUGE_NEGATIVE; if(gameO...
c5b3fae4-b9be-4bc3-9260-9dcf957d1b0c
2
private static float[][] generateSmoothNoise( float[][] baseNoise, int octave ) { int width = baseNoise.length; int height = baseNoise[0].length; float[][] smoothNoise = new float[width][height]; int samplePeriod = 1 << octave; // calculates 2 ^ k float sampleFrequency = 1.0f / samplePeriod; for ( int i...
5fe1cbed-b573-4b9c-8790-2c4204c93701
0
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton5ActionPerformed {//GEN-HEADEREND:event_jButton5ActionPerformed world.choiceMade("left"); }//GEN-LAST:event_jButton5ActionPerformed
ced6d614-ca2b-485c-926f-315f18778725
7
public static void cleanUp () { ModPack pack = ModPack.getSelectedPack(); File tempFolder = new File(OSUtils.getCacheStorageLocation(), "ModPacks" + sep + pack.getDir() + sep); for (String file : tempFolder.list()) { if (!file.equals(pack.getLogoName()) && !file.equals(pack.getImageN...
5f03a5f7-f152-46a9-8c27-86160bab6590
4
@Override public boolean equals(Object obj) { // TODO Auto-generated method stub if(obj instanceof Edge) { Edge e=(Edge)obj; if(e.u==u&&e.v==v&&e.weight==weight) return true; } return false; }
30376001-57f1-4961-9248-8808684ffcb6
7
public void test(){ assert state == State.OK; // get the internal thread number int i = getInternalThreadId(); // activate setState(i, State.GUARD); try{Thread.sleep(1+i);}catch(Throwable ignore){}; // guard if( getState(i+1) != State.IDLE ){ setState(i, State.WAIT); } else{ setS...
c74766c9-598b-42c7-a01b-5b20ab158137
1
private int randomSwitchDirection() { int i; i = (int) Math.floor(Math.random() * 10 + 1); if (i > 5) { return -1; } else { return 1; } }
c1a226c3-d16b-4700-8326-c5bce34d57f0
7
public Drawable findNearestClass(int x, int y) { //Set the local variables required for the comparison Drawable d = null; double minDist = Double.MAX_VALUE; int minDistIndex = -1; //Loop through the vector for(int i=0; i < getDrawable().size(); i++) { //Set 'd' as the next 'Drawable' object d = (Dr...
70e39cb8-d725-4851-9e31-79e93af41233
8
public WellArchetype getWellManager(World world, Random random, int chunkX, int chunkZ) { // get the list of wells if (wells == null) wells = new Hashtable<Long, WellArchetype>(); // find the origin for the well int wellX = calcOrigin(chunkX); int wellZ = calcOrigin(chunkZ); // hex offset... finall...
2528da27-d76b-4d0e-85ae-09b739f22d8e
6
@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 Task)) { return false; } if(object == this) { return false; } Task other = (Task) object; ...
75cd4877-97d7-4723-a383-c05c6ba3575a
8
public void doNextRound() { sayRoundStatus(); if (!isStunned(player)) { if (!multiRoundActionOnQueue(player)) { if (playerHasAnotherAction()) { choosePlayerAction(); } else { System.out.println("You have no actions left!"); } } } else { System.out.println("You are stunned and cannot...
3168c5df-b2b6-4452-8592-c270a0f90121
5
public void next() { // check for concurrent modification if(expectedModCount != modCount) throw new ConcurrentModificationException(); // go to next entry in chain, if it exists current = current.nextEntry; if (current == null) { // at end of chain; go to next cell containing an ent...
d25ae03b-f9d7-4400-bf6b-0853920ff729
7
private void parseArguments(String url,Processor processor) throws IllegalArgumentException{ //can be convert from string? Class<?>[] parameterTypes = processor.getMethod().getParameterTypes(); for(Class<?> parameterType : parameterTypes){ if(!ConverterFactory.canConvert(parameterType)){ throw new IllegalA...
02d4c1a2-0b65-479e-bcac-4e80733b3837
7
public void readFrom(org.jdom.Element element) { Element mainConfigElement = element.getChild(PREF_CHILD_ELEMENT); if( mainConfigElement == null ) { postUrl = "http://localhost/" ; return ; } defaultChannel = mainConfigElement.getChildText(PREF_KEY_SLACK...
90e0b18e-5026-4543-b513-c28b5f67c252
6
public void qckSort(Card [] cardArray, int left, int right){ Card pivot = cardArray[left + (right - left) / 2]; int leftable = left; int rightable = right; while (leftable <= rightable){ while(cardArray[leftable].compareTo(pivot) < 0 ){ leftable++; } while(...
004e9834-3a88-479c-a61a-db32e9d9747b
3
public CafeRoot(String title) throws IOException { // Frame-Initialisierung super(title); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Properties spielstand = Spielstart.loadProperties("spielstand.txt"); int frameWidth = 600;//506 int frameHeight = 600;//434 setSize(frameWidt...
722b03b9-be5a-4c13-8ebb-df73b466bfc9
8
final public IndexList IndexList() throws ParseException { NodeList list = new NodeList(); Token implied_t; Identifier identifier; Token comma_t; boolean implied; implied = false; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMPLIED_T: implied_t = jj_consume_token(IMPLIED_T); ...
fa9e4220-951d-4275-816b-6d7a22947198
8
public Events getNotes(Events events) { try { crs = qb.selectFrom("notes").all().executeQuery(); String eventID = null; String note = null; boolean active = false; while(crs.next()) { eventID = crs.getString("eventID"); if(eventID == null) { eventID = crs.getString("cbsEventID"); } ...
376e99d7-86bb-4526-86af-b5f19c226078
3
public void visitLdcInsn(final Object cst) { mv.visitLdcInsn(cst); if (constructor) { pushValue(OTHER); if (cst instanceof Double || cst instanceof Long) { pushValue(OTHER); } } }
0cc34617-ad6a-4670-8f00-8cd4c1f4d559
2
private void connectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed IP = ipField.getText(); nickname = "[" + nickNameField.getText() + "] "; if ("".equals(IP) || "".equals(nickname)) { displayMessage("You must enter a valid IP and...
979e1b92-ad48-4425-8b6b-4638b8ef3aad
7
public Expr EqExpr() throws ParseException { Token tok; Expr e, er; e = RelExpr(); label_8: while (true) { switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) { case 169: case 170: break; default: ...
d2ec89fd-a934-4654-a53d-99a0c165eec1
4
public List<String> readStringSubKeys(String key) { try { List<String> results = new ArrayList<>(); OpenResult openResult = openKey(key, READ_ACCESS); if (openResult.mSuccess) { QueryResult queryResult = queryInfoKey(openResult.mHandle); for (int i = 0; i < queryResult.mCount; i++) { if (METHOD_...
f576d182-f40f-4810-83c0-07f250e97ab6
4
static String getPlatformFontFace(int index) { if(SWT.getPlatform() == "win32") { return new String [] {"Arial", "Impact", "Times", "Verdana"} [index]; } else if (SWT.getPlatform() == "motif") { return new String [] {"URW Chancery L", "URW Gothic L", "Times", "qub"} [index]; } else if (SWT.getPlatform() == "...
5b61cd3e-afae-45d9-9aec-61aa2b48376c
7
@Override public String makeMobName(char gender, int age) { switch(age) { case Race.AGE_INFANT: case Race.AGE_TODDLER: return name().toLowerCase()+" pup"; case Race.AGE_CHILD: switch(gender) { case 'M': case 'm': return "boy " + name().toLowerCase() + " pup"; case 'F': ca...
3da30e1b-b096-4b70-8089-d5e906f67a09
7
@Override public void run() { if (!Config.toxicEnabled) return; World w = plugin.getServer().getWorld(Config.worldToUse); if (w == null) return; for (Player p : w.getPlayers()) { PConfManager pcm = PConfManager.getPConfManager(p); if (!pcm.getBoolean("toxicspr...
77eae651-c0ff-4b50-8b75-d13abe7fb0f2
9
private void moveColumn(Board b, int caller) { int posNr = 0; Position tmp = null; int i, j; int foundPos = -1; i = j = 1; while (i <= b.getWidth()) { j = 1; while (j + 1 <= b.getHeight()) { if (b.isFree(i, j) && b.isFree(i, j + 1)) { b.set(i, j); b.set(i, j + 1); foundPos = pos.sea...
c007d73a-4c4b-489e-a900-af5c0c999561
1
public void addFeatureVector(FeatureVector featureVector) throws Exceptions.FeatureTypeNotFoundException { for (Entry<String, String> pair : featureVector.getFilteredPowerSet(FeatureTypes.getUsedFeatures()).entrySet()) { incCount(pair.getKey(), pair.getValue()); totalCount++; } }
4cf46663-54e4-4b09-9ce7-d4c7a3298d1a
2
public void setPWfieldMargin(int[] margin) { if ((margin == null) || (margin.length != 4)) { this.pwfield_Margin = UIMarginInits.PWFIELD.getMargin(); } else { this.pwfield_Margin = margin; } somethingChanged(); }
6c706391-782b-4bfd-9eb7-08f07234de6f
0
public void setItemCostPrice(BigDecimal itemCostPrice) { this.itemCostPrice = itemCostPrice; }
d2b70217-4a46-45df-9f27-df1468de02f9
2
public void getTest() { try { URL url = new URL(this.url); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(45000); conn.setReadTimeout(45000); Date d = new Date(); conn.connect(); getStatus = conn.getResponseCode...
037b70fa-6f2a-4520-9d9f-421e52ce09b8
7
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); if (alphaImg1 == null) { alphaImg1 = GraphicsExample.loadImage(device, GraphicsExample.class, "alpha_img1.png"); alphaImg2 = GraphicsExample.loadImage(device, GraphicsExample.clas...
07727690-6917-41c1-bebb-b73b8676ef58
3
@Override public void render(GameContainer container, StateBasedGame sbg, Graphics g) throws SlickException { background.draw(0,0,Button.GAME_WIDTH,Button.GAME_HEIGHT); ttf.drawString(600, 10, "SCORE : "+score); ttf.drawString(300, 10, "TIME : "+(int) time); if(count > 0 && time%10 >= 7){ bonusButton.draw(g...
149b0e2d-ae48-4571-a2e3-65de46b4ee24
3
public void drawCenteredStringMoveY(String string, int x, int y, int color, int waveAmount) { if (string == null) { return; } x -= getTextWidth(string) / 2; y -= baseHeight; for (int index = 0; index < string.length(); index++) { char c = string.charAt(index); if (c != ' ') { drawCharacter(charac...
0a303091-01b5-421c-9e3a-4bdbbe841b4c
3
private void refreshDurationField() { final Color defaultColor = Color.BLACK; final Color errorColor = Color.RED; if (startTimeDateChooser.getCalendar() == null) { startTimeDateChooser.setCalendar(Calendar.getInstance()); } if (endTimeDateChooser.getCalendar() == null) { endTimeDateChooser.setCalen...
424fda79-d35d-4a6f-9fc1-c0a39e6db9f5
4
public void paint(Graphics g) { Dimension d = getSize(); g.drawImage(icons, border, border, iconW + border, iconH + border, 0, iconIndex * iconH, iconW, (iconIndex + 1) * iconH, null); if (mouseOver && !mousePressed) { g.setColor(Color.orange); } else if (selected || mousePressed) { g.setColor(Color....
2b8ee2e3-562c-4f2f-8753-d6ca8e99c6fa
2
public void setPassword(String password) { password = password.trim(); if ( password.isEmpty() ) { throw new RuntimeException( "'password' should not be empty" ); } if ( password.length() < 6 ) { throw new RuntimeException( "'password' cannot be of less than...
505b868d-c27d-4a3d-baa6-aaf8ba652cda
4
public void setZoom(int zoom) { if (zoom == this.zoomLevel) { return; } TileFactoryInfo info = getTileFactory().getInfo(); // don't repaint if we are out of the valid zoom levels if (info != null && (zoom < info.getMinimumZoomLevel() || zoom > info.getMaximumZoomLevel())) { return; } // if(zo...
ce0155b4-5742-4eae-9360-a050632a0f85
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 Prioridade)) { return false; } Prioridade other = (Prioridade) object; if ((this.codprioridade == null && other...
e8f28af6-e933-4802-9b37-7d9c3bd516d7
7
@SuppressWarnings("deprecation") @EventHandler public void onHit(EntityDamageByEntityEvent e) { if (((e.getEntity() instanceof Player)) && ((e.getDamager() instanceof Arrow))) { Arrow arrow = (Arrow)e.getDamager(); if ((arrow.getShooter() instanceof Player)) { Player attac...
023df95b-1836-492d-bc00-511d7a402f6c
3
public City(Civilization owner,Point start,int population,int id,int maxSize) { LAND=new ArrayList<Point>(); LAND.add(start); CENTER=start; //growthRate=owner.growthRate; //growth=owner.getPreference(start)*growthRate/100; this.population=population; this.owner=owner; this.id=id; startYear=owner.WORLD...
f4ad5c25-40b2-4342-ab2d-bc481b51aca3
3
public void next(int width, int height) { if (nextIndex+2 < nextCoord.size()) { nextIndex = (nextIndex+2)%nextCoord.size(); xcoord = ((Integer)nextCoord.get(nextIndex)).intValue(); ycoord = ((Integer)nextCoord.get(nextIndex+1)).intValue(); } else { // stop animation setAnimation(false); isDone = true; }...
d3490e04-2695-4b6d-bcdb-b1a573e0a44e
1
public ReplaceVisitor(final Node from, final Node to) { this.from = from; this.to = to; if (Tree.DEBUG) { System.out.println("replace " + from + " VN=" + from.valueNumber() + " in " + from.parent + " with " + to); } }
acf2b673-ed18-49e2-8176-6e2f4b158720
2
private void addOwnerIfConfirm() { if (isUserConfirm(getConfirm())) { try { new OwnerServiceImpl().add(model); logger.info("New owner ({}) successfully inserted to table {}.owners", model, JdbcInfo.getInstance().getDbName()); } catc...
ba9753a4-f446-48c8-8fa5-7ac892d9d206
0
public void setCategoryId(int categoryId) { this.categoryId = categoryId; }
b2c49030-663e-4ae5-a93a-9f8a42aeb827
4
@Override public String toString(){ ArrayList<String> dep = new ArrayList<String>(); if(dependances != null){ for(Tache t : dependances){ dep.add(label); } } if(datePlusTard == -1|| datePlusTot == -1){ return label+dep+"[ durée: "+d...
51cdda14-6fc1-4cd0-a295-1085c0ab27b0
7
public void testConstructor_int_int_int_Chronology() throws Throwable { YearMonthDay test = new YearMonthDay(1970, 6, 9, GREGORIAN_PARIS); assertEquals(GREGORIAN_UTC, test.getChronology()); assertEquals(1970, test.getYear()); assertEquals(6, test.getMonthOfYear()); assertEquals(9...
fe5eb270-1b27-457a-a1ac-0e71029c094a
2
@Override public void actionPerformed(JTable table) { final MediaElement[] selected = getSelected(table); if (table != null || selected.length > 1) new FilePlayer(selected).execute(); else new FilePlayer(media).execute(); }
f34d5068-38c4-41e4-a74e-ad8c3efbb050
4
public void body() { // a loop that is looking for internal events only Sim_event ev = new Sim_event(); while ( Sim_system.running() ) { super.sim_get_next(ev); // if the simulation finishes then exit the loop if (ev.get_tag() == GridSimTags.END_O...
ce26ba79-8499-422f-a7ce-028bd0f6ce1b
9
void skipComment(final Input in) { try { final String rest = in.restOfLine(); if (rest.startsWith(lineCommentStart)) { next(in, lineCommentStart.length()); while (in.unlessEof()) { final char c0 = in.current(); if (c0 == CR) { final char c1 = in.next(); if (c1 == LF) { in.ne...
bf48f559-86dd-4c0b-8e8c-7f745db7cd72
7
public boolean validMove(int targetX, int targetY, boolean color) { if (Board.onBoard(targetX, targetY) && ((curX == targetX) && ((targetY == curY + 1) || (targetY == curY - 1)) || ((curY == targetY) && ((targetX == curX + 1) || (targetX == curX - 1))))) { return true; } return false; }
013b0061-1837-49e9-926c-c840b55574e6
8
public static void compareFiles(String filePath1, String filePath2, List<String> messageDeliverOrder) { System.out.println("Comparing " + filePath1 + " and " + filePath2 + " by thread " + Thread.currentThread().getName()); try { BufferedReader bufferedReader = new BufferedReader(new FileRead...
b3e9dea6-46e7-4428-b563-7eabaac5d527
2
private void inviteToChannel(ChatChannel channel, ProxiedPlayer player, CommandSender sender) { if (player != null) { if (channel.containsMember(player.getName())) { String msg = plugin.CHANNEL_IS_MEMBER; msg = msg.replace("%player", player.getName()); msg = msg.replace("%channel", channel.getName()); ...
ec6d65f7-0403-49a5-98e0-611ae556a23a
6
private boolean is_assigned(CPA cpa) throws Exception { boolean assignmets_constraied = false; int k = -1; for (int i = 0; i < Domain.length; i++) { k++; k = find_next_possible_assignment(k); if (k == -1) { return false; } Assignment assignment = new Assignment(this._id, k); for (int j = 0; ...
ce7a4b4b-904e-460e-8d0b-382fb017b1c7
2
@Override public boolean equals(Object obj) { return obj != null && obj instanceof ShopItem && ((ShopItem) obj).getSlot() == getSlot(); }
3afa4f42-9f86-4bda-bb52-b58a98e61acc
3
public void compile(ClassFile cf) { if ((code==17) || (code==18)) { chi[0].compile(cf); cf.code(code-(17 - 0xF4)); // logical_param AND/OR chi[1].compile(cf); cf.code(code-(17 - 0xF6)); // logical_end AND/OR } else { chi[0].compile(cf); cf.code(0xFA); // ensure value; ...
7b839a5a-e6b2-4150-b827-682551ce2b71
8
public String[] generateDeck(String args){ Random r = new Random(); int size = r.nextInt(31) + 60; String[] deck = new String[size]; if(args.compareToIgnoreCase("random") == 0){ for(int i = 0; i < size; i++){ int num = r.nextInt(13); if(num % 3 == 0){ switch(num){ case 0: deck[i]...
f618113b-5962-4c5e-b97f-e546814c0650
4
private static Object[] parseTask(StringTokenizer str) { String taskName = str.nextToken(); Object[] task = null; if (taskName.equals("get")) { task = new Object[2]; task[0] = new Integer(0); task[1] = str.nextToken(); } else if (taskName.equals("repl...
35c49f91-b791-43f6-b353-9323ac35f133
5
public void run() { while (true) { try { logger.debug("Waiting for new message"); permits.acquire(); Message msg = queue.poll(); if (msg == null) { logger.error("Received null message from the queue, programming error??? Ignoring the message"); break; } if (msg == poison...
a49a5058-9608-4557-888b-cb284235f7be
9
public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(); int k = Reader.nextInt(); int[] a = new int[n+1]; int[] pos = new int[n+1]; for (int i = 0; i < n; i++) { int x = Reader.nextInt(); ...
bdc0a26a-2127-403e-a8de-72e302f9b9b7
0
public void setMusicType(MusicTypes musicType) { this.musicType = musicType; }
c74a7f25-0ba7-41e6-9f52-9b2806f356dc
5
private void drawBar() { GL11.glColor3f(color2[0], color2[1], color2[2]); GL11.glBegin(GL11.GL_QUADS); if (isDouble != 1) { switch (orientation) { case Tile.UP: GL11.glVertex2f(x,y); GL11.glVertex2f(x + width,y); GL11.glVertex2f(x + width,y + length - barLength); GL11.glVer...
6e30d421-652c-4d2a-8b72-37149b74475f
9
private void refreshDialog() { String nr = currentAccountNumber(); accountcombo.removeAllItems(); if (bank != null) { try{ Set<String> s = bank.getAccountNumbers(); ArrayList<String> accnumbers = new ArrayList<String>(s); Collections.sort(accnumbers); ignoreItemChanges=true; for(String ite...
6efbc000-4719-48da-b39a-ec13e2fc8d8d
1
public List<T> getAllItems() { List<T> list = new ArrayList<>(); for(IAliasedItem<T> item : backingMap.values()) { list.add(item.getItem()); } return list; }
46cd93b9-5313-4f06-b500-2e39b3e8f7a4
3
public static void toggleMoveable(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleMoveableForSin...
28efb53d-12af-44c1-97fc-495b1df47e62
1
private void fineUser(Criteria criteria, AbstractDao dao) throws DaoException { Criteria bean = new Criteria(); bean.addParam(DAO_ID_USER, criteria.getParam(DAO_ID_USER)); bean.addParam(DAO_USER_SELECT_FOR_UPDATE, true); List<User> users = dao.findUsers(bean); if (users.isEmpty()...
2f5e3910-3141-4952-8fa6-88dfdf8a6da7
9
private void setAdjacentNumbers() { //top two for loops iterate through the board and pass each cell into the second two for loops, which check each cell adjacent to the cell for a mine for (int x = 0; x<boardSize; x++) { //this is to iterate through each cell for (int y = 0; y<boardSize; y++) { for (i...
a3c58aca-e5c6-4b76-8bbf-2554d33caa2e
3
private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStartActionPerformed // nanoPosts.clear(); tabs.setSelectedIndex(1); DefaultTableModel model = (DefaultTableModel) tableSync.getModel(); int rows = model.getRowCount(); for (int i = rows - ...
c5f0a813-59ff-43ce-820e-65ed9684a9ed
1
public void clearConversations() { for(String user : mMessageWindows.keySet()) { mMessageWindows.get(user).setVisible(false); } mMessageWindows.clear(); }
69371f66-e4c6-41b1-86c1-cc83bbf6eb9c
6
@Override public void paint(Graphics windowGraphics) { if (windowGraphics == null) return; windowWidth = getWidth(); windowHeight = getHeight(); if (frontImageBuffer == null) { // no image to display windowGraphics.clearRect(0, 0, windowWidth, windowHeight); return; } synchronized (Zen.class) ...
a6ee19b9-a618-48e2-9826-2338fd60dabc
4
public static int firstEmptyPosition(Board board, int col) { int row = Board.MINHEIGHT; //Error-checking if (!Util.isColumnValid(board, col)) { //Column is out of bounds row = Util.ERRORTHRESHOLD; } else { while ((row <= board.getHeight()) && (board.getPosition(col, row) == Counter.EMPTY)) { ...
841b7d0e-ddb9-4cd1-bd61-4d6c99af0323
4
@Override public void updateBounty(Bounty bounty) throws DataStorageException { try { PreparedStatement ps = getFreshPreparedStatementColdFromTheRefrigerator("UPDATE bounties SET issuer = ?, hunted = ?, reward = ?, created = ?, hunter = ?, turnedin = ?, redeemed = ? WHERE id = ?"); p...
b9ae7897-5261-4d25-9188-ec3cc48549a0
1
@Test(expected = InstanceNotFoundException.class) public void removeInexistentActivityTest() throws InstanceNotFoundException { Activity activity = null; try { activity = activityService.find(0); } catch (InstanceNotFoundException e1) { fail("Activity not exist"); } activityService.remove(activity); ...
3d17f385-e5b1-4cb9-a7cb-d6557baf3ee0
3
public boolean deleteDirOrFile(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDirOrFile(new File(dir, children[i])); if (!success) return false; } } boolean estSupprime = dir.delete(); System.out.p...
8140ffda-6a18-44e3-a379-b0af2642b599
8
void computeCubicCoefficients(int n, double[][] C) { double[][] H = Geometry.Hermite; for (int j = 0 ; j < dd[n].length ; j++) vec[j] = dd[n+1][j] - dd[n][j]; double cordLength = norm(vec, dd[n].length); double scale = 1.0; if (isFunction()) scale = Math.max(0.25, Math....
d75a9538-2ff6-4943-bc2b-db479c116209
7
private void tick() { if (network.hasUnreadDTOs()) synchronizeEntities(network.getUnreadDTOs()); if (network.hasClientDisconnected()) removeDisconnectedClientEntities(network.getClientDisconnectedId()); List<Long> deletedEntities = new ArrayList<>(); for (Entity e : entityMap.values()) { e.tick(this)...
b44ad883-f644-4263-a6e6-2c64c0a9d66f
9
public int run(String[] arg) throws IOException, ClassNotFoundException, InterruptedException { // //First Job, here the algorithm is ran Configuration prefixconf = new Configuration(); String support = arg[1]; prefixconf.set("Support", support); Job PrefixSpan = new Job(prefixc...
05ddf19b-579f-4c57-b9a7-dc76ab11a4dd
2
@Override public boolean activate() { return (Bank.isOpen() && !Widgets.get(13, 0).isOnScreen() && Settings.usingFlask ); }
04a4e5fb-fc11-46e2-b997-64ba43cc1876
7
private void statement(Symbol function) throws ParserException { enterRule(NonTerminal.STATEMENT); if (have(NonTerminal.ASSIGNMENT)) assignment(); else if (have(NonTerminal.INPUT)) input(); else if (have(NonTerminal.OUTPUT)) output(); else if (have(NonTerminal.IF_STATEMENT)) ifStatement(); else...
7c36299a-a35f-44a4-9ca2-7c3b59035ced
0
public Set<String> getBranches() { return branches; }
f7768172-4cf4-40c0-a225-e12fe88bdfc0
0
public boolean getLeftKeyPressed() { return leftKeyPressed; }
8d298874-4cee-498b-ac32-9dd18cf10831
4
public void updateRecord(Record in) throws SQLException { // First get the format number int formatNumber = in.getFormat().save(); // Get the new category number int catNum = in.getCategory().save(); // Add the record itself updateRecord.setString(1, in.getTitle()); update...
5186ae66-2954-45d5-9ad2-1a0c91998c3f
1
public Integer[] nextIntArray() throws Exception { String[] line = reader.readLine().trim().split(" "); Integer[] out = new Integer[line.length]; for (int i = 0; i < line.length; i++) { out[i] = Integer.valueOf(line[i]); } return out; }
3642f964-5718-4e14-a255-ad49066aba44
3
public void paintComponent(Graphics g){ super.paintComponent(g); // if(this.isFocusOwner()){ for( int i = 0; i < attachRods.size(); i++){ attachRods.get(i).paintComponent(g); } for( int i = 0; i < attachPoints.size(); i++){ attachPoints.get(i).paintComponent(g); } if(!placeRod){ Po...