method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3c9feab3-7d4c-4c20-9aac-8a2654ce8e5a
2
public void setState(State _state) { if(getWidth() > 0 && getHeight() > 0) { getGui().setVisible(false); state = _state; getGui().setVisible(true); }else{ ServerHelper.log(LogType.GUI, "GuiManager: setState wurde vor setBounds aufgerufen"); ...
10b29d9d-7023-4970-b7bc-597d4310e58b
3
public Object get(int index){ if(index <= 0){ return null; } Node current = head.getNext(); for(int i = 0; i < index; i++){ if(current.getNext() == null){ return null; } current = current.getNext(); } return current.getData(); }
e9130ddd-93c1-40e7-a9ae-27c7154f88bb
9
public void startupMapHook() { super.startupMapHook(); boolean nodeExport = Tools.safeEquals("node", getResourceString("export_type")); HashMap transcodingHints = null; List selecteds = getController().getSelecteds(); Vector documentsToOpen = new Vector(); ...
65cb754c-2f78-4743-8db3-cecab9c93be5
5
private ArrayList<Integer> selectPondaratedRandomIndexesFromList(Integer number, List<Kanji> kanjis) { ArrayList<Pair<Double, Kanji>> weighedKanjis = new ArrayList<Pair<Double,Kanji>>(); Double totalWeight = 0.; for(Kanji k : kanjis) { totalWeight += k.getWeight(); weighedKanjis.add(new Pair<Double, Kanj...
72fe6a7a-db93-4470-a0e0-914a6f3af64b
9
public void dinTur() { if(loading == 0 && actraiser2 == Consts.KANON) { loading = Consts.KANONLOADING; actraiser2 = Consts.RADAR; kanon[0] = new Vektor2D(Math.cos((double)actraiser/10), Math.sin((double)actraiser/10)); ...
d21c4f32-1cfb-4455-a0bd-70acb985795e
0
@Test public void validationIntegerWithDoubleNegativeTest() { view.getNumberOfPointsTextField().setText("11.6"); view.getNumberOfPointsTextField().getInputVerifier().verify(view.getNumberOfPointsTextField()); assertFalse(view.getDrawButton().isEnabled()); }
6da2afe8-1f01-45d7-ae3d-544205137bbf
9
private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3R_45()) { jj_scanpos = xsp; if (jj_3R_46()) { jj_scanpos = xsp; if (jj_3R_47()) { jj_scanpos = xsp; if (jj_3R_48()) { jj_scanpos = xsp; if (jj_3R_49()) { ...
88365454-1ea2-4081-9307-196dce62712f
5
public TreeNode findRecursive(TreeNode root, int n) { TreeNode temp = null; if (root == null) { return null; } if (root.left == null && root.right == null && root.info > n) { return root; } if (root.info < n) { temp = root; findRecursive(root.right, n); } else { temp = root; findRecursiv...
671dae95-f5e0-4069-8121-a9f77029ee8c
9
private boolean ContainSameDigits(int n1, int n2) { char[] n1String = Integer.toString(n1).toCharArray(); char[] n2String = Integer.toString(n2).toCharArray(); if (n1String.length != n2String.length) { return false; } for (int i = 0; i < n1String.length; i++) { ...
defcc256-8e06-44c3-a637-e365ae1d7fa4
1
public boolean equals(Object o) { // This probably has the same effect as Object.equals, but that may change... if (o instanceof PircBot) { PircBot other = (PircBot) o; return other == this; } return false; }
b30325c1-e46e-4000-91a8-f13e4ef9e381
1
public static int getOptionValueAsInt(String option) { String value = CommandLineUtilities.getOptionValue(option); if (value != null) return Integer.parseInt(value); return -1; }
5b976a5e-081b-4162-9675-4da0a7c68ddb
5
public static ItemDefinition getDefinition(int id) { for (int i = 0; i < 10; i++) if (cache[i].id == id) return cache[i]; cacheIndex = (cacheIndex + 1) % 10; ItemDefinition definition = cache[cacheIndex]; stream.position = streamOffsets[id]; definition.id = id; definition.setDefaults(); definition...
477b04ad-d0c2-4297-88bc-c955071237ef
5
public boolean contentEquals(LastFmConfig other) { return nullEquals(getUser(), other.getUser()) && nullEquals(getPollInterval(), other.getPollInterval()) && nullEquals(getApiScheme(), other.getApiScheme()) && nullEquals(getApiBase(), other.getApiBase()) && nullEquals(getApiPath(), other.getApiPath()) ...
4352deef-543d-454e-9e02-561ae7a1ba20
0
public static void main(String args[]) { RegExMultiReplace sr = new RegExMultiReplace(args); }
850cf5a3-12ba-4d46-96ab-e91d0772a922
2
protected String getRandomOrderId(String prefix) { String orderId = null; Date date = new Date(); StringBuilder sb = new StringBuilder(); if (prefix != null) { sb.append(prefix); sb.append("_"); } SimpleDateFormat df = new SimpleDateFormat("MMkkmmssSSSS"); sb.append(sequence.getAndIncrement()); sb...
35fcfd86-78ed-4bcd-914c-07f990677d75
9
@Override public PaginationSupport<T> handle(ResultSet rs) throws SQLException { PaginationSupport<T> ps = new PaginationSupport<T>(); int cur = rsl.getStartPage() * rsl.getPageSize() + 1; // 计算第一行行号 boolean atLast = false; // 游标是否在最后一行后面了(结果集是否被取完) // 光标放置到第一行之前 if (cur > 1) { if (!rs.absolute(cur ...
91eaa738-44ed-4cb4-9aad-01756060dfff
8
public void handle(HotUserCrawlingEvent event) { //long timeMilli = System.currentTimeMillis(); try { List<User> users = SinaWeibo.getInstance().getHotUsers(); List<com.julu.weibouser.model.User> juluUsers = new ArrayList<com.julu.weibouser.model.User>(); for (User u...
77087312-670f-44d9-94cb-7800cb6172dc
2
String guessFields() { StringBuilder sb = new StringBuilder(); Field fields[] = getClass().getFields(); for (Field f : fields) sb.append(f.getName() + FIELD_NAME_SEPARATOR); // Remove last ';' if (sb.charAt(sb.length() - 1) == FIELD_NAME_SEPARATOR) sb.deleteCharAt(sb.length() - 1); return sb.toString(...
644cd7bf-e56e-4d87-9dea-5d7b5762463c
5
private PositionGetter makePositionGetter(final GenericOffice<?, ?, ?, ?, ?> computer) { return new PositionGetter() { @Override public Point getWorksheetPosition() { return computer.worksheet.getAccessLocation(); } @Override public Po...
9a667d22-76da-4f87-92da-e9533dc7bffb
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg....
59862a4e-8cf6-43d3-b7bf-c58edabe54d9
7
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 fe...
22679b72-2b55-41ee-90f5-248b43d29aa7
0
public boolean hasPendingMessage() { return pendingMessage != null; }
2e40f24e-1dee-4a5c-80c6-8e50b7847858
0
public void addName(int i, String s) { this.names.add(i, s); ((DefaultListModel) Outliner.findReplace.FIND_REPLACE_LIST.getModel()).insertElementAt(s,i); }
8122a131-308e-4a26-9ad0-cfa453c01342
4
public User build() { try { User record = new User(); record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]); record.favorite_number = fieldSetFlags()[1] ? this.favorite_number : (java.lang.Integer) defaultValue(fields()[1]); record.favori...
9bf5d873-c0f4-47f6-8f97-5186430e5d45
4
public static Object newInstance(Class<?> cl, Object[] args, Class<?>... constructParameterType) { Object obj = null; try { Constructor<?> constructor = cl .getConstructor(constructParameterType); obj = constructor.newInstance(args); } catch (Exception e) { return null; } return obj; }
12a90277-983c-4b9d-8b3b-74a32ffc3f33
8
public Number addNumbers(Number a, Number b) throws NumberClassNotFoundException { Number sum = null; if (a instanceof Double && b instanceof Double) { sum = new Double(roundDouble(a.doubleValue() + b.doubleValue())); // trimNumber(sum); } else if (a instanceof Integer && b ...
3dc982ab-e8da-4865-b0a6-557a6f0bdd8a
8
protected void paintComponent(Graphics g) { super.paintComponent(g); //If Product Text box is blank if(blankText){ g.setColor(Color.RED); g.drawString("Please enter a product",282,80); g.setColor(Color.black); blankText = false; } //If Email id Text box is blank if(emailFlag){ ...
358b8308-6f26-40da-a5a6-8789f3cc1cd2
2
@Test public void testPageIterator() throws IOException, TesseractException { ImageAnalyzerFactory factory = TestContext.getImageAnaylzerFactory(); try { ImageAnalyzer analyzer = TestContext.getImageAnalyzer(factory, TestContext.poetryImageFile); LayoutIterator i...
3cc6b1c1-c32c-459b-8e71-017b680a7904
6
private static int calculate_num_channels( byte[] module_header ) { int num_channels; switch( ( module_header[ 1082 ] << 8 ) | module_header[ 1083 ] ) { case 0x4b2e: /* M.K. */ case 0x4b21: /* M!K! */ case 0x542e: /* N.T. */ case 0x5434: /* FLT4 */ num_channels = 4; break; case 0x484e: /* xCH...
ffb98bda-d87b-4274-a214-514663ab0553
1
final public CycList genericSentence(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject pred = null; CycList args = null; pred = predicate(false); args = argumentList(false); args.add(0, pred); eof(requireEOF); ...
02949ba5-729e-4060-ac13-206b5c2ec8a4
5
public static void main(String[] args) throws UnsupportedAudioFileException { try { File file = new File("/Users/rawanfarwana/Documents/workspace/Test/bin/extractingFromMp3/test.wav"); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file); AudioFormat format = audioInputStream.ge...
ef659c61-fccc-4802-bcc6-e247902549af
2
public Item dequeue() { if (isEmpty()) throw new NoSuchElementException("Queue underflow"); Item item = first.item; first = first.next; N--; if (isEmpty()) last = null; // to avoid loitering return item; }
380fcea7-a760-46e8-8f93-525478b68685
1
public void shuffle() { for (int i = 0; i < deck.length; i++) { // Generate an index randomly int index = (int) (Math.random() * deck.length); int temp = deck[i]; deck[i] = deck[index]; deck[index] = temp; } log.debug("[" + Deck.class.getName() + "] shuffle() method"); }
a5030280-eca0-470f-ab75-c8ce176a8a4c
1
public static boolean configExists() { File file = new File(CONFIG_FILE); if (file.exists()) return true; else return false; }
4f41d3ab-ba89-445f-b00e-9e1bdee2afbc
9
int count_bit_short( int [] ix, int start, int end, int table ) { int i, sum; int x,y; if(table < 0 || table > 34) return 0; sum = 0; int ylen = this.ylen[table]; int linbits = this.linbits[table]; for ( int line = start; line < end; line += 2 ) { for ( int window = 0; window < ...
1d9a6f9b-9e22-47ae-933b-21a3f18dccb2
2
public static ArrayList<Category> showAll() { ArrayList<Category> category = new ArrayList<Category>(); Database db = dbconnect(); try { db.prepare("SELECT * FROM problem_category ORDER BY CategoryID"); ResultSet rs = db.executeQuery(); while(rs.next()) { category.add(CategoryObjec...
c6ad41b7-be33-41dc-838a-1233116d7831
2
public Enemy(int d, int spacing){ generalDirection = d; path = d; //For ammunition tracking enemyID = spacing; goldValue += waveNumber*2; int x = 0; int y = 0; if (path == BLUE){ x = 50; y = 300; velocityX = -speed; direction = LEFT; enemyColor = Color.BLUE; debuffedC...
ecc2a0b7-6a61-435d-bcd8-1019e187c507
2
public static List<Laureate> filterByYear(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getYear())) { ...
c06ca850-8174-4bcd-90cb-fb805dfcbc30
0
public Builder location(String location) { this.location = location; return this; }
21934eab-b78b-4c81-ab4f-87c3869c0add
6
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null) { return; } if (!Room.CheckRights(Main.Data, true)) { return; } Us...
cccf8f99-21f3-4888-acd9-2b9ad0f6b374
9
public static double[] toLab(final int red, final int green, final int blue, final double chromaWeight) { int ir = red ; if (ir < 0) ir += 1 << 8; int ig = green; if (ig < 0) ig += 1 << 8; int ib = blue ; if (ib < 0) ib += 1 << 8; double r = ir / 255.; r = r <= 0.4045 ? r / 12.92 ...
38887736-3a86-48bb-b2f2-008618450d2c
2
@Override public String toString() { StringBuilder b = new StringBuilder(); for(TLNode stat : statements) { b.append(stat).append("\n"); } if(returnStatement != null) { b.append("return ").append(returnStatement).append("\n"); } return b.toString(); }
8399a7ff-7dcd-423a-b926-a9a37e8498e6
9
public static void encodeMessage(final Message message,final OutputStream out) throws IOException { // Wrap a DataOutputStream for convenience. DataOutputStream dout = new DataOutputStream(out); // Check to see if there's more to encode. if (message.getLength() >= 1) { switch (message.getType()) { c...
7a1eeab7-b3fb-4ad0-8c5d-28b934ab5efc
7
private void processRectangle(RdpPacket_Localised data, RectangleOrder rect, int present, boolean delta) { if ((present & 0x01) != 0) rect.setX(setCoordinate(data, rect.getX(), delta)); if ((present & 0x02) != 0) rect.setY(setCoordinate(data, rect.getY(), delta)); ...
6b0dc8d3-d64c-4aa0-86d7-143e79530029
0
@Override public void show() { setCanceled(false); setMaximum(1); super.show(); }
f8a740d6-e11b-4431-8599-783ef2358416
7
public Date genernateSystemTime() { Timestamp systemTime = null; Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = dataSource.getConnection(); preparedStatement = connection.prepareStatement("select current_timestamp() "); result...
f9746c66-7b2e-4b0a-8ca0-0ae8190ba6c4
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...
61a64f9b-221e-4ce6-94bc-1f35309fb0bd
9
private JPanel createLastUsedSettingsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createTitledBorder("Zuletzt verwendete Einstellungen")); panel.setLayout(new BorderLayout()); _lastUsedSettingsTable.setRowSelectionAllowed(true); _lastUsedSettingsTable.setSelectionMode(ListSelectionMod...
3d29e9e1-d53d-4a0a-b4ac-33643de34433
8
public static void writeFile(String content, String fileName, String destEncoding) throws FileNotFoundException, IOException { File file = null; try { file = new File(fileName); if (!file.exists()) { if (file.createNewFile() == false) { throw new IOException("create file '" + fileName + "' failure.")...
4eaaba9f-24f1-4884-9fef-8baab4bcd53b
5
public Scheduler parse(String str) { Matcher m = msh.matcher(str); if (m.find()) { TimeUnit t = null; if (str.contains("m")) t = TimeUnit.MINUTES; if (str.contains("s")) t = TimeUnit.SECONDS; if (str.contains("h")) t = TimeUnit.HOURS; return ne...
15e10ac4-4c1f-4efc-86e3-72823fa66f25
7
@Override public void mousePressed(MouseEvent e) { if (!isEnabled()) click(true); else { if (e.getButton() == MouseEvent.BUTTON1) leftClick = true; if (e.getButton() == MouseEvent.BUTTON3) { if (!leftClick) { if (isFlagged) { mf.updateMineCount(1); setText(""); } else { ...
2ed223dd-594b-4c1e-9be5-e27abb69f009
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); spellId = buf.readShort(); if (spellId < 0) throw new RuntimeException("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0"); spellLevel = buf.readB...
41464a17-bfbf-4e60-81bb-15ea8efd078b
1
void setScoreText(String text) { if (scoreText != null) { removeChild(scoreText); } scoreText = new TextComponent(text, 24); scoreText.setTextColor(0xffffffff); this.addChild(scoreText, getWidth()/2 - scoreText.getWidth()/2, startGame.getTop() - scoreText.getHeight()-...
7031d1f1-50a2-4098-a69e-53b0c9680e42
3
private void rightRotate(RBNode x) { RBNode y = x.getLeftChild(); x.setLeftChild(y.getRightChild()); if (y.hasRightChild()) { y.getRightChild().setParent(x); } y.setParent(x.getParent()); if (!x.hasParent()) { setRoot(y); } else if (x ==...
3fc317c5-36fd-4d02-b6aa-a3d9c076b912
2
public void damage() { if(getState() == NORMAL) { setState(BROKEN); } else if(getState() == BROKEN) { remove(); } }
e4c21ced-c424-4f2e-a959-6ce982da13a5
0
public ArrayList<MassAttractObject3D> getSystem() { return system; }
75f69f6c-68ec-48dd-9a39-4470b9c66cb2
4
public Object run() { int[] table = new int[size]; if (option == UNSORTED) table = Random.randArrayInt(size, 0, 100); if (option == SORTED) Arrays.fill(table, 1); if (printResult) System.out.println("Table before sort \n" + Arrays.toString(table)); // the main algorithm sw.start(); QuickSort....
0de85538-f8f3-4f1e-b5ff-5012ffd7137e
9
@Override public void onLogMessage(Level logLevel, int indentLevel, String message, Object... objects) { if (null == logger || !logger.isLoggable(logLevel)) return; StringBuilder sb = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { sb.append(AppConst.IDENTATOR); } String msg = ""; if (nul...
31b621e6-0d0d-467b-94f7-7065f188de20
4
public void showColorAndPositionKmean(int K, boolean useNativeColors) { try { Kmean kmean; float mult = 255.0f / 2 / (float) (portableMap.getHeight()*portableMap.getHeight() + portableMap.getWidth()*portableMap.getWidth()); if(useNativeColors) kmean = new Kmean(portableMap.getHeight(), portableMap.getWid...
c25298ec-a70a-4f1a-b1fb-b9142b2b5c57
2
@Override public String getRawData() { if (!parser.isStoreRawDataToDataSet()) { // option needs to be set for this functionality // throw an exception throw new FPInvalidUsageException("Parser.isStoreRawDataToDataSet(true) must be set before using getRawData()"); ...
90dec056-493c-444e-9916-5f112a872fa2
1
public static ArrayList<String> getHashMap(HashMap<String, String> hm) { ArrayList<String> a = new ArrayList<String>(); Set s = hm.entrySet(); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry m = (Map.Entry) it.next(); a.add(m.getKey() + "\t" + m.getValue()); } return a; }
f49ee614-f0ad-4ceb-8851-96fdc0f491b7
0
@Test public void testNum2wordWithConsecutiveNoMatch() { List<String> wordList = _phonewordFinder.num2words("35693710"); assertEquals(0, wordList.size()); }
05a74ebe-a472-420b-8bd3-6382e48b611c
2
public void mouseClicked(java.awt.event.MouseEvent evt) { if (evt.getSource() == jTablePedidos) { PanelPedidos.this.jTablePedidosMouseClicked(evt); } else if (evt.getSource() == jTextField1) { PanelPedidos.this.jTextField1MouseClicked(evt); } }
3ba0fa72-bdd5-4329-863e-fbf73702258b
8
final public void Program_return_declaration() throws ParseException { /*@bgen(jjtree) Program_return_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTPROGRAM_RETURN_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1))...
b84a6b65-21b1-4388-92e9-ed213c90f4fd
5
public boolean isGameOver() { boolean gameOver = false; ArrayList<Player> playersToRemove = new ArrayList<Player>(); //Make a new list of players, without those who can not do a move for (Player player : players) { if (!canDoMove(player)) { playersToRemove.add(player); //TODO Debug Line. System....
bbbe4e4c-0264-4829-82c0-0d0a6e6a5738
7
protected void prepare_sample_reading(Header header, int allocation, //float[][] groupingtable, int channel, float[] factor, int[] codelength, float[] c, float[] d) { int channel_bitrate = header.bitra...
92ae0df0-ca9a-45d7-885b-b891b462f957
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 fe...
32ef35a1-f496-45ed-bd5f-ece4fcae42e5
5
private int countBackToBacks(List<Pairing> pairs) { int backs = 0; for (int x = 0; x < pairs.size() - 1; ++x) { Pairing a = pairs.get(x); Pairing b = pairs.get(x + 1); if (a.contestantA == b.contestantA || a.contestantA == b.contestantB || a.contestantB == b.contestantA || a.contestantB == b.contestantB) {...
393a3fe6-4eeb-4f2c-bf99-930d7d034370
2
public static void recall(DMatrix[] pointset) { for(int i = 0; i < pointset.length; i++){ for(int j = 0; j < pointset[i].samplenum(); j++){ } } }
721dfec6-16ff-4fc5-b1aa-7f5a1bae04ad
9
protected int diff_commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate th...
d4fbef97-eee3-4464-9339-04fdc87cb542
6
void createCanvas(Composite parent) { int style = SWT.NO_BACKGROUND; if (dbItem.getSelection()) style |= SWT.DOUBLE_BUFFERED; canvas = new Canvas(parent, style); canvas.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; Rectangle rect = canvas.getClientArea(); ...
a36e2550-c377-4e63-b1b1-d0cf84b28683
4
public int playGame() { Move m; int winner, turn; long s_time; moves0 = 0; moves1 = 0; time0 = 0; time1 = 0; // Show the initial status of the board. board.showBoard(); winner = -1; turn = 0; while (winner == -1) { // Roll the dice. d.toss(); out_stream.println("The Toss: " + d....
d8ea8252-b83d-4a4d-b87e-e0b19510887c
2
public void clearNodes() { for ( Edge<T> e : edges) e.visited=false; for ( Vertex<T> v : vetexes) v.visited=false; }
f3ec6eec-7b04-4e87-8fef-141c33708e82
6
private void resolveConflicts(ArrayList<Person> nextPersonnes) { int i = 0; for (Person p : nextPersonnes) { int j = 0; for (Person p2 : nextPersonnes) { if(p.getLine() == p2.getLine() && p.getColonne() == p2.getColonne() && p.getId() != p2.getId()) { //System.out.println("conflit"); ...
8a872e04-f037-44d6-b1a9-ce6b3ee5a940
5
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for (; ; ) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { ...
966bc3b3-2175-4f00-b592-2171f0b6f94f
5
private void setFields() { if(thisCourse.getInstructor() != null) instructor = new JLabel("Instructor: " + thisCourse.getInstructor()); else instructor = new JLabel("Instructor: N/A"); dayList = ""; // if(thisCourse.getDays() != null) { for (Day d:thisCourse.getDays(...
4911dbde-7336-4c52-a87b-01b51521ebac
7
public final void initWorld() { //create wall and gem objects Wall wall; Gem gem; //variables used to keep track of coordinates during loop int x = 0; int y = 0; for (int i = 0; i < level.length(); i++) { //Grab the item i...
1b9a2278-0560-456f-a734-3b336791850a
4
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; if (args.length > 0 && args[0].equalsIgnoreCase("*"))...
21c7f8ff-4ea5-4d9d-9041-c47e598a7ce2
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MyCrAftAPI other = (MyCrAftAPI) obj; if (callExecutor == null) { if (other.callExecutor != null) return false; } else if (!callExecutor....
7ffa7281-2e5a-4880-a7b8-7e3e56cc284f
1
private void drawTableCards(Graphics g) { for(int i = 0; i < cards.length; i++){ drawRowOfCards(g, i); } }
8c541dac-8e27-43d4-91ff-95bc19106012
1
public static boolean shouldTrackViewportWidth(Component comp) { Container parent = comp.getParent(); if (parent instanceof JViewport) { Dimension available = parent.getSize(); Dimension prefSize = comp.getPreferredSize(); return prefSize.width < available.width; } return false; }
54a36a45-619b-479e-abc7-2bde16489a56
4
static public BigDecimal calculateMinedPrice(Class<? extends Item> genericItem) { BigDecimal price = BigDecimal.ZERO; Item item = getItem(genericItem); //System.out.println(item.toString() + " is mijnbaar met " + item.getRequiredMiningPickaxe()); //price = price.add(calculatePrice(ite...
dda8e066-4403-4736-bc16-ec0815311e86
4
private static void loadServer(){ try { FileInputStream fis = new FileInputStream(serverSave); ObjectInputStream ois = new ObjectInputStream(fis); DataServer temp = (DataServer)ois.readObject(); if(temp != null){ server = temp; System.out.println("server loaded"); } } catc...
07812e62-0b37-4878-ab85-52e24cb554df
5
public void prayed(final Player player, final AGPlayer agp, final God god, final Praying praying, Shrine s) { agp.setPraying(true); agp.getPrayed().put(s, System.currentTimeMillis()); if(!agp.getFoundShrines().contains(s)) { Messenger.sendMessage(player, Message.foundShrine); agp.getFoundShrines().add...
711cba2b-5856-4a06-a4be-3ce486b883b2
3
private void se_remplis(){ if (this.curent.coord != this.forum.coord){ this.rapproche(this.forum); } else { if (this.takeForum()){} // s'il est sur une case "Forum" , alors il se charge de 1. else { // Sinon il regarde sur les cases adjacentes pour voir s'il n'y a pas un Forum if (this.forum ==n...
433baa59-1112-4136-9d0e-ebe8b265ef6e
9
public void calcularSolucion() { int n = cartas.length; for ( int i = 0; i < n; i++ ) { cache[i][i] = cartas[i]; jugadas[i][i].desdeIzquierda( 1 ); } for ( int columna = 1; columna < n; columna++ ) { for ( int diagonal = 0; diagonal < n - columna; diagonal++ ) { int i = diagonal; int j = colum...
b8dc08a9-ecd9-440a-9830-bdc7b8af91be
2
private static String removeSpaces(String input) { char[] withSpace = input.toCharArray(); input = ""; for(char element : withSpace) { if(element != ' ') { input += element; } } return input; }
408418d4-0aa3-4c34-8445-83f75845cdd9
7
@Override public void happen(int rollResult) { // For testing purposes only int i = 0; Boolean greaterThan2 = true; while (i < 4){ if (rollResult < 2 ){ greaterThan2 = false; switch (i){ case 0: Game.getInstance().getCurrentCharacter().decrementKnowledge(); break; case 1: Game.getInstance(...
f777de6c-eae7-455f-b69a-3bf6d638b9fb
7
protected String _render(String tpl) { recursion ++ ; if ( recursion > MAX_RECURSIVITY ) { throw new UnsupportedOperationException("Maximum recursivity reached") ; } int len = tpl.length(), i; String result = "", tag = null; char character; for (i = 0; i < len; i++) { character = tpl.charAt(i);...
34ced655-876e-49fa-8d4b-15e301d666db
7
private void save() { JFileChooser fc = new JFileChooser(); File currentDir = new File("."); File defaultFile = new File(currentDir, "Untitled." + FILE_EXTENSION); boolean saving = true; while(saving) { fc.setSelectedFile(defaultFile); int result ...
1f6fc3c1-2e99-4700-8867-32b66a764e68
5
public static void PlayerCreateRandomInventory(Player player, String PlayerName, String PlayerRank, List<?> PerkList) { // loop thru all perks and prepeare / give items to player for (int i = 0; i < PerkList.size(); i++) { // item description - get all lines String Line1 = GChub.getPlugin().getMainConf...
28851f9a-cc2d-4023-8365-d81598034b28
7
private static void createAndShowGUI() { // Logger.global. if ( TLanguageNames.runtime.isAvailable() ) { Logger.global.finer( "languages found" ) ; } else { Logger.global.warning( "languages NOT found" ) ; } // load icons, initialize other resources and load theme GUIGl...
53b7fec3-7126-42e7-896c-dda8a52b3e52
8
@Override public double dotProduct(Vector v) { verifyMatchingDimensions(v); if (v instanceof DenseVector) { @SuppressWarnings("unchecked") // checked w. instanceof double[] vValues = ((DenseVector)v).mValues; double sum = 0.0; int[] keys1 = mKeys; ...
f3b3e72c-568e-4964-9135-263f1226b071
2
public boolean removeCoffer(Chest chest){ if(chest==null) return false; if(!isCoffer(chest)) return false; coffers.remove(chest); saveCoffers(); return true; }
88c7c95d-7665-4609-93a2-48cb6b8f52c8
6
public static void main(String[] args) { //create object Car car = new Car("Maruthi Swift ZDi", 2013, "KA03-MT2165", "21.40"); //Serialize object try { FileOutputStream outfile = new FileOutputStream("car.ext"); ObjectOutputStream out = new ObjectOutputStream(outfile); out.writeObject(car); out.c...
51c1134b-2e95-4b7a-943b-8ba9b86c37f0
8
private void InserirNovoFornecedor() { String nome = jTextFieldNomeFornecedor.getText(); String morada = jTextFieldMoradaFornecedor.getText(); String codPostal = jTextFieldCodPostalFornecedor.getText(); String localidade = jTextFieldLocalidadeFornecedor.getText(); String contacto...
727b5550-2ac8-4d5f-bdca-3ea0b297ed4e
5
public void loadPDBInfo(final TaskMonitor monitor, final CyNetwork network, String idColumn, final List<CyIdentifiable> ids) { Map<CyIdentifiable, List<String>> idMap = getIdentifiers(network, idColumn, ids); if (idMap == null || idMap.size() == 0) return; // Get the valid IDs from the P...
b1c503a1-cd0d-4185-92ea-bc1803480db1
2
public static void main(String []agrs) throws IOException { JFrame jFrame = new MainForm(); jFrame.setTitle("Park"); jFrame.setSize(300, 220); jFrame.setLocationRelativeTo(null); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jFrame.setVisible(true); while(true) { ServerSocket ss = new...
951c520e-ab55-4cbc-9956-f03931aab173
8
public List<String> summaryRanges(int[] nums) { List<String> rtList = new ArrayList<String>(); String range = ""; int range_1 = 0; for (int i = 0; i < nums.length; i++) { if (nums.length == 1) { range_1 = nums[i]; range = range_1 + ""; rtList.add(range); break; } if (i == 0) { r...
e6f70c03-d9ed-4a41-8f89-b30d0d13f82b
7
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub canvas.removeMouseListener(canvas.getDrawListener()); canvas.removeMouseMotionListener(canvas.getDrawListener()); switch (buttonNum) { case 1: listener = new PencilListener(canvas); break; case 2: listene...