method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c5e848be-8492-4ebe-ac6c-5a300a101b33
7
public void ElaboraDate() { try { System.out.println("crea"); PrintWriter writer = new PrintWriter(new FileWriter(heidelDate, false)); for (Document d : documents) { for (HeidelTerm ht : d.HeidelTerms) { if (ht.Tipo.equals("DATE")) { String term = ht.Termine; ...
1878e1ba-5f54-49fe-85e2-06d1477c5791
1
public Obuffer decodeFrame(Frame header, SoundStream stream) throws DecoderException { if (!initialized) { initialize(header); } int layer = header.layer(); output.clear_buffer(); FrameDecoder decoder = retrieveDecoder(header, stream, layer); decoder.decodeFrame(); output.write_bu...
083598eb-a3de-43d9-83d5-2ce033133679
9
@Override public void menu(User u) throws MenuExitException { String menuString = "Configure Transport Action:\r\n"; menuString += "(01) Configure transport name \r\n"; menuString += "(02) Configure target room \r\n"; menuString += "(03) Configure prereq setting\r\n"; menuString += "(04) Configure range \r\n...
8a5d1652-55fb-4fc5-a0a6-f584cbadbfd6
6
private void loadFromFile(String fileName){ FileInputStream openFile; ObjectInputStream ois; try { openFile = new FileInputStream(fileName); setTitle("Pathfinder - " + fileName); ois = new ObjectInputStream(openFile); String bgImagePath = (String)o...
b1bbd5dc-2ff0-465a-86a1-8c1cbe95c936
6
private ArrayList<HashSet> ConstructSetOfSCC(FiniteStateAutomaton dfa){ /* initial state of dfa*/ State init = dfa.getInitialState(); ArrayList<HashSet> setOfScc = new ArrayList<HashSet>(); HashSet<State> scc = new HashSet<State>(); FSAConfiguration config = new FSAConfiguration(init, null, nul...
abe4c3e3-a6d5-4e88-a447-c5bb42be4f82
1
public void startWriting(String filename, int width, int widthC) { try { dos = new DataOutputStream(new BufferedOutputStream( new FileOutputStream(filename))); oneLineY = new byte[width]; oneLineCbCr = new byte[widthC]; } catch (Exception e) { e.printStackTrace(); } }
82ce256a-7e4c-466a-b010-90078ecf2310
6
public static void main (String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException cnfe) { System.out.println(cnfe); } catch (InstantiationException ie) { System.out.println(ie); } catch...
20b5d1e2-e981-4186-9ee4-bc313732e456
5
public JSONObject increment(String key) throws JSONException { Object value = opt(key); if (value == null) { put(key, 1); } else if (value instanceof Integer) { put(key, ((Integer)value).intValue() + 1); } else if (value instanceof Long) { put(key, ((L...
250820f8-2d77-4b17-8155-d023977866b6
6
private void onClick(){ String outDate; int timeLimit = 0; // Must check out at least one book if (callNumbers.size() == 0) { popMsg("Need to enter some books!"); return; } try { timeLimit = LibraryDB.getManager().getTimeLimit(bid); } catch (SQLException e) { System.out.println(e.getMess...
869746a0-06c6-44f8-9321-6f1bd36e8acc
8
public void continueAfterBluffCall(boolean bluffCalled, PlayerWithChoices bluffCaller) { if(bluffCalled){ playerUI.closeAllOtherPopups(); //TODO let player choose to not show they have the card if(player.has(action.cardTypeRequired())){ playerUI.replaceCard(action.cardTypeRequired()); //Need special ...
4c661aa0-a8d6-4307-9719-b9672c9ea7ff
2
public static boolean isValidEmail(String email) { if (email == null) return false; return email.matches("[\\w-_.]+@[\\w-.]+\\.[a-zA-Z]{2,4}") && email.length() <= 100; }
2c95637c-8a25-4c79-a213-b86c4c423920
3
public boolean addUserIntoQueue(User user, Playmode playmode){ boolean playmodeExists = gameQueueMap.get(playmode.getPmID()) != null; if(playmodeExists){ Queue<User> gameQueue = gameQueueMap.get(playmode.getPmID()); gameQueue.add(user); int requiredPlayer = playmode.getNeededPlayerCount(); if(gameQueue...
1cf450a5-bd0b-4467-a708-c992ba862ae9
3
public void addNewPiece() { count++; score++; if (testMode && count == TEST_LIMIT+1) { stopGame(); return; } // commit things the way they are board.commit(); currentPiece = null; Piece piece = pickNextPiece(); // Center it up at the top int px = (board.getWidth() - piece.getWidth())...
24ff37a8-9304-47b3-b3e1-703f4daffe39
1
@Test public void isDeserializedCorrectly() throws IOException { SubscribeMessage msg = new SubscribeMessage("/test/topic/1", QoS.AT_LEAST_ONCE); msg.addTopic("/test/topic/2", QoS.AT_MOST_ONCE); byte[] data = msg.toBytes(); MessageInputStream in = new MessageInputStream( new ByteArrayInputStream(data))...
1992ed4a-2e76-424f-933b-124e94f468f8
7
private ArrayList<Square> createRow(String line) { // Initialize the row ArrayList<Square> row = new ArrayList<Square>(); for(int x = 0; x < line.length(); x++) { // For each character in the string, create a Square String s = line.substring(x,x+1); Square newSquare = new Square(0); boolean squareS...
3786068f-81b1-469d-b6b9-d58113bf9171
8
public DotExpression(ColorMapper colorMapper, String html, int defaultFontSize, HtmlColor color, String fontFamily, int style, FileFormat fileFormat) { if (html.contains("\n")) { throw new IllegalArgumentException(html); } this.colorMapper = colorMapper; this.fontFamily = fontFamily; this.normalFont = n...
77480d22-f739-4df4-817e-f820306f7979
6
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toString().endsWith(".zip") || file.toString().endsWith(".jar")) { final File dir = new File(Vars.HOME_DIR + "natives/" + file.getFileName().toString().replaceAll(".zip", "").replaceAll(".jar", "")); ...
b3f9eadf-6852-47d6-a979-96924727466e
2
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { if (!file.toString().contains( "dynmap" + System.getProperty("file.separator") + "web")) {// Comment out this if to allow copying of files in a folder called dynmap\web try { String sFile = file.toString(); copyToNew = ...
beae59e4-8fca-4a59-b48e-c52a903f8560
8
public void deleteNote() { int id_noteTmp = -1; System.out.println("ID :"); id_noteTmp = Integer.parseInt(sc.nextLine()); NoteDB.setConnection(con); NoteDB note = null; note = new NoteDB(id_noteTmp); try { note.read(); } catch (Exception ex) { ...
abc8e0da-65f3-46b8-8c4f-a798eb21a0e0
9
public final void update() { chunkUpdates++; int sx = x; int sy = y; int sz = z; int ex = x + chunkSize; int ey = y + chunkSize; int ez = z + chunkSize; int renderPassType; for (renderPassType = 0; renderPassType < 2; ++renderPassType) { ...
e7ca2531-5999-4e67-8d91-af09e5e1c210
9
public char[] getCurrentIdentifierSource() { //return the token REAL source (aka unicodes are precomputed) //START EBAY MOD if(m_enableFakeIdentifier){ return m_fakeIdentifierProvider.getTokenSource(); } //END EBAY MOD char[] result; if (this.withoutUnicodePtr != 0) { //0 is used as a fast test flag so the r...
bc7cfd5b-5bda-4164-ad0a-130313117335
5
private void authenticate() { boolean isValid = false; String username = ""; while (!isValid) { synchronized (currentUser.getUsers()) { try { msg = (Message)inFromClient.readObject(); username = msg.getMessage(); if (!msg.getType().equals("login")) { ...
f195c5e6-db5b-4cbf-8dc9-7d73adfd7827
4
public String terbilang(String nilai){ String temp=""; String temp2=""; int hasilBagi,sisaBagi; int batas=3;//batas untuk ribuan int maxBagian = 5;/*untuk menentukan ukuran array, jumlahnya sesuaikan dengan jumlah anggota dari array gradeNilai[] */ ...
7dde6a2d-f0a0-474a-8945-a039f694232e
9
public String sortingMethod(String[] stringList) { String[] lexi = new String[stringList.length]; System.arraycopy(stringList, 0, lexi, 0, stringList.length); Arrays.sort(lexi); int[] original = new int[stringList.length]; int[] lengths = new int[stringList.length]; for (int i = 0; i < lengths.length; i++...
bf5e5394-4381-4a99-b05e-7e4ab5cb1311
5
private void clearNode(TrinaryTreeNode<T> node) { TrinaryTreeNode<T> parentNode = node.getParentNode(); TrinaryTreeNode<T> leftNode = node.getLeft(); TrinaryTreeNode<T> centerNode = node.getMiddle(); TrinaryTreeNode<T> rightNode = node.getRight(); // clear this node from the parent node if (parent...
0da0f4eb-7ef6-4224-94d4-9314eaf64aae
7
private int get_prev_page(Page page) throws JOrbisException { long begin=offset; //!!! int ret; int offst=-1; while(offst==-1){ begin-=CHUNKSIZE; if(begin<0) begin=0; seek_helper(begin); while(offset<begin+CHUNKSIZE){ ret=get_next_page(page, begin+CHUNKSIZE-offset); if(...
ac19e7f8-9d65-4169-b9ec-4bd0f75256d7
3
public List<String> alloc(String filename, int num_chunks) { int chunkloc = 1; String chunk_uuid; List<String> chunk_uuids = new ArrayList<String>(); for (int i = 0; i < num_chunks; i++) { chunk_uuid = UUID.randomUUID().toString(); chunk_uuids.add(chunk_uuid); chunktable.put(chunk_uuid, chunkloc); c...
798c98ca-ae8f-4500-9573-6e60801b4d3c
3
@Delete public void deletelo(Intervention ivt) { String id = (String) getRequest().getAttributes().get("id"); String ivid = (String) getRequest().getAttributes().get("ivid"); System.out.println("id: " + id); System.out.println("ivid: " + ivid); System.out.println("Remark: " + ivt.getRemark()); System.out.p...
7c0f19ea-4640-4d59-8ef5-e439bccd8ee1
0
public Node getNode() {return this.hoistedNode;}
ff71da9e-c912-4c7f-bb6c-75c0b45c90d1
4
public void body() { initializeResultsFile(); createGridlet(super.get_id(), NUM_GRIDLETS); // schedule the initial sending of gridlets in the future // NOTE: if you have many resources and GIS entities, please make sure // you wait for few minutes to allow GIS to receive reg...
516db38a-4353-41f7-9fe2-a1c31a4790a9
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Position)) return false; Position other = (Position) obj; if (facingPosition != other.facingPosition) return false; if (xCoord != other.xCoord) return false; if (...
50e4b78d-7dd4-4855-acda-15c98b11ff88
0
public void addVertex(Vertex v) { DoublyLinkedList<Vertex> neighbours = new DoublyLinkedList(); neighbours.insertLast(v); this.adjacencyList.insert(neighbours); }
12e505e8-7e5d-47c5-b773-ffe73971f890
4
public static HandshakeBuilder translateHandshakeHttp(byte[] buffer, int readcount) throws Exception { HandshakedataImpl1 draft = new HandshakedataImpl1(); ByteBuffer message = ByteBuffer.allocate(readcount); message.put(buffer, 0, readcount); byte[] lines = message.array(); int previndex = 0; int index...
2941d96e-ace5-4dbc-bca5-23c65e5bd858
6
public void draw(Transform transform) { texture.bind(); updateTextureOffsets(transform); GL11.glPushMatrix(); GL11.glTranslated(transform.x, transform.y, 0f); GL11.glScalef(transform.scaleX, transform.scaleY, 0f); if(transform.flipX) { GL11.glRotatef(180f, 0, 1, 0); } if(transform.centerRot...
050cc1a4-2d5e-4838-bc45-67457f9a0522
7
@Override public void paint(Graphics graphics) { _image=_listener.getImage(); if(_image == null){ System.out.println("Houston, we have a problem..."); } super.paint(graphics); Dimension sz=getSize(); drawX = 0; drawY = 0; drawWidth = sz.width; drawHeight = sz.height; // Scale ...
1ae5ef13-445c-4175-aa19-955ebe59db2d
2
private boolean isColour() { ArrayList<Card> handCopy = (ArrayList<Card>) cards.clone(); boolean sameSuits = true; Card first = handCopy.remove(0); for (Card card : handCopy) { if ( !card.suit.equals(first.suit)) { sameSuits = false; ...
a4794ce4-54c7-41ce-9ef5-a49e08e414b7
4
public static void testArrays(){ // arrays // Note: c++ style double var[] does work, but is not preferred // double[12] does not work, need a new statement //double[] array = new double[5]; double[] array={8,3,6,2,1}; double total=0; // for each style statement (...
2e77170f-9204-4ef1-a01f-a35a6ac75069
0
public Integer getNumber() { return number; }
7d216d43-b7fa-4fdb-b524-93bd3d4b0adc
5
public void writeToFile() { betterMap(); if (!(sortedFile.equals("")|| sortedFile == null)) { try { FileWriter fstream = new FileWriter(sortedFile); BufferedWriter writer = new BufferedWriter(fstream); for (String s : classSortedMap.keySet()) { build = new RaceClassBuilder(maxNbrOfLaps, raceTime...
6ac7c21d-1721-4908-b83d-0186fcea8d75
1
private Type getType(String name) throws BadBytecode { try { return Type.get(classPool.get(name)); } catch (NotFoundException e) { throw new BadBytecode("Could not find class [pos = " + lastPos + "]: " + name); } }
46ad0583-8574-4b85-8711-3a3cc51dab6a
8
private void sendToClientFile(IoSession session, String fileName) throws IOException { InputStream openStream = null; try { URL resource = this.getClass().getClassLoader() .getResource("flume.properties"); openStream = resource.openStream(); Properties properties = new Properties(); properties.l...
2edcf09f-46b3-4877-a66f-0a5557c068ce
9
public static void main(String[] args) throws InterruptedException { if (args.length != 2) { printUsage(); System.exit(1); } else { if (args[0] != null && args[0].length() > 0) { String filename = args[0]; Properties properties = loadPr...
5f0b275f-5e8d-4369-aad1-1277a9738119
9
public static long playerNameToInt64(String s) { long l = 0L; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); l *= 37L; if (c >= 'A' && c <= 'Z') l += (1 + c) - 65; else if (c >= 'a' && c <= 'z') l += (1 + c) - 97; else if (c >= '0' && c <= '9') l += (27 + c) - 48; } whil...
b9c5969c-ef72-482e-867e-af866f876156
1
private static String getExtension(String filename) { int index = filename.lastIndexOf(Preferences.EXTENSION_SEPARATOR); if (index == -1) { return null; } else { return filename.substring(index + 1, filename.length()); } }
9df058c6-afd4-48e2-adbc-5b870687b18c
1
public boolean isEmpty(){ if(root == null) return true; return false; }
306161ca-6f73-4550-94b9-2268574fc819
7
@Override public void actionPerformed(ActionEvent e) { Object parent = e.getSource(); if (parent instanceof JButton) { JButton button = (JButton) parent; String name = button.getText(); if (name.equals ("New Game")) gui.reset(); else if (name.equals("Pause")) Stats...
226077bb-494e-4eed-a9bb-d0f3eb7e4684
2
private void createNpcs(){ HashSet<String> npcPaths; try { npcPaths = KvReader.getKvFiles("./npcs"); } catch (IOException e){ e.printStackTrace(System.err); return; } for(String s : npcPaths){ HashMap<String, String> npcAttributes =...
d2b277a0-1fa2-41ae-9ba4-1b8e512d7dd1
4
public void accioBotoAccepta() { try { String contrasenya_nova_introduida = new String( contrasenya_nova.getPassword() ); if ( !contrasenya_nova_introduida.equals( new String( confirma_contrasenya_nova.getPassword() ) ) ) { VistaDialeg dialeg = new VistaDialeg(); String[] botons = { "Accepta" }; ...
8aedb392-237a-444b-b980-bfdeba3e0783
4
private void updateFile(Vector stuList) { //for some reason FileInputStream won't recognize a file unless the explicit file path is included //is there a way to remedy this? EasyReader doesn't require this extra info File file = new File( "/Users/Shelley/Documents/DiningHallSeating/DHS/DiningHallSeating/Data/...
e2405ba8-391f-4f14-ace3-7eb03e2a9dbd
7
public static int requestBuy(Player theCustomer,Field field) { Object[] options = new Object[2]; options[0] = "Køb stedet"; options[1] = "Køb ikke"; String name=""; String type=""; int price=0; int ftype=-1; Brewery b = null; ShippingLines sh = nul...
eaf958c1-c7fb-44dd-8f7a-e97cdb8034e1
3
public boolean isValidLocation(Location loc) { return (loc.getX() >= 0 && loc.getX() <= getWidth() && loc.getY() >= 0 && loc.getY() <= getHeight()); }
836f2b5f-9a93-44d2-8ff2-06932f53ca32
8
public static WaveReward[] loadWaveRewards(String xmlFilePath){ HashMap<HeroType, HeroData> statsMap = new HashMap<>(); NodeList rewardElements = getElements(xmlFilePath, "wave"); List<WaveReward> waveRewards = new ArrayList<>(); for(int i = 0; i < rewardElements.getLength(); i++){ WaveReward reward = new Wa...
efbdc473-e306-42c0-8947-598023e12a71
9
public static int GCD(int x, int y){ if (x == 0) return y; else if (y == 0) return x; else if (!isOdd(x) && !isOdd(y)){ x >>= 1; y >>= 1; return GCD(x, y) << 1; } else if (!isOdd(x) && isOdd(y)){ return GCD(x >> 1, y); } else if (isOdd(x) && !isOdd(y)){ retu...
71e2c437-97f5-4c69-a7ee-fc1fe3dcaa21
6
public Number getKey() { if (this.keyList.size() == 0) { return null; } if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) { throw new RetrievalIdException("getKey方法只适用于单个主键的表结构,但当前表结构包含多个主键: " + this.keyList); } Iterator<Object> keyIterator = this.keyList.get(0).values().iterator(); if (k...
09149fee-68aa-472f-afa8-4bc85e9b4656
0
public static boolean isApplicable(Object object) { return object instanceof Automaton; }
a17c1c1e-81a9-45af-b41c-6bdf0ff79beb
9
public void quickSort(int[] array, int low, int high) { if (array == null || array.length == 0) { return; } if (high <= low) { return; } //pick the pivot int middle = low + (high - low) / 2; int pivot = array[middle]; int i...
ff3cce57-574b-4138-98fc-edc27d5399cb
5
public synchronized void init() { if (inited) { return; } Object parentTree = library.getObject(entries, "Parent"); if (parentTree instanceof PageTree) { parent = (PageTree) library.getObject(entries, "Parent"); } kidsCount = library.getNumber(entr...
d0e1a7c1-2946-477f-9817-d98ebf7cb62c
3
public final synchronized char readChar(){ inputType = true; charType = true; String word=""; char ch=' '; if(!this.testFullLine) this.enterLine(); word = nextWord(); if(word.length()!=1)throw new IllegalArg...
a0cd02f8-16fa-4761-9ba7-67f9501f5e04
2
public void removeComponent(Component component){ components.remove(component); if(Renderable.class.isInstance(component)){ renderers.remove((Renderable)component); } if(Updatable.class.isInstance(component)){ updaters.remove((Updatable)component); } }
8e212bd4-ed86-4aed-84e5-c276e6c6b764
4
private static void displayRegistration(BufferedReader reader, VideoStore videoStore) { try { String username = ""; String password = ""; String name; String creditCard; String address; String phone; while (username.isEmpty()) {...
25e11c77-4643-47ba-8446-13c4e5230b0d
0
@Override public void destroy() { super.destroy(); parent = null; }
c0e98b0c-e4f1-477a-ac02-672c477828fa
8
private static Path processPoly(Element element, StringTokenizer tokens) throws ParsingException { int count = 0; ArrayList pts = new ArrayList(); boolean moved = false; boolean reasonToBePath = false; Path path = null; while (tokens.hasMoreTokens()) { try {...
13411656-abb6-4c26-a3f2-953d1f2f765b
1
public void syncWithGraphics(){ int newRoundTime = graphicsContainer.get().thinktime; if(newRoundTime != roundTimeMilliseconds){ roundTimeMilliseconds = newRoundTime; Debug.info("Delay changed to " + newRoundTime); Debug.guiMessage("Delay changed to " + newRoundTime); } }
a0a94d9e-70bf-4ce2-a72a-b7ab017926ba
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Marca other = (Marca) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; ret...
fd74c499-aaf6-4564-a314-bfd295529e81
6
public static boolean doEntitiesCollide(Entity e1, Entity e2) { if (e1 == null || e2 == null || e1 instanceof EntityParticle || e2 instanceof EntityParticle) { return false; } Area a1 = new Area(); for (int i = 0; i < Render.renderers[e1.getRenderId()].shapes.size(); i++) { a1.add(new Area(Render.ren...
0817bfaf-dc44-4502-aad6-a57e4eaaff4d
2
private static void SimpleBoolIf(Boolean b) { if (b) System.out.println("Item is true"); else if (!b) System.out.println("Item is false"); }
75c5cb48-a58d-4cd1-b1d8-9f56b97bbd6e
2
public void testRemoveIntervalConverterSecurity() { if (OLD_JDK) { return; } try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); ConverterManager.getInstance().removeIntervalConverter(StringConverter.INSTANCE); ...
a3f38bef-c4dd-41c0-8d1d-79596429803d
1
public static void deleteQuizTakenHistory(Quiz quiz) { try { String statement = new String("DELETE FROM " + DBTable + " WHERE qid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, quiz.quizID); stmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace...
54d79564-8e34-4504-9686-ff986dd0f9ab
8
protected static Ptg calcDCount( Ptg[] operands ) { if( operands.length != 3 ) { return new PtgErr( PtgErr.ERROR_NA ); } DB db = getDb( operands[0] ); Criteria crit = getCriteria( operands[2] ); if( (db == null) || (crit == null) ) { return new PtgErr( PtgErr.ERROR_NUM ); } int fNum = db.findC...
885f4392-6baf-4964-852e-4fa809be803e
8
private void updateCurSpot (final char[][] newMap, final boolean[][] newIsFalling, final Point pos) { final char curSpot = getNewSpot(pos, DIRECT_NONE); if (curSpot == ROCK) { final Point newPosOfRock = new Point(pos); boolean isRockMoved = true; if (fallD...
c3c3b852-fe65-4132-9a64-4662f73abbbf
5
public void run() { System.out.println("ApiRequestor " + name + " starting."); try { for (int i = 0; i < repeatCount; i++) { final String testPhrase = name + "-" + Integer.toString(i + 1); final String script = (name.equals("Long")) ? "(catch-task-processor-ter...
6f3ac611-6e7b-4990-88a4-d51fbeda5c1a
9
public void enemySpawner() { if(spawnFrame >= spawnTime) { outerLoop: //Label so we can break from both loops. for (int i = 0; i < levelEnemyList.size(); i++) { for (int j = 0; j < levelEnemyList.get(i).length; j++) { if(!levelEnemyList.get(i)[j].inGame && !levelEnemyList.get(i)[j].isDea...
8b4dc5c9-0164-4b42-924f-c233582e432e
0
protected Venue() { super(Venue.class.getSimpleName()); }
ba6cc84a-404c-49c8-aa72-a15e33d38619
7
private void getImage(JPanel panel, Class figure) { if (figure==Oval.class) { try { JLabel label = new JLabel(new ImageIcon(ImageIO.read(ClassLoader.getSystemResource("oval.jpg")))); panel.add(label); } catch (IOException | IllegalArgumentException e) { ...
fd70e5c2-6d8e-4e33-a762-66fb05ef6d6c
5
private void importSpritePlacements(File f) { InputStream input; try { input = new FileInputStream(f); Yaml yaml = new Yaml(); Map<Integer, Map<Integer, List<Map<String, Integer>>>> spritesMap = (Map<Integer, Map<Integer, List<Map<String, Integer>>>>) yaml .load(input); int y, x; ArrayLi...
102f4256-5559-4846-ba96-c106eb89aa85
0
public Integer getQuantita() { return quantita; }
baa59181-5e49-447b-aef5-0f573d05f874
6
private void quickSortList(int low, int high) { int i = low, j = high; int temp; int pivot = numList.get(low + (high - low) / 2); while (i <= j) { while (numList.get(i) < pivot) i++; while (numList.get(j) > pivot) j--; ...
01f77bee-e028-4940-ac87-8c3be4797b1b
1
public static String[] getRemoveFileNames(String version) throws IOException { String s = OberienURL.get(version); String[] fileNames = s.substring(s.indexOf("[remove]")+7, s.indexOf("[/remove]")).split("\n"); for (int i = 0; i < fileNames.length; i++) { fileNames[i] = "Game/" + fileNames[i]; } return file...
3dc08745-a80d-4316-8994-b456ee851c1d
1
public ArrayList<LanguageId> getListOfLanguagesAsId() { ArrayList<LanguageId> languagesList = new ArrayList<LanguageId>(); Set<String> supportedLanguagesKeys = supportedLanguages.keySet(); Iterator<String> iter = supportedLanguagesKeys.iterator(); String key; while(iter.hasNext()) { key = iter.next(); l...
0b5eb182-43f4-4858-be3a-d5b68dd403aa
2
public static double gamma(double x) { double xcopy = x; double first = x + lgfGamma + 0.5; double second = lgfCoeff[0]; double fg = 0.0D; if (x >= 0.0) { first = Math.pow(first, x + 0.5) * Math.exp(-first); for (int i = 1; i <= lgfN; i++) second += lgfCoeff[i] / ++xcopy; fg = first * Math.sqrt...
f3bd030e-aaa0-4dfd-a69d-760f46635c9e
0
@Test public void combine_shouldReturnEmptyList_whenSpecifiedLengthOutOfRange() { String word = "abcd"; assertEquals("[]", combination.combine(word, 0).toString()); assertEquals("[]", combination.combine(word, 5).toString()); }
a2c7cf85-a8e7-4ab0-a6a2-6c6bae6659ab
0
@Basic @Column(name = "cantidad") public int getCantidad() { return cantidad; }
18194ea5-c4b3-432a-be80-bf9f958ea678
4
public void readBoards() { availableBoards.clear(); String s = props.getProperty("mosquito.board.dir"); if (s == null) { log.error("No board directory specified in conf file."); } File dir = new File(s); if (!dir.isDirectory()) { log.error("Board directory is invalid " + s); return; } File[] ...
f1efdc82-4dec-44aa-92d6-4b0fb15b017c
9
static double calculateScore(ArrayList<seed> seedlist, double s) { double total = 0; for (int i = 0; i < seedlist.size(); i++) { double score; double chance = 0.0; double totaldis = 0.0; double difdis = 0.0; for (int j = 0; j < seedlist.size(); j++) { if (j != i) { totaldis = totaldis ...
6ef832ac-b66b-4866-b2e4-14c3e96a0b99
3
public Path getImgPath_SliderMidBtn(Imagetype type) { Path ret = null; switch (type) { case DEFAULT: ret = this.imgSliderMidBtn_Def; break; case FOCUS: ret = this.imgSliderMidBtn_Foc; break; case PRESS...
a940aac5-eea1-41c1-8fe9-f552838f24ca
1
public void setAcknowledgement(Hashtable <String, Integer> Rpg){ for(String key : Rpg.keySet()){ this.acknowledgement.put(key, Rpg.get(key)); } }
c9a7b941-c937-41b2-b8ec-7de712ad94ac
5
public static void main(String args[]) { Scanner in = new Scanner(System.in); // game loop while (true) { int SX = in.nextInt(); int SY = in.nextInt(); in.nextLine(); Integer max = null; Integer maxPosition = null; for (i...
d5fc98a0-e874-4083-a369-5cc5e5bc9568
8
public void helper(int[] map, int nthQueen, ArrayList<String[]> result) { int N = map.length; if(nthQueen == N){ String[] temp = new String[N]; for(int k = 0; k < N; ++k){ temp[k] = ""; for(int m = 0; m < N; ++m){ if(m == map[k]) temp[k] += "Q"; else { temp[k] += "."; } ...
52d9f18d-e440-4ff6-b838-e420504a03f1
8
public char[] readInNeighbors(char[] neighbors, int row, int column){ if(row-1 >= 0){ neighbors[0] = this.grid[row-1][column]; } if(row-2 >= 0){ neighbors[1] = this.grid[row-2][column]; } if(row+1 < this.gridSize){ neighbors[2] = this.grid[row+1][column]; } if(row+2 < this.gridSize){ neighbors...
93607d51-9943-48ff-b773-5ec356fcdd11
4
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (charsToDelete.indexOf(c) == -1) { ...
2823f71a-bd89-4309-998b-05ae016c2f2d
2
public static void main(String[] args) { ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader)cl).getURLs(); for(URL url: urls){ System.out.println(url.getFile()); } try { // System.setProperty("java.rmi.server.hostname", "24.86.28.122"); Sy...
b96b6883-bc8e-432f-876b-129efa86331e
1
public boolean isReleased() { if(isDisabled()) return false; return released; }
5b68083c-40e6-4643-bc84-e4fc916ccd92
1
public void show() { for (int i = 0; i < a.length; i++) System.out.print(a[i] + " "); System.out.println(); }
c28c22fe-dd1c-42c1-a5e3-aa91d735bd3c
2
public boolean equals(Object o) { if (o instanceof RangeType) { RangeType type = (RangeType) o; return topType.equals(type.topType) && bottomType.equals(type.bottomType); } return false; }
671b8814-ab13-4617-8ffa-fffa936d3365
2
private void sleep(int t) { int end = (int) (System.currentTimeMillis() + t); while (System.currentTimeMillis() < end) { try { Thread.sleep(t); } catch (InterruptedException e) { e.getStackTrace(); } } }
1cfd1b61-f8c6-4b0a-bf5f-c6d85b341f8f
0
public String getName() { return name; }
7788f5d6-5faa-4b0d-8b08-b78b9d3a32fb
2
public Node get(long key) { Node previous = cache[(int) (key & size - 1)]; for (Node next = previous.next; next != previous; next = next.next) { if (next.hash == key) { return next; } } return null; }
4fe0829e-2410-4d5c-ab05-b193ce125d2e
3
public static Integer stringToIP(String text){ String[] bytes = text.trim().split("\\."); if(bytes.length != 4) return null; try { int ip = 0; for(int i=0; i<4; i++){ int b = Integer.parseInt(bytes[i].trim()); ip |= b << (24 - 8*i); } return ip; } catch (NumberFormatException e) { ...
7292e54f-f2d5-43e4-a8ce-14ad6dc908b2
1
private void initialize() { this.setBounds(100, 100, 800, 600); sourceImagePanel = new JPanel(); sourceImagePanel.setBounds(10, 30, 293, 447); getContentPane().add(sourceImagePanel); imageSourceLabel = new JLabel(""); sourceImagePanel.add(imageSourceLabel); imageSourceLabel.setIcon(new ImageIcon(IMAGE_S...
75b8892b-a24d-4088-8bf0-49af0d01ec22
2
public static int deltaBetweenSequenceNumbers(int earlierSequenceNumber, int laterSequenceNumber) { int delta = laterSequenceNumber - earlierSequenceNumber; if(delta < (Packet.MINIMUM_SEQUENCE_NUMBER - Packet.MAXIMUM_SEQUENCE_NUMBER)/2) delta += Packet.MAXIMUM_SEQUENCE_NUMBER - Packet.MINIMUM_SEQUENCE_NUMBER + 1...