method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9ea06b35-912a-4a45-abbe-1b1b32cf0c2d
5
public Records fetch() throws IOException { int retryCount = 0; final QueryStatistics.Measurer statTracker = new QueryStatistics.Measurer(); statTracker.recordQueryPrepStart(); PreparedStatement preparedStatement = getPreparedStatement(); statTracker.recordQueryPrepEnd(); while (true) { t...
e6bd221e-1e61-4ae2-ac91-e8597ee0e193
5
public List<MoveElementEvent> reconstruction() { Map<Integer, Point2D> oldPositions= buildOldPositions(); for (ITreeStructure structure : newChangeStructure) { ElementInfo currentNodeInfo = manager.getElementInfo(structure.getId()); ElementInfo parentInfo = manager.getElementIn...
6b77d38a-6f5b-4eaf-8d6c-e5edd2397020
2
public SAXParserCPU(){ //Apenas para testes if(ARQUIVO_HOSTS_FIXO){ //Busca pela tag <host ... /> no arquivo XML // //Uso uma lista porque nao sei quantos hosts podem ser retornados Arquivos arquivo = new Arquivos(); java.util.ArrayList listaHosts = processar("getCPU", arquivo.CAMINHO_BASE_DADOS); /...
3582ffb6-ae45-474d-a7c9-816fb26c6bd2
2
public void giveWeapon() { int material1 = weapon.getMaterial1(); int material2 = weapon.getMaterial2(); int enchantment = weapon.getEnchantment(); weaponStrength = material1+material2+enchantment; updateDamage(); returnValues(); if(damage > 20) { ...
81f668ae-bff9-4893-a5eb-fccfbef79579
1
public boolean isBalanced(BTPosition<T> current) { if (checkHeight(current) == -1) return false; else return true; }
6268c6da-5090-40f1-8cc0-627438c10df1
5
private boolean readObjectMember() throws IOException, JSONSyntaxException { if( !this.skipWhitespace() ) throwJSONException( "Unexpected token: " + this.describeCurrentToken() + ". Expected object member or end of object '}'." ); if( this.currentChar == '}' ) { return false; } this.fireMember...
27964518-3d9f-4b17-a4a7-4e8ef57d44bc
2
@Override public void Insertar(Object value) { Session session = null; try { Cuentas cuenta = (Cuentas) value; session = NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(cuenta); session.getTransa...
a306c20d-05e9-4d16-bb27-56a5471a58ed
5
public int removeDuplicates(int[] A) { int length = A.length; int i = 0; int j = 0; int k,deta; while (i < length) { j = i; while (j<length && A[j] == A[i] ) { j++; } deta = j - i -1; i++; ...
4af8a4f0-8531-499a-860b-a94dc23d1947
0
protected Document newEmptyDocument() { Document doc = docBuilder.newDocument(); // Add the processing instruction. /* * doc.appendChild(doc.createProcessingInstruction ("xml", * "version=\"1.0\"")); */ // Add the credit string for JFLAP. doc.appendChild(createComment(doc, "Created with JFLAP " +...
e9bf9cb5-f5c8-4207-bdc9-d5c86bfa3302
5
private boolean cmdStartGame(CommandSender sender, String[] args) { String worldName = null; if(args.length >= 1) worldName = args[0]; World world = null; if(worldName != null) { world = getServer().getWorld(worldName); } else { if(sender instanceof Player) { world = ((Player)sender).getWorld();...
4dbce943-0319-4403-ba32-4d23b3bca6df
4
private void makeCbCrDivisibleBy8(int y, int x) { int h = y/2; int w = x/2; if(h % 8 != 0) { h += 8 - (h % 8); } if(w % 8 != 0) { w += 8 - (w % 8); } cbtranssub = new double[w][h]; crtranssub = new double[w][h]; for(int yy = 0; yy < h; yy++) { for(int xx = 0; xx < w; xx...
3e6681e7-6fa7-4f82-9ce4-edf2d903bd52
7
public int howManyMoves(int r1, int c1, int r2, int c2){ ArrayDeque<Cell> queue = new ArrayDeque<Cell>(); boolean[][] visited = new boolean[8][8]; queue.add(new Cell(r1,c1,0)); int[] e = {-1,1}; while(!queue.isEmpty()){ Cell u = queue.poll(); if(u.x==r2 &&...
2a37b981-9bfd-4579-a726-ff51bf8754bb
1
public String getEffect(String effect) { if(effect.equals("bullet")) { return "assets/audio/pprooo.wav"; } return null; }
481e2a80-d2cf-4f98-828b-fea5499d801b
6
@EventHandler public void SlimeSlow(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSlimeConfig().getDouble("Slime.Slow.DodgeCha...
9de1a95b-c183-47d0-ad15-9014bac06273
8
private boolean isBlocking(float _x, float _y, float xa, float ya) { //translate into block mode (since blocks are 16x16) int x = (int) (_x / 16); int y = (int) (_y / 16); if (x==(int)(this.x/16) && y==(int)(this.y/16)) return false; boolean blocking = world.level.isB...
258c769f-e5c4-443d-b783-fa1ec24a0268
3
private void importBasics(PermissionBase s, PermissionBase t) { for (String perm : s.getDeclaredPermissions()) { t.addPermission(perm); } for (String world : s.getOptions().keySet()) { Map<String, Object> options = s.getOptions(world); for (String key : option...
8e7027a4-15bc-4fb9-b8e6-e5c34fabd5e4
8
public void execute(Joueur jou){ Joueur proprio = this.getProprietaire(); if(proprio == null){ Scanner sc = new Scanner(System.in); if(this.getLoyerBase() <= jou.getCash()){ System.out.println("Voulez-vous acheter cette compagnie : y/n Cela vous cou...
69366086-c4fd-4fbb-9755-1a27a7ce927f
7
public Hub(){ setLayout(null); setDoubleBuffered(true); Pool pool = Main.status.getPool(); Drop[] drops = pool.getDrops(); for(int n = 0; n < drops.length; n++){ if(drops[n].getType().equals("distributor")){ dmodel.add(dmodel.size(), drops[n].getName()); } else if(drops[n].getType().equa...
dda024f9-3492-4dfc-aa68-3919088958fb
4
private void addUniform(String uniformName, String uniformType, HashMap<String, ArrayList<GLSLStruct>> structs) { boolean addThis = true; ArrayList<GLSLStruct> structComponents = structs.get(uniformType); if(structComponents != null) { addThis = false; for(GLSLStruct struct : structComponents) ...
e195ece9-1fc1-474d-96e4-c9eee8633f77
4
public static SimpleDateFormat lookupDateFormat(CSTable table, int col) { if (col < 0 || col > table.getColumnCount()) { throw new IllegalArgumentException("invalid column: " + col); } String format = table.getColumnInfo(col).get(KEY_FORMAT); if (format == null) { ...
801908d0-59ca-440d-80d8-c73e93882fca
8
public static GBasicCellEditor getEditorFor(Object value) { GBasicCellEditor editor = null; Class c = value.getClass(); //search super classes while (editor == null && c != Object.class) { editor = knownEditors.get(c); c = c.getSuperclass(); } if (...
ac8f113c-1994-4d7c-bf51-23ae9290c491
5
public static String vectorProgrammeToHTML(Vector<Representation> rs, boolean un_seul_spec){ if (rs.isEmpty()) return "<p class=\"plusbas\">Il n'y a pas de représentation à venir ...</p>"; String toReturn = "<TABLE BORDER='1' width=\"1000\">\n"; if (!un_seul_spec) toReturn+="<CAPTION>Les prochaines représ...
d7a01d5f-af97-4f5c-aee0-bb1163ee91d1
0
public void setItem(Items item) { this.item = item; }
c25dbb70-5400-44be-99ef-ada2cbaf2dba
6
public void show(Mode mode, Type type, String message) { if (mode == null) { mode = Mode.NORMAL; } final String restoreMessage; if (Notification.shouldRestoreMessage(m_mode, mode, m_type, type)) { restoreMessage = getMessage(); } else { restor...
8ed06b0d-5cfa-4b25-a250-086c92ac5d88
5
@Override protected final void extraerMetadatos() { this.info.open(audio); //>>ASIGNAR METADATOS DE VIDEO GENERAL //>>3 Duración Integer segundo = Integer.parseInt(info.get(MediaInfo.StreamKind.Audio, 0,"Duration",MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name)) /...
c0a54a98-7295-40cb-b73e-bfd8bb2bd6e7
5
private int getMy() { int my = 0; if (pFrom.y >= pTo.y) { if (pMid.y < eFrom.getY() - gap && pMid.y > eTo.getY() + eTo.getOHeight() + gap) my = pMid.y; else my = Math.max(pFrom.y + eFrom.getOHeight() / 2 + gap, pTo.y + eTo.getOHeight() / 2 + gap); } else { if (pMid.y > eFrom.getY() + e...
6ca175fa-f2ef-49a4-b1c0-9e375f96c19f
7
protected void addModifiers(MemberDoc member, Content htmltree) { String mod = modifierString(member); // According to JLS, we should not be showing public modifier for // interface methods. if ((member.isField() || member.isMethod()) && writer instanceof ClassWriterImpl && ...
7d3b44d7-545e-442b-88e6-f7dccf6ada37
4
public String listar_grados() throws SQLException { ResultSet list_gra = gra.condultarGrados(); String tbl_gra = ""; String colorEstado = ""; String iconoEstado = ""; String nomFuncion = ""; try { while (list_gra.next()) { tbl_gra += "<tr>"; ...
ec833af7-361b-4957-bfcd-d756394ec855
1
@Override protected void createReaderWriter() throws JoeException { ourReaderWriter = new PdbBFReaderWriter(); if (ourReaderWriter == null) { throw new JoeException(UNABLE_TO_CREATE_OBJECT); } }
4f8d9631-f70f-48fe-b0c5-1b45858daf90
0
public GeometryCollection add(GeoJsonObject geometry) { geometries.add(geometry); return this; }
5978ffbc-3f59-4043-b262-666ca647c9a9
9
public static void main(String[] args) throws IOException { final String[] KEYS = {"user.name", "user.language", "user.home", "os.name", "java.version"}; Vector vec = new Vector(); String s; // Lies Textzeilen aus der Datei in einen Vector: BufferedReader in = null; ...
69086f13-1ae0-4dc6-b0a5-539d52b6bde9
9
private void maakButtons() { int c = 0; for(int i = 0; i < 5; i++){ for(int j = 0; j < 5; j++){ if(spelData[c] == 0) { blokken[c] = new JButton(new ImageIcon("src/resources/spel/1.png")); } else if(spelData[c] == 1) { ...
45f1e1b8-15aa-46b0-8c91-710f6161dd03
9
@Override public void handleEvent() { LogManager.getLogger(LoggingHandler.class).info("handle event"); if (socket.isConnected()) { if (dst.position() > 0) { try { pipe.write(dst); dst.compact(); if (dst.position() != 0) { LogManager.getLogger(LoggingHandler.class).log( Level.ER...
16b24789-728c-4bbd-a7fb-4dac27f24820
6
public Inventory solveDynamically() { int[] solution = new int[capacity + 1]; ArrayList<Double> amounts = new ArrayList<Double>(); boolean[][] isIncluded = new boolean[items.size()][capacity + 1]; if (capacity < 0) { return new Inventory(this, amounts); } ...
04cd16f8-7ba7-4122-a355-82dfe7be4050
2
public void write(String[] InputStringArray){ PrintWriter out; try { Files.deleteIfExists(Paths.get(filePath)); out = new PrintWriter(new FileWriter(filePath, false)); for (int i=0;i<InputStringArray.length;i++) out.println(InputStringArray[i]); out.close(); } catch (IOExc...
d554ffed-c160-413d-b75d-5ae2ca9deea4
3
public static void moveInventoryListObjectAfter( String listName ) { ArrayList<InventoryListObject> inventoryLists; InventoryListObject inventoryListObject; int curPosition, newPosition; inventoryLists = _inventoryObject.getInventorysLists(); inventoryListObject = getInventoryListOb...
f424d213-8002-46d9-96fe-0a966a90e25c
5
private void cmdMover(String direcao) throws Exception { Conexao conexao = getConexao(direcao); Inimigo inimigo = conexao.getInimigo(); if (inimigo != null) { if (inimigo instanceof Armadilha) { jogador.matarJogador(); throw new Exception( "O jogador infelizmente caiu em uma armadilha e morreu....
d8a3243d-0e2d-4db1-ae20-aeee19674798
8
public void print(PrintContext p, SPINModuleRegistry registry) { printComment(p); printPrefixes(p, registry); p.printIndentation(p.getIndentation()); p.printKeyword("SELECT"); p.print(" "); if(isDistinct()) { p.printKeyword("DISTINCT"); p.print(" "); } if(isReduced()) { p.printKeyword("REDUCED"...
3ab76bd8-9269-4468-a087-b5b9e60afaf3
6
public static void ReadConfig() { String file = JServer.rootDir + "config"; String[][] str = new String[3][2]; String cLine; try (BufferedReader bReader = new BufferedReader(new FileReader(file))) { int i = 0; while ((cLine = bReader.readLine()) != null) { str[i] = cLine.split(": "); i++; } ...
a03de83d-4f7a-4bfd-9e72-512234640c65
8
public static void main(String[] a) throws IOException { Scanner s = new Scanner(new File(a[0])); while (s.hasNext()) { String i = s.next(); String[] b = i.split(""); List<Integer> l = new ArrayList<Integer>(); int c; for (int j = 0; j < b.length; j++) { try { c = Integer.parseInt(b[j]);...
0424ee5b-1552-417c-9e4d-fa4c5960d2ff
2
private String contentTable(Timer time, String nameTask){ if(type == Type.RUNNING_TASKS){ return("<tr> <td>"+ time +"</td> <td>"+ nameTask + "<td><a href='task?name_task="+ nameTask +"' target='_blank' >Detaily úkolu</a> </td> "+ "<td><a href='stopwatch?end_task="+ nameTask +...
8e25074c-2ee2-4241-a09c-89c0106ed148
7
private void doSingleDestinationWithMultipleMembersTest(boolean totalOrder, int members) throws Exception { final int maxMessages = 1024; for (int i = 0; i < members; ++i) { TOANode member = createNewChannel("toa_multiple_member_" + totalOrder + "_" + i); member.start("toa_multip...
d56e89c8-f3db-49ee-a56a-79b626ab155c
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pointer other = (Pointer) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) return false...
fd365468-d65c-4ebf-91ed-db3af977d16d
5
private static void PlayerMoveChoice(int choice){ if (playerHealth > 0) { switch (choice) { case 1: System.out.print("------------------------------------"); // line break System.out.print("\n"); // line break System.out.print("\n"); // line break System.out.println("Pikachu used Tackle!"); ...
d99b4bfa-5608-4e19-9cf7-177f339b1a7e
8
public void startupMapHook() { super.startupMapHook(); mMyMindMapController = super.getMindMapController(); getMindMapController().getController().getMapModuleManager() .addListener(this); // get strings from resources: COLUMN_MODIFIED = getResourceString("plugi...
81b43121-aa3c-4dbf-9e76-a41b2a6d48fc
8
public void giveReward(Player p, int breaks) { if (globalRewards == null || !globalRewards.containsKey(breaks) || globalRewards.get(breaks) == null) { return; } Reward r = globalRewards.get(breaks); if (r.getCommands() == null || r.getCommands().isEmpty()) { return; } for (String...
11bceaab-e9b6-47e5-b3bc-3ada7bea91d4
8
@Override @Command public Response download(String filename) throws IOException { File f = new File(directory, filename); if(f.exists()) { f.delete(); } DownloadTicketRequest request = new DownloadTicketRequest(filename); this.sendToServer(request); try { Response r = (Response) objectInp...
b6398ee3-0596-4c7b-a607-562f9aced658
9
@Override public void enable(boolean force) throws IllegalStateException { // Make sure MobManager is enabled if (P.p() == null || !P.p().isEnabled()) { throw new IllegalStateException("MobManager must be enabled to enable Bounties"); } // Check if the Spawner is already enabled if (this.isEnabled()...
99b7b30a-3d1a-4b94-9109-89409bb05956
8
public void addFormula(LinkedList expression, LinkedList<IntervalBtn> intButtons) throws CloneNotSupportedException { //Agregamos la fórmula formulas.add(expression); //Generamos y agregamos los botones, además de dibujarlos. LinkedList<IntervalBtn> newIntBtnList = new LinkedList<IntervalBtn>(); if(for...
a9c34229-4680-404a-9f50-5619a66a6c13
8
public Coordinates move(double xLoc, double yLoc, double vel) { if(UserInput.Up==true){ yLoc-=vel; } if(UserInput.Down==true){ yLoc+=vel; } if(UserInput.Right==true){ xLoc+=vel; } if(UserInput.Left==true){ xLoc-=vel; } if(xLoc < GameInfo.xBegin){ xLoc = GameInfo.xBegin; } if(xLoc...
b0c41c0a-f200-402a-9337-b35d2271598b
5
public String getSplitTypeOOXML() { if( fAutoSplit ) { return "auto"; } switch( split ) { case 0: return "pos"; case 1: return "val"; case 2: return "percent"; case 3: return "cust"; } return "auto"; // default }
c4bf47ea-0462-4e6d-96e7-0c9892c34693
8
public void beginStep() { //Behaviors float dx = 0, dy = 0, da = 0; for(Behavior behavior : emmiterBehaviors) { Location loc = behavior.doBehavior(x, y, angle); dx += loc.x; dy += loc.y; da += loc.angle; } float delta = Game.getDeltaSeconds(); x += dx * delta; y += dy * delta; angle += da * ...
b83469e5-9780-4941-b5fb-b1aad0304d5c
5
public KnightView() { for (int j = 0; j < 4; j++) { String direction = ""; if (j == 0) { direction = "left"; } if (j == 1) { direction = "right"; } if (j == 2) { direction = "down"; } if (j == 3) { direction = "up"; } String...
5310b21e-71b0-4c55-b672-ed4a02bcbfce
9
public static Direction fromInteger2(int value) { if (value > -1) { value >>= 1; } switch (value) { case 0: return NORTH; case 1: return NORTH_EAST; case 2: return EAST; case 3: return SOUTH_EAST; case 4: return SOUTH; case 5: return SOUTH_WEST; case 6: ...
782b69cf-6950-44e8-afd9-7097d9ef5ab9
4
public void shuffle() { for(Actor a : actors) { if (a instanceof Light && Math.random() > .5) { ((Light)a).toggle(); for(Location other : ((Light)a).neighbors(ORTHOGONAL)) { ((Light)model.actorAt(other)).toggle(); } } } }
4cfab4d4-d326-4513-8092-da5c68e57612
3
public void testAutoUnloadClassloaders () throws Exception { int initialCount = AccessClassLoader.activeAccessClassLoaders(); ClassLoader testClassLoader1 = new TestClassLoader1(); Class testClass1 = testClassLoader1.loadClass("com.esotericsoftware.reflectasm.ClassLoaderTest$Test"); Object testObject1 = testCl...
f5e73b7c-7663-4316-a1a3-bc3aa3353056
4
public PositionField(Position initialValue, boolean[] active, Color bg, String fieldTitle) { if ((active == null) || (active.length != 9)) { throw new IllegalArgumentException(); } if (bg == null) { bg = Color.WHITE; } if (fieldTitle == null) { ...
cc824473-d172-4383-a3ff-811122996420
4
public static dataauthor QueryName(String name){ dataauthor bkname = new dataauthor(); ResultSet restl=null; int i = 0; try{ contct=connector.getConnection(); Sttt=contct.prepareStatement("select * from author where name= '"+name+"'"); restl=Sttt.executeQuery(); while(restl.next()){ ...
33bf9efb-ceb4-461b-b23a-5f8f916ac323
2
@Override public boolean verifier() throws Exception{ super.verifier(); if(!type_retour.equals("entier")) GestionnaireSemantique.getInstance().add(new SemantiqueException("Le type de retour de la fonction "+idf+" est de type "+type_retour+", type entier attendu")); ...
0513f0e1-6f26-4d24-b4f1-eb57f3e25b7d
0
public int getIndicatorState() { return this.indicatorState; }
11389817-ca0d-4dab-82a1-a73baf01a0b2
2
private Tree variablesPro(){ Tree varDeclaration = null; if(accept(Symbol.Id.KEYWORD,"var")!=null){ if((varDeclaration = variableListPro()) != null){ accept(Symbol.Id.PUNCTUATORS,";"); return new VariableDeclarationStatement(varDeclaration); } } return null; }
ccd239f5-c546-47d0-8972-d997b6763374
4
public boolean collides(int xm, int ym){ if(xm > x - 8 && xm < x + w + 8 && ym > y - 8 && ym < y + h + 8) return true; return false; }
b7618b69-fce0-4595-8b31-722d46776472
7
public void fetchSetting(String setting) { if (setting.startsWith("aspectratio")) setAspectRatio(fetchBoolean(setting)); if (setting.startsWith("windowwidth")) windowWidth = fetchInteger(setting); if (setting.startsWith("windowheight")) windowHeight = fetc...
b779cb9b-d0e5-41b7-82f5-8a2aa72bd1bf
1
private byte[] readBytes(int length) { byte[] ret = new byte[length]; for (int i = 0; i < length; i++) { ret[i] = dataBuffer[dataPos]; dataPos++; } return ret; }
58172385-9bd6-40eb-b530-176f93eecb1c
8
public void sort(Preference[] sortSet) { HashSet<Preference> sorted = new HashSet<Preference>(); Preference curr; do { curr = null; for (Preference key : sortSet) { if (!sorted.contains(key)) { curr = key; break; } } if (curr == null) break; //save some time here doub...
793cb80d-787f-41ec-8252-ab4033d5f926
9
private void senaoEspecial() { if (comparaLexema(Tag.SENAO)) { consomeToken(); if (comparaLexema('{')) { consomeToken(); boolean c = true; while (c) { c = comeco(); } if (numeroErro == 0) { if (comparaLexema(Tag.PARE) || comparaLexema(Tag.CONTINUE)) { consomeToken(...
5d2b9de4-b26c-4abe-88bc-43ce83f765dc
0
public String getQuestion() { return question; }
68617dd8-7b07-401b-9b6f-a4f6cf145fb4
5
public List<Book> getBooks() { List<Book> list = new ArrayList<>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE...
823b45a6-55bd-428c-814e-5b6bc43d9aef
0
public String getUsername() { return username; }
0fe5f8f6-bfca-41f4-ab58-dc06f1819174
5
public static FindMission attemptFor(Actor actor) { if (actor.mind.mission() != null) return null ; final Venue admin = Audit.nearestAdminFor(actor, false) ; if (admin == null) return null ; // // Find a mission that seems pretty appealing at the moment- final Choice choice = new Choice(actor) ...
fa597cd8-18ae-4525-9611-85ae2ae14b30
0
public boolean hasNext() { return (!queue.isEmpty()); }
8e31cb8f-24c8-4686-9f08-f4b6e0d67792
0
public Integer getDiskNo(int i) { return maxDisks - (disks.elementAt(i) - 1); }
61c974ac-9030-46ba-86d6-b87ac28faadc
7
public DefaultMutableTreeNode buildTree() { DefaultMutableTreeNode root; DefaultMutableTreeNode grandparent; DefaultMutableTreeNode parent; root = new DefaultMutableTreeNode("Sprites"); try { BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/sprite...
0860cfec-327b-40ff-9ce7-679503cc7d7c
3
public int rocLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 10; else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) ) return -1; return optInTimePeriod; }
0261c715-d00d-4cc0-a506-ef1d75368de1
6
public static void readFile(String file){ BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader(file)); while ((sCurrentLine = br.readLine()) != null) { if(!sCurrentLine.startsWith("//") && !sCurrentLine.isEmpty()){ sCurrentLine = sCurrentLine.replace(" ", "")...
d6ca180a-5383-45ad-aedc-9903bd4595e4
8
@Override public int decidePlay(int turn, int drawn, boolean fromDiscard){ //see if this card is useful (or if not cached already) if (!fromDiscard || turn != cache_turn){ //Recalculate ranges, if needed if (turn != cache_turn){ myRanges.clear(); //clear ranges calculateRanges(); //recalculate rang...
fba8022f-54cb-4a39-9931-3b42e271d586
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...
3b424452-2439-48e8-873b-422e18b3b06d
9
final boolean method2728(int i, byte b, int i_2_) { anInt7367++; if (b <= 11) { anInt7370 = -117; } if ((i ^ 0xffffffff) <= (anInt7374 ^ 0xffffffff) && i <= anInt7369 && (i_2_ ^ 0xffffffff) <= (anInt7365 ^ 0xffffffff) && (i_2_ ^ 0xffffffff) >= (anInt7370 ^ 0xffffffff)) { return true; } if ((anInt7371 ...
1d354758-4fbc-4b38-993c-8753bfea095d
8
@SuppressWarnings("unchecked") public Map<?, ?> getVm(String vmName) { final Map<?, ?> vmsJSON = getVms(); String uri = null; final List<JSONObject> msg = (JSONArray) vmsJSON.get("entities"); final Iterator<JSONObject> iterator = msg.iterator(); Map<?, ?> factObj = null; String vmId = null; while (iter...
a0dcf750-8f6e-44fb-823e-9b71d2d536c7
0
public void setInventory(int inventory) { this.inventory = inventory; }
2c9a396b-78fa-4e28-87ce-f86c14dd7fb5
8
private void selectOption(int option) { if (allowClick) { game.jukeBox.play(game.jukeBox.tracks.buttonClick); if (option == 0) { game.log.gsm("[MENU] Game started"); gsm.setState(GameStateManager.PLAY); } else if (option == 1) { game.log.gsm("[MENU] Levels [NOT YET IMPLEMENTED]"); } else if (o...
1352c0b2-8649-40d1-8c26-ff0b9a30dbea
0
public static ArrayList<Excel> generatePyramid4(int side, ArrayList<Excel> base) { ArrayList<Excel> result = new ArrayList<Excel>(); result.addAll(LineGenerator.Brezenhem(base.get(0), base.get(1))); result.addAll(LineGenerator.Brezenhem(base.get(1), base.get(2))); result.addAll(LineGenerator.Brezenhem(base.ge...
89645240-fb22-4ab7-aa16-e67b01f204a3
1
public List<Courier> getAllCouriers() throws AftershipAPIException,IOException,ParseException,JSONException{ JSONObject response = this.request("GET","/couriers/all",null); JSONArray couriersJSON = response.getJSONObject("data").getJSONArray("couriers"); List<Courier> couriers = new ArrayList...
7b1ec3a5-6b25-4351-b776-d7c9388c289b
4
public void put(Object key,Object val){ try{ int hashVal=hasCode(key); if(hashList[hashVal]==null){ hashList[hashVal]=new Node(key,val,null); }else{ for(Node x=hashList[hashVal];x!=null;x=x.next){ if(key.equals(x.key)){ x.value=val; }else{ x.next=new Node(key,val,nu...
a9f16702-7499-411e-a8fe-3041de134ed8
3
public boolean isThrone(int x, int y) { for (int count = 0; count < throneListX.length; count++) { if (throneListX[count] == x && throneListY[count] == y) { return true; } } return false; }
f33ce240-04f1-4708-ae14-33e9e4261142
3
public boolean drawCard(Player player) { if (drawPile.isEmpty()) { refillDrawPile(); } if (!drawPile.isEmpty() && !player.isFullOnCards()) { Card card = drawPile.drawCard(); player.giveCard(card, drawPile); return true; } return f...
fd85914b-8f26-449c-aeef-a577f848fbed
3
public FactoryOfPlaysForCpu (Player cpu, int largestCapture){ IteratorOnPieces iterator = (IteratorOnPieces) cpu.iterator(); int bestEvaluation = -100; //inizializzato a -inf. while(iterator.hasNext()){ iterator.next(); FactoryOfPlaysForCpuForPiece factory = new FactoryOfPlaysForCpuForPiece(iterator.getPosi...
e1f5ef9d-9bae-432b-92fe-d3a89d37b9f6
2
public Action getAppliedAction() { if ((this.os != null) && (!this.os.isCurrentOperatingSystem())) return null; return this.action; }
3f8abf22-0b2d-4b14-9523-018e8fdc8427
2
private void createBoardImage() { Graphics2D g = (Graphics2D) gameBoard.getGraphics(); g.setColor(new Color(0x999999)); g.fillRoundRect(0, 0, BOARD_WIDTH, BOARD_HEIGHT, Tile.ARC_WIDTH, Tile.ARC_HEIGHT); g.setColor(new Color(0x999999)); for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS...
111ae7d1-5708-4876-9b32-52db6524e375
0
public void setRooms(RoomEntity rooms) { this.rooms = rooms; }
8ef90190-60f1-477a-91c0-b5d4663b94fd
4
void copyUcs2ReadBuffer(int count, int shift1, int shift2) throws java.lang.Exception { int j = readBufferPos; if (count > 0 && (count % 2) != 0) { encodingError("odd number of bytes in UCS-2 encoding", -1, count); } for (int i = 0; i < count; i += 2) { ...
b1325d3b-f18a-4379-93dc-4e0127fd94a4
8
public synchronized void write(K key, V value) throws IOException { boolean nullKey = key == null || key instanceof NullWritable; boolean nullValue = value == null || value instanceof NullWritable; if (nullKey && nullValue) { return; } if (!nullKey) { writeObject(key...
bd47b1fa-2d0f-43b3-b9bd-071f862fe5cd
6
public static Map<Object, Object> readStringXmlOut(String xml) { Map<Object, Object> map = new HashMap<>(); Document doc = null; try { // 将字符串转为XML doc = DocumentHelper.parseText(xml); // 获取根节点 Element rootElt = doc.getRootElement(); System.out.println(doc.selectNodes("// ")); // 拿到根节点的名称 S...
fd437643-e2cc-4367-b960-dae92f575a93
3
@SuppressWarnings( "unchecked" ) @Override public <T extends Item> T getItem( ItemKey<T> key ) { for( GraphItem item : graph.getItems() ) { if( item instanceof Item ) { if( ((Item) item).getKey().equals( key ) ) { return (T) item; } } } return null; }
fa77fbef-c6ee-494f-bf80-67b8ac47c6bc
8
public static void main(String[] args) throws IOException { // Use BufferedReader rather than RandomAccessFile; it's much faster BufferedReader f = new BufferedReader(new FileReader("combo.in")); // input file name goes above PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("combo.out"))); ...
89c0c37c-a959-4e4f-9377-cde348e4a0f6
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 Course)) { return false; } Course other = (Course) object; if ((this.id == null && other.id != null) || (this.i...
a097d620-6af9-4741-bf82-4223536f92d3
5
protected long[] getFetchStep( long startTime, long endTime, long resolution ) throws RrdException, IOException { if ( rrd == null ) openRrd(); long maxStep = Long.MIN_VALUE, minStep = Long.MAX_VALUE, step = 0; for ( int i = 0; i < datasources.length; i++ ) { if ( datasources[i].size() > 0 ) { F...
c5842d17-527d-47aa-8836-831c777f6004
4
public boolean isRequest() { if (opcode == PING_REQUEST.toByte() || opcode == STORE_REQUEST.toByte() || opcode == FIND_NODE_REQUEST.toByte() || opcode == FIND_VALUE_REQUEST.toByte() ) return true; else return false; }
3ef3a295-f30c-49ce-9b69-22a0fda2aa36
1
public static void heapSort(int[] array){ buildMaxHeap(array); int heapSize = array.length; for(int i = array.length-1; i>=0;i--){ exchange(array,i,0); heapSize = heapSize -1 ; maxHeapify(array,0,heapSize); } }
6efab2a5-235e-4270-8add-7afa07f37a6a
0
public FSALambdaTransitionChecker() { super(); }