method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3fc3f0c1-737f-4671-bdc7-5121b8650e98
2
final public void forceSubtreeValid() { if(children==null) return; for(PropertyTree child : children) { child.forceSubtreeValid(); } }
740f3efb-30e9-424a-93c7-9c4328eeff0c
3
public static Company [] findAllCompanyData() { Company [] companydata; String read; ArrayList<String> companyData = new ArrayList<String>(); try { BufferedReader reader = new BufferedReader(new FileReader("company.txt")); while((read = reader.readLine()) != null) { companyData.add(read); }...
c2a2edfa-0a5b-4b4d-9f04-c34120e02d38
5
@Override public void valueChanged(ListSelectionEvent arg0) { int select = table.getSelectedRow(); if (select != -1) { Item item = null; String title = (String) table.getValueAt(select, 0); String author = (String) table.getValueAt(select, 1); String genre = (String) table.getValueAt(select,...
4d017a21-d3f7-4930-b8aa-a8b0b0bb6cfd
1
public Integer increment(K key){ if (map.containsKey(key)){ map.put(key, map.get(key)+1); } else { map.put(key, 1); } return map.get(key); }
f1ce9739-ed53-420c-a8ed-5b461421cd16
0
public void setCity(String city) { City = city; }
fcc3c69c-0f95-4a6b-9399-7d4e9b7de44f
6
private void collisionCheck() { if ( (ballY <= 0) || (ballY >= frameHeight - size - 22) ) ballSpeedY *= -1;//reverses y direction when the ball hits the sides if (ballX < width) { if ((new Rectangle(p1x, (int) p1y, width, height).contains(new Point((int)ballX, (int) ballY + (...
2eafa9c5-1a5c-40ac-822b-71ecf7226d8f
0
public Date getEnd() { return end; }
6e492e49-e4fe-4017-9eb8-d4c5f871c0bc
3
public List<T> create(int nElements){ List<T> result = new ArrayList<T>(); try { for(int i=0;i < nElements;i ++){ result.add(type.newInstance()); } } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return result; }
9ec02049-5ea6-4325-bad2-5b8862d0e26d
8
public FileStream(RandomAccessFile source) throws OggFormatException, IOException { this.source = source; ArrayList<Long> po = new ArrayList<>(); int pageNumber = 0; try { while (true) { po.add(this.source.getFilePointer()); // skip data if p...
88b03913-c40d-4ac0-85a8-3d2df97859ad
6
private void btn_proximoDadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_proximoDadosActionPerformed try { if (txt_operacao.getText().equals("INCLUSÃO") == true) { if (cbx_segmento.getSelectedItem() == null) { JOptionPane.showMessageDial...
c028d51c-93a3-48b9-b3f6-6872bd0c6886
0
public List<RoomEvent> findRoomEventsByHallEventIdForTimeInterval( final Long hallEventId, final Long start, final Long end ) { return new ArrayList<RoomEvent>(); }
2e906f20-7840-4e11-8de1-83b5afe741a5
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CappedValue)) { return false; } CappedValue other = (CappedValue) obj; if (max == null) { if (other.max != null) { return false; } } else if (!max...
5454ded0-cf07-4ef2-ae20-815f62748d4f
5
public boolean updateHotkeyBinding(String key, HotkeyEntry entry) { if (!this.fileLoaded) { return false; } try { XMLNode hotkeysNode = this.rootNode.getChildNodesByType("hotkeys")[0]; XMLNode[] hotkeyNodes = hotkeysNode.getChildNodesByType("hotkey"); ...
4ea6b788-8a18-4ee6-b2c6-98af0e67448a
4
protected void typeTableGen(){ for(String key: dataTable.keySet()){ /*This http transanction happens more than once*/ String typeType = dataTable.get(key).returnType(); // System.out.println("Pcik out record with type of: "+typeType); int typeCount = dataTable.get(key).returnCount(); int typeSize...
f2531078-9611-49cf-8749-88423f6575da
6
@Override public void simpleInitApp() { try { initLogging(); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.get...
e14bb964-c7a8-449c-b008-3b5f393e79a0
2
@Test public void checkRandomness() { List<Integer> sides = Arrays.asList(1,2,3,4,5,6); int[] counts = new int[sides.size()]; Dice<Integer> dice = new Dice<Integer>(sides); for ( int i = 0; i < NUMBER_OF_THROWS; i++) { counts[dice.roll() - 1]++; } final int averageNumberExpected = NUMBER_OF_THROWS...
492f396f-73ec-4cbc-9800-821d6083dfbf
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TaxonNameStatus)) { return false; } TaxonNameStatus other = (TaxonNameStatus) object; if ((this.key == null && ...
5253a70b-dd2e-4999-b437-8ab17b04db32
7
final public void conclusion() throws ParseException { Token conclusionType; Literal literal; if (jj_2_70(7)) { conclusionType = jj_consume_token(DEFINITE_PROVABLE); } else if (jj_2_71(7)) { conclusionType = jj_consume_token(DEFINITE_NOT_PROVABLE); } else if (jj_2_72(7)) { conclusionType...
a9352f6c-269f-4391-9dd6-b447aa46624a
0
public BlueprintList() { BPO = new ArrayList<Blueprint>(); }
fa3fa3fb-ed26-4b06-96de-b503970e6f67
0
public GrammarChecker() { }
a9c135b9-1bff-4022-b2c9-487124f4dc13
0
public boolean getConcurrent(){ return this.concurrent; }
539ee384-4875-4517-ae5b-25b0e3e0fbbc
1
public Class<? extends APacket> getPacketClassByID(int id) { return PList.get(id); }
04a6ae7a-e7b7-4154-bf34-476665fba108
4
@Override public void validate(Object obj, Errors e) { Image image = (Image) obj; if (image.getFile() == null) { e.rejectValue("file", "error.nothing.to.upload"); return; } String mime = image .getFile() .getContentType() .substring(image.getFile().getContentType().indexOf("/") + 1, image.get...
429a45e1-b9b0-41f0-8446-7f7def7a45bd
4
public static byte[] getExcelEncoding( String s ) { byte[] strbytes = null; try { strbytes = s.getBytes( "UnicodeLittleUnmarked" ); } catch( UnsupportedEncodingException e ) { log.warn( "Error creating encoded string: " + e, e ); } boolean unicode = false; for( int i = 0; i < strbytes.length; i...
563f8764-660d-477a-ae00-01333b4ed5e3
7
public void block(MatchData data) { numCorrectPairs = countCorrectPairs(data); pairList = new ArrayList(); for (int i=0; i<data.numSources(); i++) { int lo1 = clusterMode? i : i+1; for (int j=lo1; j<data.numSources(); j++) { String src1 = data.getSource(i); String src2 = data.getSource(j); f...
67b7e172-cc14-40d3-8d77-7e72515e9866
1
public void check() { try { status = a.isReachable(600); } catch (IOException e) { e.printStackTrace(); } }
85b02931-e75e-4964-b420-2487177bf06b
6
public static String reverse(String input) { if (input == null || input.isEmpty()) { return input; } String reverse = ""; String word = ""; String output = ""; for (int i = input.length() - 1; i >= 0; i--) { reverse = reverse + input.charAt(i); } for (int j = 0; j < reverse.length(); j++) { if ...
4e441e5f-e840-4228-a6d4-0cfc1debb4ac
5
private void doFirmwareUpload() throws FirmwareFlashException { int exitCode; try { ProcessBuilder pb = new ProcessBuilder(); // this would be where you'd switch based on OS to run the appropriate // firmware upload command. Vector<String> commandLine = new Vector<String>(); if (os == OS.WINDOWS) { /...
c749195a-85a6-494b-8085-4d62cef901ec
2
public ArrayList<Yhdistelma> mahdollisetYhdistelmat(){ Yhdistelma y = new Yhdistelma(kasi); ArrayList<Yhdistelma> yhdistelmat = y.getYhdistelmat(); // Kaikki kädestä saatavat yhdistelmät ArrayList<Yhdistelma> toReturn = new ArrayList<Yhdistelma>(); // Palautettavat yhdistelmät for(int i=0; i<yhdistelmat.size();...
d798edd4-4ab4-4115-a22c-e897b0efb461
1
public static void main(String[] args) { Comparator<fringeObject> comparator = new fringeObjectComparator(); PriorityQueue<fringeObject> queue = new PriorityQueue<fringeObject>(10, comparator); queue.add(new fringeObject(null, null, 121, 22222222)); queue.add(new fringeO...
19f75941-0775-4142-93e9-56b5980ffca2
4
public static void main(String[] args) { CommandLine cmd; if (args.length == 6) { cmd = doCommandLineParsing(args); } else { fromUI(); return; } /* * Fügen Sie hier Anweisungen zum Einlesen einer PNG-Datei gemäß der * Hinweise auf dem Übungblat...
89c90ab3-81f9-4247-91d0-774924a9da08
0
public void setFovY(float fovY) { Radar.fovY = fovY; }
ac52d27b-e697-4e34-a8d1-3e679dfbd703
6
private void method46(int i, Stream stream) { while(stream.bitPosition + 21 < i * 8) { int k = stream.readBits(14); if(k == 16383) break; if(npcArray[k] == null) npcArray[k] = new NPC(); NPC npc = npcArray[k]; npcIndices[npcCount++] = k; npc.anInt1537 = loopCycle; int l = stream.readBi...
78b86606-00a1-45e5-a907-fbdf87b8db24
6
public void process() { if (action != null) { if (player.isDead()) { forceStop(); } else if (!action.process(player)) { forceStop(); } } if (actionDelay > 0) { actionDelay--; return; } if (action == null) return; int delay = action.processWithDelay(player); if (delay == -1) { ...
706a26ff-1c01-4d1f-81b5-6367c12838ed
8
static String seq_name(int[] code, int max) { int j; String buffer=""; StringBuilder dest = new StringBuilder(); for(j=0;j<SEQ_MAX;++j) { String name; if ((code)[j] ==CODE_NONE) break; if (j != 0 && 1 + 1 <= max) { dest.append(' ');//*dest ...
6778ebcb-b8a2-4fc1-86ad-ea311cdced81
2
public Collection<Column> getHiddenColumns() { ArrayList<Column> list = new ArrayList<>(); for (Column column : mColumns) { if (!column.isVisible()) { list.add(column); } } return list; }
7f1874fd-ebdf-4716-a4ae-6a4b74f57897
2
public static void main(String[] args) { PriorityQueue<Integer> priorityQueue = new PriorityQueue<Integer>(); Random rand = new Random(47); for (int i = 0; i < 10; i++) priorityQueue.offer(rand.nextInt(i + 10)); QueueDemo.printQ(priorityQueue); List<Integer> ints = Arrays.asList(25, 22, 20, 18, 14, 9, 3,...
1b499187-8fd1-4089-8a87-a39dda3ada5b
0
public String getTelefono() { return telefono; }
052f3826-7d5e-46ec-859f-0140e4c09e3a
5
private synchronized void albumsTableValueChanged(javax.swing.event.ListSelectionEvent evt) { Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "albumsTableValueChanged"); album = null; if (booksDirectory == null) { return; } int ...
01e1392a-48e4-4298-baca-4ce46cb92b37
8
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestUsername = request.getParameter("username"); String requestPassword = request.getParameter("password"); Map <String, Object> pageVariables = new HashMap<>(); ...
919fe80c-09da-4d3e-a4b3-47bec5094d80
9
private int buildJump(int xo, int maxLength) { gaps++; //jl: jump length //js: the number of blocks that are available at either side for free int js = random.nextInt(4) + 2; int jl = random.nextInt(2) + 2; int length = js * 2 + jl; boolean hasStairs = random.nextIn...
937a1c12-856b-46da-b064-85394427c9f0
2
private void processQueue() { SoftValueRef ref; while ((ref = (SoftValueRef)queue.poll()) != null) { if (ref == (SoftValueRef)hash.get(ref.key)) { // only remove if it is the *exact* same WeakValueRef // hash.remove(ref.key); } ...
ff0272ac-0201-4c0b-bc3d-4e9938974962
5
private void muoviBianca (boolean turno) { // cerca possibili mosse bianche (movimenti e mangiate) // try catch usati per evitare i controlli sulle celle (superamento estremi damiera) boolean occupata = false; // cella vicina è occupata da una pedina try{ if(damiera.getC...
9b2be9f3-4c37-4ba6-b907-b8df8e2c07b3
8
@Override public File createFile(final HTTPRequest request, String filePath) { final Pair<String,String> mountPath=config.getMount(request.getHost(),request.getClientPort(),filePath); if(mountPath != null) { String newFullPath=filePath.substring(mountPath.first.length()); if(newFullPath.startsWith("/")&&m...
02982cd0-5d9b-4c9b-aac2-5eeb9b88d0df
0
public String getCountry() { return country.get(); }
3cbe3e9f-b206-48a8-8868-6381eae4be97
8
private static void UnZip(String ZipName,long fileSize, ProgressBar progressCurr,ProgressBar progressBarTotal) throws PrivilegedActionException { String szZipFilePath; String szExtractPath; String path = (String)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public O...
62d4684a-d5c2-462c-8a45-ee6d245fe0d0
5
private CalcState testPoints(CalcState state, Point p2, Point p3) { double bestDist = state.bestDist; Triangle bestTriangle = null; int[] rgba = new int[4]; for (int r = 0; r <= conf.colorSteps; r++) { rgba[0] = expandColor(r); for (int g = 0; g <= conf.colorSteps...
980cb388-d2e8-4e7f-a05b-f1cc75a8909d
6
public List<Contestant> getActiveContestants(boolean active) { List<Contestant> list = new ArrayList<Contestant>( allContestants.size()); for (Contestant c : allContestants) { if (c != null) { if (active && !c.isCastOff()) { list.add(c); } else if (!active && c.isCastOff()) { list.add(c);...
9d76ec37-c3fe-4ff9-b24a-88289681a4c4
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
b7ca18d1-0920-49ef-867e-c730a73ecdd7
2
public int map_pf_move(Coord real_coord) { if (path != null) { path.clear(); path_moving = false; path_step = 0; path_interact_object = null; } path = APXUtils._pf_find_path(real_coord, 0); update_pf_moving(); return path == null ? -1 : path.size(); }
a88f9ac8-8e03-47ad-9077-93486fa3eea4
6
public static FileOutputStream createOutputStream(File file) throws IOException { if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); } if (!file.canWrite()) { throw new IOExcep...
90eba4d7-cd84-42b3-ac12-5e45162f6483
0
@Basic @Column(name = "supplier_id") public Integer getSupplierId() { return supplierId; }
425f2ca7-0f19-4869-a376-91d54e50ad21
6
private void setStartPoint( Calendar t, int unit, long exactStart ) { t.setTimeInMillis( exactStart ); t.setFirstDayOfWeek( firstDayOfWeek ); for (int i = 0; i < HOUR && i <= unit; i++) t.set( calendarUnit[i], 0 ); if ( unit >= HOUR ) t.set( Calendar.HOUR_OF_DAY, 0 ); if ( unit == WEEK ) t....
76678c63-b4a7-4a67-8586-3d94543d2bd6
1
public void printPatients() { System.out.println("Patient: " + name + ", age: " + age + ", illness: " + illness); if (nextPatient != null) { nextPatient.printPatients(); } }
512cbf1d-d8bd-44e0-9433-2a8d97c0dbea
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the...
8935317d-b9d6-4c5b-ba25-1666bd2c63ff
1
public void makeDeclaration(Set done) { super.makeDeclaration(done); if (subBlocks[0] instanceof InstructionBlock) /* * An instruction block may declare a variable for us. */ ((InstructionBlock) subBlocks[0]).checkDeclaration(this.declare); }
3635ab1a-ef31-41a7-86c3-cde99abc8a5a
3
private static void test_toggle(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 3) { int bits = (Integer) t.tests[i]; int exp = (Integer) t.tests[i + 1]; int ...
d1af9695-5b8a-4575-9eba-69d4ab887efa
2
public void deposit(BigInteger amount) throws IllegalArgumentException { if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) < 0) ) throw new IllegalArgumentException(); setBalance(this.getBalance().add(amount)); }
24a0bb04-5e42-41c9-b12e-6b54ca53e94f
6
public boolean unload100OldestChunks() { int var1; for (var1 = 0; var1 < 100; ++var1) { if (!this.droppedChunksSet.isEmpty()) { Long var2 = (Long)this.droppedChunksSet.iterator().next(); Chunk var3 = (Chunk)this.chunkMap.getValueByKey(...
33abd859-5271-4e5c-b9ed-8c7c16dd162e
8
@SuppressWarnings("unchecked") // FIXME in Java7 public BuildQueuePanel(FreeColClient freeColClient, GUI gui, Colony colony) { super(freeColClient, gui, new MigLayout("wrap 3", "[260:][390:, fill][260:]", "[][][300:400:][]")); this.colony = colony; this.unitCount = colony.getUnitCount(); ...
046e649d-6cc8-4796-b129-01028420d559
9
public long toLong() { switch (this) { case _0: return 0L; case _1: return 1L; case _2: return 2L; case _3: return 3L; case _4: return 4L; case _5: return 5L; case _6: return 6L; case _7: return 7L; ...
6b35e982-4440-47dc-a53b-205e38de74c8
7
private void initCloseCode() throws InvalidFrameException { code = CloseFrame.NOCODE; ByteBuffer payload = super.getPayloadData(); payload.mark(); if( payload.remaining() >= 2 ) { ByteBuffer bb = ByteBuffer.allocate( 4 ); bb.position( 2 ); bb.putShort( payload.getShort() ); bb.position( 0 ); code...
222f11b5-6bd0-4982-ae57-25d70ed1d422
2
@Override public void registerTrigger(ITrigger<?> trigger) { if (!wrapper.triggers.contains(trigger)) wrapper.triggers.add(trigger); }
ab568be4-169a-4a45-8f28-783f6aba61af
4
public ImageList getImages(String asImageType, boolean abEncodedData, int aiMaxSize, String asLastModified) { Map<String, String> lhtParameters = new HashMap<String, String>(); if (UtilityMethods.isValidString(asLastModified)) { lhtParameters.put(PARAM_LAST_MOD...
1006b202-0f90-4bc4-a402-067e41ffc6da
5
public static ArrayList<String> getAllXlsFilesFromFolder(String path) { ArrayList<String> filesList = new ArrayList<String>(); String files; File folder = null; try{ folder = new File(path); }catch(Exception e){ e.printStackTrace(); } if(folder.listFiles() != null){ File[] listOfFiles = folder...
07a4d85e-f390-4b52-a1e6-d724a80315d4
6
@EventHandler public void SnowmanNightVision(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("Snowma...
2a15e612-55c4-4e2f-b035-4a68da750904
1
public String getString(String key) throws JSONException { Object object = this.get(key); if (object instanceof String) { return (String) object; } throw new JSONException("JSONObject[" + quote(key) + "] not a string."); }
23278600-9810-4c81-880e-9b01d782678f
8
public static Vektor3D determineSpeedVW(Sprite sp) { Vektor3D vekt = new Vektor3D(); if(sp.getDirection() == Consts.NORTH) { vekt.setX(sp.getSpeedInitWalk()/Math.sqrt(2)); vekt.setY(sp.getSpeedInitWalk()/Math.sqrt(2)); } else if(sp.getDirection() == Co...
105c94ec-f30f-4097-923d-24b12063dcb8
3
public ArrayList<ArrayList<String>> translate(ArrayList<ArrayList<String>> sentenceBundle) { ArrayList<String> charIdentifier = sentenceBundle.get(1); for (int i = 0; i < charIdentifier.size(); i++) { for (int j = 0; j < key.length; j++) { if (charIdentifier.get(i).equals(ke...
1016161a-2468-4069-844b-66291ddbf6e2
8
public void close() { try { if( m_ClientOutput != null ) { m_ClientOutput.flush(); m_ClientOutput.close(); } } catch( IOException e ) { } try { if( m_ServerOutput != null ) { m_ServerOutput.flush(); m_ServerOutput.close(); } } catch( IOException e ) { } try { if( m_C...
aa286b53-b49d-4741-83ac-dedfdc4509aa
4
public double computeSimilarity(int user1, int user2) { double sim = 0; // generate arrays containing ratings from users which rated both movies List<Integer> sharedMovies = findSharedMovies(user1, user2); if (sharedMovies.isEmpty()) { return sim; } Double[] userOneRatings = new Double[sharedMovies.si...
0ffdc882-e654-427d-8d96-9406151d03c7
8
public static DataPersister lookupForField(Field field) { // see if the any of the registered persisters are valid first if (registeredPersisters != null) { for (DataPersister persister : registeredPersisters) { if (persister.isValidForField(field)) { return persister; } // check the classes in...
0e7b86e4-8ea5-4873-b148-27a766bd761d
1
public List<EncryptionPropertyType> getEncryptionProperty() { if (encryptionProperty == null) { encryptionProperty = new ArrayList<EncryptionPropertyType>(); } return this.encryptionProperty; }
06375d22-6813-4897-940f-dfd1a127111b
9
public PropertiesWindow(Shell parent) { shell = new Shell(parent, SWT.BORDER | SWT.TITLE); shell.setFont(Main.appFont); shell.setSize(186, 235); shell.setLocation(parent.getLocation().x + 100, parent.getLocation().y + 100); shell.setLayout(new GridLayout(2, false)); lblRoomId = new Label(shell, SWT.NONE)...
4ef84aef-bdbb-4f3f-ade7-dfbca19237b6
6
private static boolean b1(int i, int j, BufferedImage image) { Boolean above = ((image.getRGB(i-1, j+1) == BLACK) || (image.getRGB(i , j+1) == BLACK) || (image.getRGB(i+1, j+1) == BLACK)); Boolean with = ((image.getRGB(i-1, j-1) == WHITE) && ...
eca3bfca-8cd2-41db-b110-a001ac6b0317
5
public static boolean authenticateManager(String inName, String inPassword) { Connection c = null; Statement stmt = null; boolean authenticated = false; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:Restuarant.db"); c.setAutoCommit(false); System.out.println("O...
59c385cf-b019-4aa4-bfd6-dd1f02c5738a
4
public static boolean validID(int ID) { BufferedReader reader; try { reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/spells")); String line; while((line = reader.readLine()) != null) { String[] temp = line.split(";"); if(Integer.parseI...
23569603-3796-4d4d-b29f-b6b1e85954e0
7
private void merge(int[] array, int startIndex, int splitIndex, int endIndex){ int[] tmpArray = new int[endIndex - startIndex + 1]; //new temporary array for storing merged elements int tmpIndex = 0; //index to iterate over temporary array int i=startIndex, j=splitIndex+1; while(i<=splitIndex...
0b5f4408-6214-4bd7-adb9-f8a0720da318
5
public static void main(String[] args) throws IOException { Scanner seuss; // Step 0: // seuss = new Scanner(CLASSIC).useDelimiter("[^A-Za-z]+"); // System.out.println(findUniqueWords(seuss).size()); // how many words did Dr Seuss use? // seuss.close(); // Step 1: // seuss = new Scanner(CLASSIC).useDe...
e6f58cc1-f503-4ac9-8e45-d64b972c65cc
0
public void SetFirstTicks(int firstTicks) { //set the tick time the person got to the stop for the bus this.firstTicks = firstTicks; }
15aff1c5-f1c9-4804-9f83-b616a5cd2271
2
private void addProgram(String text, int type) { int shader = glCreateShader(type); if(shader == 0) { System.err.println("Shader creation failed: Could not find valid memory location when adding shader"); System.exit(1); } glShaderSource(shader, text); glCompileShader(shader); if(glGetShad...
efba70fd-d1d7-4787-924d-96dd468ece06
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to makeCompactGrid must use SpringLayout...
fd33691d-a6e9-4f70-9c39-47a2e3080cdc
4
@Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(backgroundColor); g2d.fillRect(0, 0, this.getBounds().width + 1, this.getBounds().height + 1); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, Renderin...
42749ac5-0ebc-4e65-9822-5b6c6028c6b6
5
private Object decodeAMF0() throws NotImplementedException, EncodingException { int type = readByte(); switch (type) { case 0x00: return readIntAMF0(); case 0x02: return readStringAMF0(); case 0x03: return readObjectAMF0(); case 0x05: return null; case 0x11: // AMF3 return decode(); ...
18ac4b32-8b32-4d80-93aa-d03c44886bd3
4
@SuppressWarnings("unchecked") @Override public void validate(ProcessingEnvironment procEnv, RoundEnvironment roundEnv, TypeElement annotationType, AnnotationMirror annotation, Element e) { AnnotationMirror steretypeAnnotation = AnnotationProcessingUtils .findAnnotationMirror(procEnv, e, "javax.ente...
e4107e2a-7c21-4672-88ac-50008952e87a
3
private static String stackToString(Throwable exception) { String result = ""; if (exception.getMessage() == null) result = exception.toString(); else result = exception.getMessage() + ": "; if (exception.getStackTrace() == null) result = result + " <== stacktrace is null"; else { StackTr...
b9b31021-63c8-49f2-83ab-a07ef59ce096
2
private void fetchSubscribedCategoryList(HttpSession session) { StudentBean bean = (StudentBean)session.getAttribute("person"); StudentDao dao=new StudentDao(); HashMap<String, Boolean> categoryMap = new HashMap<String, Boolean>(); List<String> nonSubscribed = dao.fetchCategories(bean.getUserid(), "NotSubscribe...
19677a89-ffac-44c6-b044-1f5b1f5f44f1
0
@Test public void testBubbleSort(){ bubbleSort.load(array,null,null); bubbleSort.run(); assertArrayEquals(array, arrayActuals); }
9ebbef85-1def-4e14-8fba-cf5433cf908a
1
public synchronized void start() { if (running) return; running = true; game = new Thread(this, "game"); game.start(); }
8354a58e-3614-4708-9d9d-b2b76c8c3ad0
2
public String getOpenFileFormatNameForExtension(String extension) { String lowerCaseExtension = extension.toLowerCase(); for (int i = 0, limit = openers.size(); i < limit; i++) { OpenFileFormat format = (OpenFileFormat) openers.get(i); if (format.extensionExists(lowerCaseExtension)) { return (String) open...
87010d8b-ab93-4321-b114-67334adcdc14
7
@Override public int compareTo(Object o) { int row1 = modelIndex; int row2 = ((Row) o).modelIndex; for (Directive directive : sortingColumns) { int column = directive.column; Object o1 = tableModel.getValueAt(row1, column); Obje...
49b2a59b-e0c9-496e-a537-abe8b24ba2c3
6
DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath); if (curTop != null) { // should only be null at root curTop.add(curDir); } Vector ol = new Vector(); String[] tmp = dir.list...
8e973227-f38d-44d2-89f7-305389b11559
3
public static List<Kurssi> getKurssit() { Connection c = connect(); if (c == null) return null; try { List<Kurssi> kurssit = new ArrayList<Kurssi>(); PreparedStatement ps = c.prepareStatement("SELECT * FROM kurssi;"); ResultSet rs = ps.executeQuery(); while (rs.next()) { kurssit.add(kurssiResultS...
e81d0c87-59dd-42d9-b53c-422fb8f4b89d
4
@Override public void update(int delta) { super.update(delta); if(standAnim != null && moveAnim != null && bumpAnim != null) { for(int i = 0; i < 4; i++) { standAnim[i].update(delta); moveAnim[i].update(delta); bumpAnim[i].update(delta); } } }
63fa5aaa-8ff5-4b36-bb5c-a365580b14b4
7
public Automata buildDFA() { if (states.length > maxStateOfNFA) { return null; } optimaze(); Automata a = createTemplateForDFA(); int maxMask = (1 << states.length); Queue<Integer> queue = new LinkedList<>(); boolean was[] = new boolean[maxMask]; ...
8fe33906-cfac-466b-accf-75da8c02a8e2
2
public void RevealRooms(){ for(int i=0; i<grid.length; i++) for (int j=0; j<grid.length; j++) visited[i][j] = RoomState.VISITED; }
3fc15afb-8750-4583-9cc4-a96c6ec28698
4
public void msgRefreshClientInfoHard(String userId, ArrayList<String> usersId, String turnUserId, String winnerId, String field) { UserSession userSession = sessionIdToUserSession.get(userId); if (userSession.isHardRefreshProcessing()) { utils.resources.Game gameRes = (utils.resources.Game)u...
c91d2aae-0ef6-452e-8382-d1a6132e8e55
3
public static void main(String[] args) { String[] a = {"Color","Apple","Boy"}; List<String> list = Arrays.asList(a); Collections.sort(list); System.out.println(list); Iterator<String> t = list.iterator(); while(t.hasNext()){ System.out.println(t.next()); } ListIterator<String> lt = list.listIterator(...
b06550bc-8e03-4eac-8ae5-feebbca97342
5
public void uimsg(String msg, Object... args) { if (msg == "upd") { this.avagob = (Integer) args[0]; return; } if (msg == "ch") { List<Indir<Resource>> rl = new LinkedList<Indir<Resource>>(); for (Object arg : args) rl.add(ui.sess.g...
d04b38a9-5374-4923-b9c0-4080e27ff307
5
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { // TODO Auto-generated method stub JCas jcas = aJCas; try { chunker = (ConfidenceChunker) AbstractExternalizable.readObject(modelFile); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (I...