method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
aa2b633d-7a39-489a-973b-d7bac8ac01d9
1
public void commandAction(Command c, Displayable d) { if (c == cmdconnect) { Thread th = new Thread(this); th.start(); } }
5a9e0672-1762-4aa4-9542-2d307982f5ac
5
public int countAll(){ Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), dbCon.getDB_USERNAME(...
cd24831c-9b14-4e82-a6df-61a7ba8204c7
9
private void setUDPOptionsEnabled(boolean enabled) { lb_udpBufferSize.setEnabled(enabled); udpBufferSize.setEnabled(enabled && lb_udpBufferSize.isSelected()); udpBufferSizeUnit.setEnabled(enabled && lb_udpBufferSize.isSelected()); lb_udpPacketSize.setEnabled(enabled); udpPacketSize.setEnabled(enabled && lb_...
e9cf1200-9d40-4a9c-acfa-a3358db0b43d
0
String getDescription() { return description; }
c69c5f58-5c14-4eaa-bde5-f72b9aec3899
8
public boolean moveLines(int ligneDebut, int ligneFin, boolean sens) { String o; if (ligneDebut == 0 && sens == UP || ligneFin >= listKey.size() - 1 && sens == DOWN || ligneDebut > ligneFin) return false; if (sens == UP) { for (int i = ligneDebut - 1;...
3096a054-9acc-4100-9724-14947bb66353
8
public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getSummary() != null) { _hashCode += getSummary().hashCode(); } if (getDetails() != null) { _hashCode += getDet...
54eaf344-7501-4c20-ba49-4647fb6858e4
6
private void applySystem(System world, Actor actor) { // // Assign skin texture based on prevailing climate- // TODO: Blend these a bit more, once you have the graphics in order. final Trait bloods[] = { DESERT_BLOOD, FOREST_BLOOD, TUNDRA_BLOOD, WASTES_BLOOD } ; Trait ...
1b9c3fd6-094a-4678-bc93-3712c377aa7b
6
public boolean getBoolean(int index) throws JSONException { Object o = get(index); if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Boolean.TRUE) || (o in...
50c369c2-1eb6-4902-a911-d20c67b73f6d
0
public void setHeight(int h) { height = h; }
d7b9c75e-e927-4a26-af26-99ee38d08e67
5
public Pick(boolean hidden){ if(hidden) { this.alTiles = new ArrayList<Tile>(); String nomFichier = System.getProperty("user.dir"); nomFichier = nomFichier + "/Tuile.txt"; Scanner fichier = null; String s; try { // ouverture fichier = new Scanner(new File(nomFichier)); // traitement ...
0ec5fa78-57ae-4307-8208-bbf16b49109b
9
public static boolean complete(Annotation annotation, AbstractBaseContent content) { boolean found = false; // PATH combine - @Path if(annotation instanceof Path) { found = true; Path p = (Path) annotation; content.setPath(p.value()); } // Input/output - @Produces / @ Consumes if(annotation insta...
d2210981-6b45-44e4-be7a-f15624aa291b
8
protected PointDouble findBest() throws Exception { PointInt center; Grid neighborGrid; boolean finished; PointDouble result; PointDouble resultOld; int iteration; Instances sample; Resample resample; log("Step 1:\n"); // generate sample? if (getSampleSizePercent()...
d99fdbba-fe9e-4386-8282-9ae19e56afdc
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Criteria)) return false; Criteria other = (Criteria) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; ...
674fe4a1-085f-4cf6-8159-40bc8c836369
5
public int getGreen(int row, int col) { if (row >=0 && row < rows && col >= 0 && col < columns && grid[row][col] != null) return grid[row][col].getGreen(); else return defaultColor.getGreen(); }
427317b0-d239-458f-9c85-8639333a7ddb
7
public Unit findUnitByID(int ID, String type) { List<Unit> temp = m_enemies; if (type.equals("player")) { temp = m_players; } if (temp.size() != 0) { boolean fail = true; for (Unit u : temp) { if (u.getID() == ID) { // System.out.println(u.getID() + "-" + ID); // System...
de80aea9-2506-4ee9-bc91-3b48a7f54169
3
public void WGResetAllPoints(String sender, Command command) { if(command.arguments.length == 2) { Game game = getGame(command.arguments[1]); if(game != null) { for(User user : game.users) { user.points = 0; } sendMess...
ef76267d-fe82-4646-b493-ccfee81b1ce2
4
public static void main(String[] args) { FileOutputStream fos=null; ObjectOutputStream os = null; try { fos = new FileOutputStream("MyBinaryFile.g"); os =new ObjectOutputStream(fos); /* DataOutputStream dos =new DataOutputStream(fos); dos.write(10); dos.writeDouble(10.00); dos.close(); */...
7e5efcbf-c605-47d5-a4e3-3d7ad43a3b60
0
public String[] getRecord_errors() { return record_errors; }
81102944-bcb9-4c96-863e-e8aab48a795c
1
protected void setPrecio(double precio)throws Exception { if(precio<1){ throw new Exception("El precio tiene que ser superior a 0."); }else{ this.precio = precio; } }
e8b926a5-1090-43dd-a990-4c73b8bf3e9a
2
private synchronized void stop() { if (!running) return; running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } System.exit(1); }
03167b60-8535-44ab-82f7-00bcca3d5d95
1
public void setPeerId(ByteBuffer peerId) { if (peerId != null) { this.peerId = peerId; this.hexPeerId = Torrent.byteArrayToHexString(peerId.array()); } else { this.peerId = null; this.hexPeerId = null; } //< obfuscated handshake extension this.supportsObfuscation = this.hasMagicPeerId(); //> ob...
fc927071-7f33-4fca-aef3-3eecd92f34a4
8
public static void main(String[] args) { int aux = 0; JFileChooser fileChooser = new JFileChooser(); // TODO mudar de ArrayList<File> listaArquivos para List<File> listaArquivos ArrayList<File> listaArquivos = new ArrayList<File>(); while (aux == 0) { aux = fileChooser.showDialog(null, "Selecionar"); if...
f8ef44f6-07eb-46ce-98a3-5c97732ed099
7
private String loadHumidity() { if (details) System.out.println("Loading humidity."); File imageFile = new File("output/"+name+"/overviews/humidity_overview.png"); if (imageFile.exists()) { try { BufferedImage humImage = ImageIO.read(imageFile); if (humImage.getWidth() == chunksX * MyzoGEN.DIMENSION...
67204471-ed14-442f-a119-c8a99d87f005
2
public void addNodeAndEdge( int fromID, int toID, double cost){ Node node = getNode(fromID); if( node != null ){ node.addEdge(toID, cost); } else { node = new Node(fromID); node.addEdge(toID, cost); addNode(node); } if( getNode(toID) == null ){ Node toNode = new Node(toID); addNode(toNode...
d43b2f33-4359-471f-9b08-c411d7737d95
8
private Object[] getOptInputParameters() { int size = getFuncInfo().nbOptInput(); if (callOptInputParams==null) callOptInputParams = new Object[size]; for (int i=0; i<size; i++) { if (callOptInputParams[i]==null) { OptInputParameterInfo param = getOptInputParameterInf...
7103a936-d69d-48d7-bc98-97388d55495b
6
public static String detectIdentifier(String eadfile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError { FileInputStream fileInputStreamEAD = new FileInputStream(eadfile); XMLEventReader xmlEventReaderEAD = XMLInputFactory.newInstance() .createXMLEventReader(fileInputStreamEAD)...
b7f85aab-a408-4d70-8c5b-942e4417712e
0
@Required public void setPlotBuilder(PlotBuilder plotBuilder) { this.plotBuilder = plotBuilder; this.plotBuilder.setDataModel(dataModel); this.plotBuilder.setMainWindowModel(mainWindowModel); }
40b1d869-fa3b-4549-828c-842b63b37d9c
5
private static boolean[] primeBoolArray(int limit) { boolean[] nums = new boolean[limit]; for (int i = 2; i < nums.length; i++) nums[i] = true; int nextPrime = 2; while (nextPrime < nums.length / 2) { int i = nextPrime; for (; i < nums.length; i += nextPrime) nums[i] = false; nums[nextPrime] = t...
0bc083a4-96d5-4646-95e1-9ab8970a66d6
8
private int findBase(int index, Node[] nodes){ int base = baseBuffer.get(index); if(base < 0) { return base; } while(true) { boolean collision = false; // already taken? for(Node node : nodes) { /* * NOTE: * Originally, nextIndex is base + node.getKey(). But to reduce construction time, ...
0ebe3c91-a5e8-4bd1-9645-4082e6289fad
8
private void displayMessage (int freq,boolean isFile) { int tone=getTone(freq); String ch=getChar(tone); // Normal operation if (theApp.isDebug()==false) { if (ch.equals("ls")) return; else if (ch.equals("fs")) return; if (ch.equals("cr")) { lineCount=50; } else { theApp.writeCha...
273c4ec5-fc08-490b-9140-2f84848920a7
8
private void colIteration(List<StepSetOperation> categorySet, Map<String, String> fields, String tableName, Connection memConn) throws Exception { try { long startTime = 0; memConn.setAutoCommit(false); for (int i = 0; i < categorySet.size(); i++) { startTime = System.currentTimeMillis(); StepS...
cca24b60-08f9-4d97-b325-2ec7ce430300
0
public GamePane() { }
7c7ca648-0e50-4496-b45e-332f3dbf2bdb
2
public void testRemovePeriodConverterSecurity() { if (OLD_JDK) { return; } try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); ConverterManager.getInstance().removePeriodConverter(StringConverter.INSTANCE); ...
7527dcdc-ea02-493f-a928-ec3d03a4729f
8
public String render(SmaliClass smaliClass) { StringBuilder builder = new StringBuilder(); builder.append(renderPackage(smaliClass.getClassName())); builder.append("\n"); builder.append(renderImports(smaliClass.getImports())); builder.append("\n"); switch(smaliClass.getFlagValue(SmaliEntity.MASK_ACCESSI...
404bec75-fcb2-4197-8841-799fc80c5aac
8
public static IncomingMessageHandler createSpecificHandler(byte[] data, Type type) { try { switch (type) { case CLOGIN: return new AuthorisationHandler(data); case CNEWGAME: return new NewGameRequestHandler(data); ...
54e6d083-3ca0-4d27-a1c5-eeabd0f100f3
3
private void pickItem() { GroundItem ClosestItem = GroundItems .getNearest(new Filter<GroundItem>() { @Override public boolean accept(GroundItem o) { if (o != null) { return true; } return false; } }); if (ClosestItem.isOnScreen()) { ClosestItem.click(true); Ti...
a1c05015-f098-43e1-834b-5eb59444b59f
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainFrame frame = new MainFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
c4dca0fb-b25a-473f-bf94-3017b4e1d934
8
@Override public ArrayList<Action> search (State sstart, State sgoal) { State father, current; State start=getState(sstart); State goal=getState(sgoal); double tempGScore = 0; ArrayList<Action> legalActions; HashMap<State, StateActionPair> cameFrom = new HashMap<State, StateActionPair>() ; Open...
e5a36b97-9488-4c76-ba90-aaafb0178957
2
public void addTropas(int desp,int i,ArrayList<Guerrero> arr){ if(this.espacioGuerreros-1>=0){ if(this.oro-arr.get(i).costo>=0){ this.oro-=arr.get(i).costo; this.tropas.set(desp,(Integer)this.tropas.get(desp)+1); this.espacioGuerreros--; } } }
958d20ff-7652-4e12-8f28-1da69d248b06
5
public static String escapeHTMLEntities( String strToConvert ) { StringBuffer str = new StringBuffer( strToConvert.length() ); for( int i = 0; i < strToConvert.length(); i++ ) { char c = strToConvert.charAt( i ); if( c == '"' ) str.append( "&quot;" ); ...
36f4063a-1ecc-456f-91ee-c478965c3ac6
6
GameGrid(BabyQ bq) { super(); babyQ = bq; game = new BabyGame(babyQ); // an extra header row and column height = HEIGHT+1; width = WIDTH+1; setLayout(new java.awt.GridLayout(height,width)); // Generate the grid grid = new Location[height][width]; grid[0][0] = new Location(0, 0, game); for (in...
e63b5e80-48b6-4ff8-8822-813be6f81f61
8
public double executaFresa() { double menorTempo = getTempoUniversal()+1; ordenaPeloTempoDeSaidaF(maquinaFresa); for(int i=maquinaFresa.size()-1; i>=0 && maquinaFresa.size()>0 && verificaMaquinaFresa(maquinaFresa) ; i--) //percorre a lista de maquina e verifica os status dos rolamentos { if(maquinaFr...
be0d6f60-9ad9-4de5-b693-42406be4d6eb
0
public String[] getCategories() { return categories; }
a525a6ec-2d06-4ecd-a576-b7caa2dc06a3
0
public static void main(String[] args) { final Autorize a_rize=new Autorize(); a_rize.show(); a_rize.action.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { a_rize.setInfo(); m=new Model(a_rize.getInfo().get(2).toString(),a_rize.getInfo().get(0).toString()...
68dadba3-4239-48fd-8b4f-f76a92bddbd5
5
@Override public boolean preLoadBuffers( LinkedList<byte[]> bufferList ) { // Stream buffers can only be queued for streaming sources: if( errorCheck( channelType != SoundSystemConfig.TYPE_STREAMING, "Buffers may only be queued for streaming sources." ) ) retu...
3dafe63d-f5f9-4ce3-9cf5-b346aa1e9ea6
2
public Message ViewMessage (int id) { String requete = "select * from message where Id='"+id+"'"; Message msg =new Message(); try { Statement statement = MyConnection.getInstance() .createStatement(); ResultSet resultat = statem...
782cd0db-6e8a-43f0-a42f-54a62a7f9168
8
private void initSchedule(List<FeatureVectorSequence> sample, CRFModel model, double eta0) { double obj0 = findObjBySampling(sample, model); log.info("Initial objective=" + obj0); double bestEta = BEST_ETA_INIT; double bestObj = obj0; double etaGuess = eta0; boolean...
62d945a8-3fdc-49ea-afc0-d6dc19a762f6
8
public void render(Graphics g) { sprite.startUse(); for (Obj curr : positions) { if (curr.getT() != Mode.Wall.i()) { Rectangle currRect = new Rectangle((int) curr.getPos().X, (int) curr.getPos().Y, gridW[curr.getT()], gridH[curr.getT()]); if (rect.contains(currRect) || rect.intersects(currRect)) ...
b88cc996-7f65-4edf-ba41-bc38b309a709
0
public boolean hasEdge(Object vertex1, Object vertex2) { return adjacent(vertex1).contains(vertex2); }
a8651b49-3dcc-48e5-a3a2-c7fd64e4dfa4
3
public boolean hasComponent(int k) { if (k < 0 || k > LIBRATIONS) return false; if (offsets[k][1] > 0) return true; else return false; }
04ab6207-dc52-4af1-aee6-22ea05c0e3e1
5
@SuppressWarnings( "unchecked" ) private DataConverter<Item, Data<Item>, DefaultItem<Item>> getConverterFor( ItemKey<?> key ) { DataConverter<?, ?, ?> result = convertersByKeyType.get( key.getClass() ); if( result == null ) { throw new IllegalArgumentException( "unknown type of data: " + key.getClass() ); } ...
411417c7-e57e-4fac-9cf8-94e01867c117
5
static void solve(int mask, long acum) { if (pos) return; if (mask == 31) { if (acum == 23L) pos = true; return; } for (int i = 0; i < 5; i++) if ((mask & (1 << i)) == 0) { solve(mask | (1 << i), acum + v[i]); solve(mask | (1 << i), acum - v[i]); solve(mask | (1 << i), acum * v[i]); ...
2a5f0056-c795-4e92-8f36-d93bbb21db62
7
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
4c040e13-1137-4068-a872-e045c1f5c07d
2
public void log(Level level, String msg) { try { Date date = new Date(); String log = "[" + level + "]::" + "[" + date.toGMTString() + "] - " + msg + "\n"; jTextArea1.append(log); System.out.println(log); writer.write(log); writer.flush(); ...
956b200f-8906-47e8-a858-d6ac181fc6a6
0
public boolean validate(T t) { isLegal(); return binaryLogicalOperator.operate(validatorLHS.validate(t), validatorRHS.validate(t)); }
b20f437a-36af-46be-a9e6-c6645601b1c5
3
@Override public void mergeOnto(MapLayer other) { for (int y = bounds.y; y < bounds.y + bounds.height; y++) { for (int x = bounds.x; x < bounds.x + bounds.width; x++) { Tile tile = getTileAt(x, y); if (tile != null) { ((TileLayer) other).setTil...
6db9f5ec-9685-4ffc-bbde-684f3ac60960
7
static String zeroPadIntString(String unpadded, int minDigits) { int len = unpadded.length(); // Get the sign character (or 0 if none) char sign = unpadded.charAt(0); if ((sign != '-') && (sign != '+')) sign = 0; // The number of characters required is the number of...
ff87104f-7304-471c-8361-a0e98ea95709
0
public RequestWrapper getReferRequestWrapper() { return referRequestWrapper; }
d851ff4f-f1c4-4da9-a9bd-2d5ffd5e3291
3
public int getRecursiveChildCount() { int count = mChildren.size(); if (count > 0) { for (TreeRow row : mChildren) { if (row instanceof TreeContainerRow) { count += ((TreeContainerRow) row).getRecursiveChildCount(); } } } return count; }
763d0a72-7483-411a-bbe0-e3c7ff1e648b
1
private static void ensureCurrencyMapInitialized() { if (CURRENCY_TO_CYC_CURRENCY_MAP == null) { initializeCurrencyCycTermHash(); } }
93271b47-5511-4695-a333-d1575e6822c0
0
public void clear() { this.removeAll(); this.placedPiece = null; this.validate(); this.repaint(); }
c0610590-ba36-47f9-8106-5f1676c054c8
0
public ObjectBsonDecoder(ClassResolver classResolver) { super(classResolver); }
4e923267-6032-4364-a640-a51939295a1c
1
private void goNext(int list) { if (hasMoreValue(list)) currentIndexes.set(list, getIndex(list)+1); }
37eb4b5c-dd21-441c-b1ce-6b33974a4cb7
6
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); fillFibo(40); int testCases = Integer.parseInt(in.readLine().trim()); for (int t = 0; t < testCases; t++) { int n = Integer.parseInt...
75909e04-8353-4af6-8c5c-14b170d24092
6
private static void interactInput(){ try { System.out.printf("********************DEFAULT VALUE******************\n"); for(int i = 0; i<Settings.baseKeywords.length;i++){ System.out.printf("************ Query %1d: %15s *************\n", i+1,Settings.baseKeywords[i]);...
c8d72387-567f-46bc-a69f-27161f286716
0
public void restoreStatus(){ myKeeper.restoreStatus(); }
6e630ec4-3306-40a8-a4fd-a1058aff9162
8
public String command(final CommandSender sender, Command command, String[] args) { if (args.length < 1) return plugin.getString(Language.CHECKBAN_ARGUMENTS); String name = args[0]; name = Formatting.expandName(name); OfflinePlayer check = plugin.getServer().getOfflinePlayer(...
95b0e8b9-5690-4686-9f42-83356cd76cff
7
public void buildClassifier(Instances data) throws Exception { super.buildClassifier(data); // can classifier handle the data? getCapabilities().testWithFail(data); // remove instances with missing class Instances newData = new Instances(data); newData.deleteWithMissingClass(); double su...
29c41b06-33ea-4c0f-a308-a6e6db3f5682
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...
b6d75faf-3c82-42fb-bb41-280fe19802ed
3
public static Compte getCompteById(int id_compte) { Compte compte = null; Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("use nemovelo"); ResultSet res = stat.executeQuery("select * from compte where id_compte="...
675d53f5-14bf-4399-8277-5b764711d385
6
@EventHandler public void SnowmanSpeed(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.getsnowgolemConfig().getDouble("Snowman.Spee...
e40802a9-3736-4a85-8769-b54555612b2e
5
public void startElement(String name) { if ("DICTIONNAIRE".equalsIgnoreCase(name)) etape = DICTIONNAIRE; else if ("MCD".equalsIgnoreCase(name)) etape = MCD; if (etape == DICTIONNAIRE) return; if ("ENTITE".equalsIgnoreCase(name)) { las...
32b07300-9636-4479-b2e0-91cccca7f783
9
private void procRN(){ if(isCurrentTokenType(TokenType.IDENTIFIER)|| //R -> '<IDENTIFIER>' isCurrentTokenType(TokenType.INTEGER)|| //R -> '<INTEGER>' isCurrentTokenType(TokenType.STRING)){ //R-> '<STRING>' } else if(isCurrentToken(TokenType.RESERVED, "true")){ //R -> 'true' => 'true' cr...
f469262f-a225-4b6b-8b35-60a854f32e5e
5
protected boolean getSubCommand(CommandSender sender, String[] args) { if (args.length >= 1) { if (ArenaLocation.getEntrada() == null) { sender.sendMessage(getMessage("Message11")); } else if (ArenaLocation.getSaida() == null) { sender.sendMessage(getMess...
36f3a727-2e8b-4be5-898c-7c6aac8dd268
6
private Constructor<?> findInjectableConstructor(Class<?> type){ Constructor<?>[] constructors = type.getConstructors(); for (Constructor<?> constructor : constructors) { if(constructor.isAnnotationPresent(InjectConstructor.class)) return constructor; } return null; }
06e18e80-eb2d-4117-8072-e8354bda0eaf
0
public CheckResultMessage checkE04(int day) { return checkReport.checkE04(day); }
400102b5-1fe2-43ce-b6d1-17c8fb55e157
6
@SuppressWarnings("unchecked") public boolean equals(final Object other) { if (!(other instanceof Pair)) return false; final Pair otherPair = (Pair) other; if (first == null) return otherPair.first == null && second.equals(otherPair.second); else if (second ...
5b893bf4-fe36-4054-80c0-59d0eaedfecc
0
public void setjLabelDateRapport(JLabel jLabelDateRapport) { this.jLabelDateRapport = jLabelDateRapport; }
1d5d0032-858c-4a1c-8df0-512cc5034e48
5
@Override public void shutdown() { try { if (em != null && em.isOpen()) em.close(); if (emf != null && emf.isOpen()) emf.close(); } catch (IllegalStateException ex) { logger.log(Level.SEVERE, ex.toString()); } }
5c0c7979-73ac-4eec-8c3a-049c447604f3
2
private static String setTitleLine(String title, int lineSize) { String titleLine = "|"; while(titleLine.length() < (lineSize - title.length())/2) { titleLine += ' '; } titleLine += title; while(titleLine.length() < lineSize - 1) { titleLine += ' '; } titleLine += '|'; return titleLine; }
3ddffe33-fa77-4f0d-bd0c-d2d39a89b02c
5
public boolean canWarpTo(MapleCharacter player, int mapid) { if (player.isChunin()) { return true; } if (cannotWarpTo(player, mapid)) { return false; } if (!canWarpFrom(player)) { return false; } if (isJQMap(mapid) || isPQMap(ma...
1b490af1-3182-4775-b2ce-a0ca05b416aa
3
public String getPiecesStr(){ if(getPieces() == null){ return null; } BASE64Decoder dec = new BASE64Decoder(); try{ byte[] b = dec.decodeBuffer(getPieces()); StringBuilder sb = new StringBuilder(); for(int i = 0; i < b.length; i++){ ...
ec9b38c9-da89-480f-b779-76f086932ef2
8
public double runTest(int testID){ double pointsEarned = 0; System.out.println( "Test " + testID + " : " + testNames[testID] ); try{ switch( testID ){ case 1: pointsEarned = test1(); break; case 2: pointsEarned = test2(); break; case 3: pointsEarned = test3(); break; case 4: ...
d764ad67-69bf-4799-b8a8-f7aa005baa56
9
public Map(String name, short x, short y, MapData map) { this.type = Type.None; this.name = name; this.size = new short[]{x, y}; if (map != null) { this.starts = map.startLocationList.size(); this.geysers = map.geyserList.size(); this.minerals = map.mineralFieldList.size(); ...
c34cb690-6c60-453c-a8aa-1abcbc2d8e01
6
public static void countVowel(String s) { int aCount = 0; int eCount = 0; int iCount = 0; int oCount = 0; int uCount = 0; for(int i=0; i<s.length() ;i++) { switch(s.toLowerCase().charAt(i)) { case 'a' : aCount += 1; break; case 'e' : eCount += 1; break; case 'i' : iCoun...
6e369092-6172-4840-9fc0-c0e697f266dc
1
protected String calsBS_OEMNAME() throws IOException { byte[] bTemp = new byte[8]; for (int i = 3;i < 11; i++) { bTemp[i-3] = imageBytes[i]; } BS_OEMNAme = new String(bTemp, "UTF-8"); System.out.println(BS_OEMNAme); return BS_OEMNAme; }
e631775a-c598-4cc7-86f3-d901cf3e1019
2
public Cds findMatchingCds(Exon exon) { for (Cds cds : cdss) if (exon.includes(cds)) return cds; return null; }
b3644c52-4338-4a24-871f-e58311de8454
3
public void mainMenu() { System.out.println("What has happened in the real world?"); System.out.println("1: Print Warehouse Inventory"); System.out.println("2: Check Item Quantity"); System.out.println("3: Recieve Shipment"); int input = scanner.nextInt(); switch (inp...
8a9035a5-4172-40f7-824e-4482a8dd1b2d
0
public Iterator<Equivalence> iterator() { return equivalenceList.iterator(); }
907139fe-edd8-45f6-90f6-23876e4cebdb
2
private static byte char64(char x) { if ((int) x < 0 || (int) x > index_64.length) return -1; return index_64[(int) x]; }
daba64ae-235d-4839-9d35-60a76e2886ab
1
public int getStateInt() { if (oState == null) return 0; return oState.getStateID(); }
6fd71e72-64c9-4d0e-b578-e2125692b0c3
6
public int findPalindrome(String A){ char [] chars = A.toCharArray(); //Convery string to character array.. int [][]LP = new int[chars.length][chars.length]; //LP[i][j] - length of palindrome from ith index to jth index // all the characters in the string are palindrome by itself of length 1. //So all LP[i]...
a0e8c66b-dc14-4678-a601-3befda6fc799
6
public static void restoreIpAddressesHelper(String s, ArrayList<String> list, ArrayList<ArrayList<String>> resultLists) { if (s.length() > 12) { return; } if (s.length() == 0) { resultLists.add(list); return; } // less than if (s.length() >= 1) { ArrayList<String> newList = copyArrayList(list...
21f2d93c-18db-4638-888e-4df75f028de3
3
public MainWindow() { setTitle("AMPA S.A."); this.now = this; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 657, 462); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnAlumno = new JMenu("Alumno"); menuBar.add(mnAlumno); JMenuItem mntmAadirAlumno = new JMenuIte...
09506786-48ff-41a5-910c-cf596730c5c9
0
public LinkedListStorage() { internalStorage = new LinkedList<String>(); }
cf6452d7-ad31-4111-a20f-2eb445a21769
3
protected void setDocumentRoot( File newDocumentRoot ) throws NullPointerException { if( newDocumentRoot == null ) { this.logger.log( Level.SEVERE, getClass().getName(), "[Init] Cannot set DOCUMENT_ROOT to null!" ); throw new NullPointerException( "Cannot set DOCUMENT_ROOT to null!" ); } ...
c5a8050b-829a-48fa-9cec-5cea052affae
1
public boolean keydown(KeyEvent ev) { if(cmdline != null) { cmdline.key(ev); return(true); } return(super.keydown(ev)); }
60b80751-c5a7-444c-a9f8-3367b7df5c8d
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
c904f22b-8499-42a9-937d-55eeb697dd18
1
private void notifyOfRowAdditions(Row[] rows) { for (OutlineModelListener listener : getCurrentListeners()) { listener.rowsAdded(this, rows); } }
9966df7d-457b-4de2-bb14-d781cfa7f5af
2
public static final boolean isIntegral(BigDecimal d) { return d != null && (d.scale() == 0 || d.setScale(0, RoundingMode.FLOOR).compareTo(d) == 0); }