method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
47ec85b8-af79-4877-ab9a-b596ffcb4666
5
@Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } inusetime=50; inuse = true; rinuse = true; if(engine.getPhysics().canMove(this, this.getLocation().getX(), this.getLocation().getY())) inusetime--; while(inusetime >= 0){ ...
a078c72a-439a-41cf-bd31-feac7e352dd7
1
public void testWithFields3() { Period test1 = new Period(0, 0, 0, 0, 0, 0, 0, 9, PeriodType.millis()); Period test2 = new Period(1, 2, 3, 4, 5, 6, 7, 8); try { test1.withFields(test2); fail(); } catch (IllegalArgumentException ex) {} assertEquals(new Peri...
bd2a8c13-1ab4-4093-97b6-b0f3665fc5ef
0
public String getCode() { return code; }
facfbba6-b6f0-4d47-a95d-928c0657d499
1
public int getCount(ArrayList<FilterBean> hmFilter) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getCount("entrada", hmFilter); oMysql.desconexion(); return pages; } catch (Exception e) { throw n...
4901480b-1e07-458c-b670-1823873dc4df
2
public AbstractInsnNode current() { return (index < 0 || index >= instructions.length) ? null : instructions[index]; }
24a9a38d-ce95-4ce2-8909-7e2e833e7277
5
private Integer s_to_int(String s) { if (s.equals("Integer")) { return 0; } if (s.equals("String")) { return 1; } if (s.equals("Date")) { return 2; } if (s.equals("Boolean")) { ...
228b8703-e81e-452a-a01c-0ba0f381661a
3
@Override public byte[] getNextBlock() throws InterruptedException, NodeClosedException { synchronized (monitor) { while (!Thread.currentThread().isInterrupted()) { byte[] data = getNextBlockDirectly(connection.getBlockSize()); if (data != null && data.length > 0) { return data; } //System....
e3ee0279-e0c1-441d-9c7a-650c6bbbd570
2
public static String formateString(String str, String... params) { for (int i = 0; i < params.length; i++) { str = str.replace("{" + i + "}", params[i] == null ? "" : params[i]); } return str; }
539fa5ae-9f68-4fc2-b5f2-5eddca64fa6a
6
public static void main(String[] args) { if (args.length == 1) if (!args[0].contains(".")) { char[] n = args[0].toCharArray(); final StringBuilder sb = new StringBuilder(String.copyValueOf(n)); for (int j = 1; j <= (n.length/3); j++) if (n.length - 3 *...
9060eb32-5772-46bb-951b-526b0b438e96
8
private void kaverilleMahdollisetAvecitPisteyttamattomista(Sitsaaja sitsaaja, boolean onkoSukupuoliVaihdettu) { List<Sitsaaja> tmp = sitsaajatIlmanpisteita; for (int i = 0; i < tmp.size(); i++) { if (tmp.get(i) == null || onkoSitsaajaJoPlassattu(tmp.get(i)) || ovatkoSitsaajatSamaaSukupuolta...
36ef5e19-3ae7-448a-9667-ddf1693b5bec
1
private String parseString() { StringBuffer sb = new StringBuffer(); for(int digit: digits){ sb.append(digit); } return sb.toString(); }
ed32b499-5f79-417d-8904-1140a19f52f9
5
private void populateTable() { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(xml); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("record"); Stri...
587efaaf-d68f-4f10-8a2f-b0a2783a5a15
0
public void setState(State state) { this.state = state; }
6456f199-2800-43d2-9cd4-b828990d2a12
6
@Override public void commandReceived(String command) { String[] argData = command.split(" "); argData[0] = Character.toUpperCase(argData[0].charAt(0)) + argData[0].substring(1); String[] args = new String[argData.length - 1]; System.arraycopy(argData, 1, args, 0, args.length); try{ Class<?> className =...
22db4549-8fba-4401-a27e-d9d7195cbb12
4
private void createGameObjects(MansionArea room, Face direction){ List<DrawnObject> obs = new ArrayList<DrawnObject>(); //loop through objects on wall, and resize them for (GameMatter item : room.getItems()){ if (item instanceof Bandit){ //bandits dont get drawn on walls continue; } if (it...
c3e1462d-a188-47ce-9e93-5165a6d1c3ab
1
public final void setCustNo(String custNo) { if(custNo.length() != custNoSize){ throw new IllegalArgumentException(); } this.custNo = custNo; }
3d4ad851-102b-462d-bc0d-a527de695458
5
private void initlocaleBtn(Color bg) { this.localeBtn = new JPanel(); this.localeBtn.setBackground(bg); this.localeBtn.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); // position Position pos = this.skin.getLocaleButtonPosition(); boolean[] active = { true, true, ...
5cfcc084-8721-4453-8b18-3e31c395bca7
8
static private final int collapseStart(String s) { for (int i = 0, len = s.length(); i < len; i++) { switch (s.charAt(i)) { case ' ': if (i == 0 || s.charAt(i - 1) == ' ' || i == len - 1) return i; break; case '\r': case '\n': case '\t': return i; ...
06fb2b8c-832f-42d3-beb9-ef237db19e3b
7
private int findIndex(int key) { int[] keys = this.keys; if (keys != null) { int fraction = key * A; int index = fraction >>> (32 - power); int entry = keys[index]; if (entry == key) { return index; } if (entry != EMPTY) { // Se...
ded40f0d-2599-4c27-872f-c2a32bc5854b
0
public void mouseClicked(MouseEvent e) { // do nothing }
66003e63-e4bc-4964-aa68-4857dd0c6021
1
protected Transition createTransition(State from, State to, Node node, Map e2t, boolean bool) { String s = (String) e2t.get(TRANSITION_READ_NAME); if (s == null) s = ""; // Allow lambda transition. return new FSATransition(from, to, s); }
1e3b0bb0-0d11-49fb-a60b-c9f5d528d689
8
@EventHandler(priority=EventPriority.LOW) public void mobDeath(EntityDeathEvent event) { int length = MCListeners.getSpawnDist(); LivingEntity mob = event.getEntity(); Player play = null; if((mob.getKiller() instanceof Player)) play = mob.getKiller(); else ...
8e0ce88b-965c-4b6c-850d-badefe5a618a
4
public static boolean containsItem(String parserURL) { try { BufferedReader in = new BufferedReader( new InputStreamReader(new URL(parserURL).openStream())); String text = ""; String inputLine; while ((inputLine = in.readLine()) != null) ...
e9bbdf58-eb66-4374-a48c-841654309e71
4
public boolean isCaseValide() { if (this.getPosX() < 0 || this.getPosY() < 0) return false; if (this.getPosX() > NB_CASE_X-1 || this.getPosY() > NB_CASE_Y-1) return false; return true; }
b337d11c-d10e-4fc4-b61a-f59215d2e73d
5
public static String getStaticCreeperhostLink (String file) { String resolved = (downloadServers.containsKey(Settings.getSettings().getDownloadServer())) ? "http://" + downloadServers.get(Settings.getSettings().getDownloadServer()) : Locations.masterRepo; resolved += "/FTB2/static/" + fi...
5b2baf7d-d980-4f1f-8264-7fc58ff48782
3
public ArrayList<Sensor> getSensorList() throws SocketTimeoutException { ArrayList<String> sensorListString = new ArrayList<String>(); ArrayList<Sensor> sensorList = new ArrayList<Sensor>(); try { clientSocket.Escribir("LISTSENSOR\n"); serverAnswer = clientSocket.Leer(); sensorListString.add(serverAnswer...
dc9f66d9-2eec-4c85-9260-ef65dbe9f703
3
private RBNode successor(RBNode x) { if (x.hasRightChild()) { return x.getRightChild().minNode(); } else { RBNode y = x.getParent(); while (!y.isNil() && x == y.getRightChild()) { x = y; y = y.getParent(); } retu...
50d7b63f-9f87-4909-952e-efbf383b3ee3
7
static final void method547(int i, boolean flag, String s, Color color, int j) { try { Graphics g = NPC.gameCanvas.getGraphics(); if (Class142_Sub8_Sub39.aFont4515 == null) { Class142_Sub8_Sub39.aFont4515 = new Font("Helvetica", 1, 13); Class90.aFontMetric...
4cc03274-a1de-4f61-ba40-64c9cd26151b
1
void moveCollidableObjects(){ for(collidableObject tempObj : listWrecks){ tempObj.update(screenWidth, screenHeight); } }
d68d9002-ed56-49b1-9dc1-25f80de0bb2d
1
public static void displayAllRecordInfo() { int x = 0; System.out .println("Displaying Record: NickName, ServerOwnerNickName, ServerStatus."); for (x = 0; x < allDirRecords.size(); x++) { DirRecord currentRecord = allDirRecords.get(x); System.out.println(currentRecord.getUserNickName() + " " + curr...
64fcd9f4-921c-44b8-b1bd-1ab99a42c8f7
7
private void updateTask(HashMap<Keyword, String> parameters) { String start = ""; String end = ""; String newContent = ""; String isCompleted = ""; String key = parameters.get(Keyword.CONTENT); if (parameters.containsKey(Keyword.NEWCONTENT)) { newContent = par...
ac272fbf-4487-42d6-8bc5-02d726ef3970
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
f2ab0970-1afa-487d-8309-97d69ef6a934
9
private void constructPackagesSection( ResourceBundle bundle, Sink sink, Map suitePackages ) { NumberFormat numberFormat = report.getNumberFormat(); sink.section1(); sink.sectionTitle1(); sink.text( bundle.getString( "report.surefire.label.packagelist" ) ); sink.sectionTitle...
3337a4d0-f19d-4ea1-80a2-b32cf0c5debd
2
public void checkStock(){ if (this.stock<this.minS && this.listOrderArrival.peek()==null) { Customer c= new Customer("-1",this.clock+5+Math.random()*2,this.maxS-this.stock); this.addEvent(new Event(c,1,c.getArrivalTime())); } }
919b5e02-db9b-4515-83f2-199abf5b54b4
5
public void prepend(int i, String str) { int len = str.length(); int newsize = this.size + len; // If there's insufficient capacity, make a new array, // leaving space for the string to be prepended. if (newsize >= this.contents.length) { char[] oldcontents = this.contents; ...
1924e468-dee5-4ed7-9685-622c097179a2
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
521a1f78-8b9d-4de3-bfbf-0d46ad7f885d
7
private AlgebraicParticle construct(Map<AlgebraicParticle, Integer> map) { Set<Entry<AlgebraicParticle, Integer>> set = map.entrySet(); if(set.size() == 0) return Number.ONE; //keep track of coefficient (will be multiplying integer factors shortly) int coefficient = 1; //check for a factor of negative o...
09f14d33-2f30-457b-83ab-2bebc022bd5b
5
void checkMotif(String genomeVer, String vcfFile, String effectDetails, EffectImpact impact) { String args[] = { "-classic", "-v", "-motif", "-ud", "0", genomeVer, vcfFile }; SnpEff cmd = new SnpEff(args); // Run SnpEffCmdEff cmdEff = (SnpEffCmdEff) cmd.snpEffCmd(); List<VcfEntry> vcfEntries = cmdEff.run(tru...
f6a2b93f-703c-4bf6-ba8e-d1cd4f512fff
3
@Override public void drawDown(Point p, Node node) { this.node = node; // Adjust color when we are selected updateColors(); // Update the button updateButton(); // Update font updateFont(); // Draw the TextArea setText(node.getValue()); int indent = node.getDepth() * pIndent; i...
ed011be2-7f8f-47b7-8b11-810ff5eb3cb7
8
public java.util.Date asUtilDate() { try { if (isNull()) { return null; } else if (isUtilDate()) { return (java.util.Date) value; } Calendar cal = Calendar.getInstance(); if (isTimestamp()) { Timestamp ts = (Timestamp) value; long date = ts.getTime(); int nanos = ts.getNanos(); ...
58853852-0d73-4403-adc3-a68abebbe158
5
public String getQualifiedName() { if (this.module == null || this.module.getName() == null) { return name; } if (this.module.getName().equals("core") || this.module.getName().equals("filters") || this.module.getName().equals("elements")) { return "kurento." + name; } else { re...
e8262646-8a6a-47b5-96b5-cd7fa3ee122f
5
public static void extractAndLaunch(final String s) throws Exception { int updateLevel = hasUpdate(); if(updateLevel == 1) { contentPane.remove(loginPart); JPanel confirmUpdatePane = new JPanel(); confirmUpdatePane.setOpaque(false); confirmUpdateP...
cb520c7d-d82a-4d16-8355-d07a01da5a67
5
public String decrypt(String word){ if(word == null) throw new IllegalArgumentException(); String result = ""; String wordLower = word.toLowerCase(); for(int i=0; i<wordLower.length(); i++){ if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122) throw new IllegalArgumentException(); int k = (wordLower.ch...
a85ad97d-95ae-4a8a-b1ac-9dd07b3e36b3
0
public Event(String eventName, String[] eventDescription, ActivityTypes activityType,ActiveActivities activeActivities, PassiveActivities passiveActivities, AgeCategories ageCategory, Beverages beverage, Cost cost, Day day, Daytime daytime, DressCode dressCode, EventTypes eventType, MusicLoudness musicLoudness, MusicTy...
5c51c8e5-fb76-4e62-b0d0-7bef2ebc3778
2
public static void close() { log("Log closing"); try { fileWriter.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { fileWriter.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
b82e7f11-1ce2-473a-bc67-643e1280951a
6
private AsciiBytes decode(String source) { int length = (source == null ? 0 : source.length()); if ((length == 0) || (source.indexOf('%') < 0)) { return new AsciiBytes(source); } ByteArrayOutputStream bos = new ByteArrayOutputStream(length); for (int i = 0; i < length; i++) { int ch = source.char...
d422d572-e0e3-47fd-8ab5-0ec34899d5b0
1
private JButton getJButton0() { if (jButton0 == null) { jButton0 = new JButton(); jButton0.setText("UPDATE"); jButton0.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton0MouseMouseClicked(event); } }); } return jButton0; }
ba7499cc-f731-447d-b3fc-004466b6cb0e
6
@Override public void run() { Citation c; io.println("Please enter citation type. " + "Supported types are \"book\", \"article\", \"inproceedings\" and \"misc\"."); while (true) { String command = io.getString("> "); BaseCitationGenerator citationGe...
aad7dfb6-33c3-4448-8ce7-1a812107cf63
3
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().compareTo("Save Item Prices") == 0) { dm.savePrices(); gmc.saveDialog(); } else //TODO: at the moment this just relates to changing workload, should be better way to do this { if (dm.itemExists(e.getActionCommand())) { Data...
0709c5df-25c1-41e4-b15b-7a2d94a1325e
1
private Configuration getConfigFileData(String filePath) { PropertiesConfiguration propConfig = new PropertiesConfiguration(); try { propConfig.load(filePath); return ConfigurationUtils.convertToHierarchical(propConfig); } catch (ConfigurationException configEx) { log.err...
ef6972b2-7935-48ed-8398-492d4576f149
1
public void pushFront(Object obj) { if (head == null) { head = tail = new Node(null, null, obj); } else { Node newNode = new Node(null, head, obj); head.setPreviousNode(newNode); head = newNode; } }
147b8303-526d-4ba8-b5f2-53e1535512d1
9
private void parseData(byte[] data, InetAddress address, int port) { String message = new String(data).trim(); PacketType type = Packet.getPacketType(message.substring(0, 2)); Packet packet = null; switch (type) { case INVALID: break; case LOGIN: packet = new Packet00Login(data); handleLogin((Packet...
4e50bb7b-8864-4ec8-b8c5-19c858efbf33
4
@Override public void run() { long lastTime = System.nanoTime(); double unprocessed = 0; int ticks = 0; int frames = 0; long lastTimer1 = System.currentTimeMillis(); init(); while (running) { long now = System.nanoTime(); unprocessed += (now - lastTime) / nsPerTick; lastTime = now; bo...
65e1fa46-0412-49a7-a260-2daca70989f9
6
@Override public void observe(Order o) { int battleP = 0; for (Clan m : o.getMembers()) { for (G_ g : KnowledgeQuests.equip) {int gi = g.ordinal(); if (m.getAssets(gi) > 0) {scores[gi]++;}} battleP += m.FB.getPrs(P_.BATTLEP); } for (G_ g : KnowledgeQuests.equip) {scores[g.ordinal()] *= battleP;} int i ...
ed68d038-c240-4fb5-946a-23d7201073aa
6
private void goButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goButActionPerformed try { location = locationTf.getText(); try { search.setCommand("SELECT * FROM properties WHERE city = ?"); search.setString(1, location); ...
cb91298a-57ec-4435-8e8d-167202ead39f
1
private boolean isRed(STNode<Key, Value> x) { if (x == null) return false; return x.color == RED; }
2daf3b42-0182-4d06-8c13-2487f47cccd9
2
public void setOption(String option, Collection values) { if (option.equals("value")) { if (values.size() != 1) throw new IllegalArgumentException( "Wildcard supports only one value."); wildcard = (String) values.iterator().next(); firstStar = wildcard.indexOf('*'); } else throw new IllegalArg...
bd700d3b-c76d-4944-919c-5b49e87b9972
3
public JPanel createPasswordPanel(){ passwordPanel = new JPanel(); passwordInput = new JPasswordField(); passwordInput.setText("Password"); passwordInput.setToolTipText("The password to open your wallet. Try something sneaky !"); passwordInput.addFocusListener(new FocusListener()...
dcbbc074-c670-4ff5-b97c-290687e2dda4
9
public Token[] tokenize(String input) { List tokens = new ArrayList(); int cursor = 0; while (cursor<input.length()) { char ch = input.charAt(cursor); if (Character.isWhitespace(ch)) { cursor++; } else if (Character.isLetter(ch)) { StringBuffer...
96c422d5-138a-4d46-a79b-832332cd0aef
9
protected void writeVerificationTypeInfo(verification_type_info info, ClassOutputStream out) { out.write(info.tag); switch (info.tag) { case ITEM_Top: case ITEM_Integer: case ITEM_Float: case ITEM_Long: case ITEM_Double...
088a3779-bf81-4f6f-a6e0-0ff1de1caf79
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
72577c35-95cb-4faa-a030-adfd2fd7b0a5
0
public static String getPublicKey(Map<String, Object> keyMap) throws Exception { Key key = (Key) keyMap.get(PUBLIC_KEY); return SecurityCoder.base64Encoder(key.getEncoded()); }
6e2b8adc-942d-41aa-8b82-f7edee096718
3
public int read(byte[] buffer, int offset, int length) { if (closed) { return -1; } int totalBytesRead = 0; while (totalBytesRead < length) { int numBytesRead = super.read(buffer, offset + totalBytesRead, length - totalBytesRead); ...
56922b52-796c-421d-a8b6-f7983dda72cc
7
public static boolean getStationsData(String pathName) { DocumentBuilderFactory docBuilderFactory; DocumentBuilder docBuilder; Document document = null; try { docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilder = docBuilderFactory.newDocumentBuilder(); document = do...
e18721a9-61c7-4b09-a709-21ac53729de1
6
public Resource getFromName(String name) { if (Config.LOGD) Log.d(TAG, "getFromName name=" + name); PreparedStatement statement = null; try { statement = mConnection.prepareStatement(SQL_SELECT_FROM_NAME); statement.setString(1, name); ResultSet resultSet = st...
fc60ed5b-b14a-4f0d-8463-393f9fe20ef7
5
private Class<? extends User> findUser(String userId) { for (Class<? extends User> c : listOfUsersAccounts.keySet()) { for (IUser b : listOfUsersAccounts.get(c)) { if (b.getID().equalsIgnoreCase(userId)) { return c; } } } return null; }
e19a7549-215c-4113-871c-add1d242a188
9
void getTerms(EnergyFunction ef,HashMap<Integer,double[]> termMap, double coeff){ //get the appropriate VDW terms from ef, which has coefficient coeff in the energy, //and put them in termMap if(ef instanceof ForceFieldEnergy){//The terms are only in ForceFieldEnergies ...
ceca63bb-9c4b-44d3-8dc5-c9a25bbbae3a
7
@Override public DeadBody killMeDead(boolean createBody) { // ===== move all inhabitants to the dragons location // ===== loop through all inhabitants of the stomach Room room = location(); if(room == null) room = CMLib.map().getRandomRoom(); if((Stomach!=null)&&(room != null)) { final int morselCou...
d78cc97a-f650-4a69-9eef-c08a62402a8f
0
protected static Map<String, String> getColumns() { Map<String, String> columns = SQLPermissionBase.getColumns(); columns.put("groups", "TEXT"); return columns; }
feb6f159-c46b-4b2b-9694-209c141f1c43
1
public void setShutdownMenuFontsize(int fontsize) { if (fontsize <= 0) { this.shutdownMenuFontSize = UIFontInits.SHDMENU.getSize(); } else { this.shutdownMenuFontSize = fontsize; } somethingChanged(); }
8de0b90f-c49b-484a-a8a1-fec3dbd99c3d
6
public void newDeduction(Formula proven) { for(Class<? extends ForwardRule> rule : ForwardRule.forwardRules()) { try { //Check if our formula matches the Class appropriate for the rule. if(Reflection.formulaClass(rule).equals(proven.getClass())) { // Check to see if the rule needs to check anything. (...
00c7e2f9-f3f3-4de9-b815-4355c2e35872
9
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TransformedGenerator<?, ?>)) { return false; } TransformedGenerator<?, ?> other = (TransformedGenerator<?, ?>) obj; return other.getWrappedGene...
5bab4091-a906-4e02-993b-d0c016a3efdd
1
protected JPopupMenu buildTableMenu() { JPopupMenu ans = new JPopupMenu(); String[] show = { "", "ɾ", "޸" }; String[] action = { "add", "remove", "modify" }; int i; for (i = 0; i < show.length; ++i) { JMenuItem item = new JMenuItem(show[i]); item.setActionCommand(action[i]); item.addActionListener(th...
29e1c083-886e-4198-a72e-b37502b50e71
4
public String interpret(Symtab st) { String result = ""; if (arg_list != null && argument != null) { result += arg_list.interpret(st); result += ", "; result += argument.interpret(st); } else if (arg_list == null && argument != null) { result += argument.interpret(st); } return result; }
fec0e976-8310-49d3-9994-f194e9870c0b
1
public static void debug(String string){ if(developerMode){ System.out.println("DEBUG: " + getClassName() + ":" + getMethodName() + "():" + getLineNumber() + ": " + string); } }
e4d17a0a-7bcb-446f-bed4-fd77c1b0362e
0
public Fetcher(RequestWrapper requestWrapper) { this.setRequestWrapper(requestWrapper); }
840b4b54-4ac7-452b-8713-389edefdce51
2
public void decodage() { //Trie du code codeSort = new ArrayList<>(code); Collections.sort(codeSort); System.out.println("Code trié : " + codeSort); System.out.println("Position : 0 1 2 3 4 "); System.out.println("Code : " + code); S...
63378a50-77d8-43ba-951c-10493058df45
8
private String convertToRawValue(Object obj, Class<?> returnType) { for (Annotation annotation : returnType.getDeclaredAnnotations()) { if (annotation instanceof Parseable) { Class<? extends StringParser<?>> parseclass = ((Parseable)annotation).parser(); StringParser...
92b09109-dfaa-49be-9119-2bb6322a58dc
2
public static boolean hasRemainingPokemon(Pokemon[] p, int numOfPokemon) { for(int i=0; i<numOfPokemon; i++) { if(isAlive(p[i].health)) { return true; } } return false; }
6b8de2b4-22f4-45db-af5e-30089de86269
5
public static void ChapterIntro() { Player player = new Player(); API.sendMessage("You wake up and see a little boy standing above you."); API.delay(5000); API.sendMessage(" 'Hello, wake up!' "); API.delay(5000); API.sendMessage(" 'Who are you? ' "); API.delay(5000); API.sendMessage(" Enter name: "); ...
40ecec95-6536-4377-a49a-aa1fbb9d3cdf
9
public static void execSQL(){ String model = resource.getProValue("dbMode"); if("1".equals(model)){ return ; } String space = resource.getProValue("dbTableSpace"); String index = resource.getProValue("dbIndex"); String table = resource.getProValue("dbTable"); ...
308f344c-cb60-4f32-8578-669ffbf95c94
5
public static void print(GraphNode node) { if (null == node) return; List<GraphNode> nodes = new ArrayList<GraphNode>(); int index = 0; if (null != node)nodes.add(node); while (index != nodes.size()) { GraphNode n = nodes.get(index); System.out.print(n.lab + "("); for (GraphNo...
06a1fa0e-1a0f-4068-b773-99fc9ff98b2d
4
public void run() { /* You fill this in */ while (true) { print("Input int:"); int current = readInt(); if (current == 0) { println("Largest: " + largest); println("Smallest: " + smallest); largest = 0; smallest = Integer.MAX_VALUE; continue; } if (current > largest) { la...
d20b6510-1235-487c-908a-05055508e0db
3
public void sort(Map map){ for(int i = 0; i < map.id.length; i++){ for(int j = i+1; j < map.id.length; j++){ if(map.id[i] > map.id[j]){ swap(i, j); } } } }
f7b840aa-732d-43a5-b2d4-5e481d15115f
0
public String getDate() { return date; }
f9aafd6a-e64a-499f-8452-14874548d937
1
public VerifyMoveDone verify(VerifyMove verifyMove) { try { checkMoveIsLegal(verifyMove); return new VerifyMoveDone(); } catch (Exception e) { return new VerifyMoveDone(verifyMove.getLastMovePlayerId(), e.getMessage()); } }
05d5d11b-cea3-4743-8c3b-9fb1c3d555d4
8
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) { Assert.notNull(clazz, "Class must not be null"); Assert.notNull(methodName, "Method name must not be null"); if (paramTypes != null) { try { return clazz.getMethod(methodName, paramTypes); } catch (NoSuchMetho...
c536c91b-9ccd-4c12-a804-8e69939ac46f
8
public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { if(success == true) { nextQuestion(); return; } Toolkit.getDefaultToolkit().beep(); e.consume(); return; } if(e.getKeyCode() == KeyEvent.VK_F5) { switchFullscreen(); } if(e.getKeyCode() == K...
29442b8b-db9c-4ae8-9513-f462fd470861
6
public int readPcm(byte[] buffer, int offset, int length) throws IOException { synchronized (streamLock) { final int channels=identificationHeader.getChannels(); if(lastAudioPacket==null) { lastAudioPacket=getNextAudioPacket(); } if(currentPcm==null || currentPcmIn...
e9c2dda5-3f70-4b7d-a7a4-050d1173cf56
5
final void method1716(boolean bool) { if (bool != false) renderCores = 46; if ((((Class239) this).anInt3138 ^ 0xffffffff) != -1 && ((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136) .aClass239_Sub9_7256.method1759(-32350) != 1) ((Class239) this).anInt3138 = 0; anInt6007++; if (((Class239)...
02de3cd0-6539-425a-a0bd-8380d49b8c92
8
public JSONObject processRegisterTag(String USER_NAME,String EMAIL,String Password) { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); //Check if USer Alrady exists rs1=stmt.executeQ...
b52f914b-3c7f-42d0-b850-cf24e5e964ea
4
public Booking getBookkingByConf(String authToken, int confNo) throws AccessException{ if(authToken != "abcd1234") throw new AccessException("Access denied"); ArrayList<Renter> allRenters = (ArrayList<Renter>) this.getRentersList(authToken); for(int i = 0; i<allRenters.size(); i++){ Renter temp1 = (Rente...
5559dff9-284a-4190-94de-ae6bf9ef93ec
7
protected int[] getWrongAttr(int num){ int[] arr=new int[num]; for(int i=0;i<num;i++){ arr[i]=-1; } for(int i=0;i<num;i++){ do{ arr[i]=(int)(Math.random()*this.numEventAttributes); if(arr[i]==numEventAttributes){ ...
6554216e-ca35-4698-9a50-bfc60fa7e72d
6
@RequestMapping("/search.do") public ModelAndView searchList(Device device, HttpServletRequest req) throws Exception { int rows = 16; int pageBlock = 10; String path = "search.do"; String pageCode; // xml에 keyword 값을 추가 하기 위한 변수 String keyword = null; // 검색창에 입력한 문자열을 받아오는 변수 String search = req.getPar...
8a29dfe2-025d-4722-b3dd-dda34ec80353
7
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int[] v = retInts(line); int pos = 0; for (int ...
b1899a12-4e0c-496c-a8c9-907605bf1889
8
private int collectGrains(int[][] chessboard) { int maxGrains = 0; for (int i = 0; i < chessboard.length; i++) { for (int j = 0; j < chessboard[i].length; j++) { if (i > 0 && j > 0) { chessboard[i][j] += Math.max(chessboard[i - 1][j], chessboard[i][j - 1])...
ba15c05e-ab9a-4b49-9629-942e7d986e53
1
public static AbstractCarriage generateLocomotive() { AbstractCarriage carriage = null; try { carriage = LocomotiveFactory.newCarriage( new RandomEnum<LocomotiveType>(LocomotiveType.class).random(), generateId(), generateNumber(), generateMaxSpeed()); } catch (CarriageException e) { LOG....
6567e21c-56db-4b59-b8c4-3f30282232f9
3
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); ...
9271652c-b999-4df3-a284-de27a4d555cd
5
@Override public int addFutureMeeting(Set<Contact> contacts, Calendar date) { int id = 0; Calendar now = Calendar.getInstance(); Meeting newFutureMeeting = null; //check date against current date to determine if in the past if (date.getTime().compareTo(now.getTime()) < 0) { ...
243917dd-bb74-4f48-9503-2e488a147277
8
public static void main(String[] argv) { try { System.out.println("connection_server booting..."); for (int j = 0; j < argv.length; j++) System.out.println("argv[" + j + "] = \"" + argv[j] + "\""); if (argv.length != 4) { System.out.println("Wrong number of arguments!"); System.exit(1); } ...