method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
08c3ac17-af74-4f0f-9e2b-64d9af5122fb
4
public void NESSIEfinalize(byte[] digest) { // append a '1'-bit: buffer[bufferPos] |= 0x80 >>> (bufferBits & 7); bufferPos++; // all remaining bits on the current byte are set to zero. // pad with zero bits to complete 512N + 256 bits: if (bufferPos > 32) { while (buf...
05855deb-78f1-41a6-b498-6aef3ebfabf0
3
public Tree constructTrie(List<String> patternList) { trie = new Tree("", 1); Tree.Node root = trie.getRoot(); List<Tree.Node<String, Integer>> children = new ArrayList<Tree.Node<String, Integer>>(); root.setChildren(children); int positionOfNode = 2; for (String patte...
96c4cf83-0c84-48d4-a011-07f29842e796
1
public WorldTile getTile(TileType tileType) { // Try to get the tile, if it's null, create it and keep a reference // to it so that it can be returned next time. WorldTile foundTile = tileMap.get(tileType); if (foundTile == null) { foundTile = new WorldTile(tiles[tileType.val], passable, minimapColor, c...
e914e967-d80c-492c-a306-e5f9fe7edd49
3
public static void main(String[]args) { try { //new ClassFolder(); System.out.println(ClassFolder.getAbsolutePath()); File f = new File("C:\\Users\\thapaliya\\Desktop\\codes"); System.out.println("Abs File Path: "+f.getAbsolutePath()); Sys...
a95dda05-3567-471c-95b9-513401216e16
3
private void ConnectSocket(){ int tries = 0; int maxTries = 5; while(tries < maxTries) { try { localServerSocket = new Socket(Ip, Port); localServerSocket.setSoTimeout(100); in = new DataInputStream(localServerSocket.getInputStream()); ...
6359477d-201c-4f45-9f3b-b3625bdc68c0
1
public List<ItemType> getItem() { if (item == null) { item = new ArrayList<ItemType>(); } return this.item; }
cb22a5b6-f523-420e-9bd5-96c41aeb9cf5
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
ef58f915-f8a0-427e-b45f-de1ae2ea2f9e
1
@Override public String toString() { String out = ""; for (ScrapedPage scraped : scrapers) { out += scraped.toString() + "\n"; } return out; }
2911c7e2-a6e6-4a25-9c1d-80fb510932da
3
@Override public boolean equals(Object obj) { if (obj instanceof Operator) { Operator o = (Operator) obj; return symbol.equals(o.symbol) && priority == o.priority && associativity == o.associativity; } return false; }
b6cb9c17-1d39-40b9-894a-5f8818620aa3
8
private boolean r_shortv() { int v_1; // (, line 49 // or, line 51 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 50 if (!(out_grouping_...
f92ab869-fc23-420f-b842-397e7f1d4696
4
public void render(boolean editor, float interpolation) { ColliderBox ra = map.camera.getMapRenderArea(interpolation); for(int i=0;i<entityList.size();i++) { try { if(Collider.collides(entityList.get(i).getGeneralCollider(interpolation), ra)) entityList.get(i).render(editor,interpolation); } ca...
60f6c8ce-2b5d-4c1a-9908-d7c5e0206cc1
1
@Override public double calculate(double x) { return -Math.pow(x, 2) * (x + 1) * ((x - 2 < 0) ? -Math.pow(2 - x, 1 / 3.) : Math.pow(x - 2, 1 / 3.)); }
074ef0ab-7db3-44a7-a7ba-48d1e0779d40
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<St...
d25e708b-4bee-4e2c-9485-ba7161261306
7
private void buildVertexPath(RoutePath inRoute, boolean randomStart) { mPath.clear(); ListIterator ti = inRoute.getPath().listIterator(); while (ti.hasNext()) { Trip t = (Trip) ti.next(); if (!mPath.isEmpty() && mPath.get(mPath.size() - 1).getRawDistance( t.getVertices().get(0)) == 0.0) { ...
44410f14-bd7e-443d-ac1c-f13988c57632
5
private Field findField(Class<?> clazz, String name) { for (Field field : clazz.getDeclaredFields()) { if (!isTransient(field.getModifiers()) && !field.isAnnotationPresent(Transient.class) && field.getName().equals(name)) { return field; } } ...
4dc54b9f-5e6c-403c-a770-90d984c7fc91
2
private static void nextWindow() { try { sLock.lock(); if(!sWindowOpen && sWindows.size() > 0) { sWindowOpen = true; final JWindow window = sWindows.removeFirst(); Timer delayVisibleTimer = new Timer(DELAY, new ActionListener() { public void actionPerformed(ActionEvent e) { final Timer t ...
29ffcbdf-2007-4d9c-94d3-b502f8c7b6e2
7
static final String method572(String string, int i) { anInt8677++; if (i != 23034) aClass356_8679 = null; int i_11_ = string.length(); int i_12_ = 0; for (int i_13_ = 0; i_11_ > i_13_; i_13_++) { char c = string.charAt(i_13_); if (c == '<' || c == '>') i_12_ += 3; } StringBuffer stringbuffer = n...
1e051c12-6930-4a0d-bf74-ab0ab31d1863
0
@Override public void handleBitfieldAvailability(SharingPeer peer, BitSet availablePieces) { /* Do nothing */ }
6a0c855f-307b-42fa-a041-fb0bced83a80
3
public Game create(GameType gameType) { Game game = null; Player player1 = null; Player player2 = null; if (gameType == null) { throw new IllegalArgumentException ("MainCommands - create: gameType is null"); } if (gameType == GameType.ONE_PLA...
a40e53e8-8cf6-4b38-9bc1-88ca79115952
9
public List<TravelDataBean> getSearchArticles(int start, int end,String search, String val, int area) throws Exception{ Connection conn = null; Statement stmt = null; ResultSet rs = null; List<TravelDataBean> articleList = null; try{ conn = getConnection(); val = new String(val.getBytes("iso_8859-1"),"u...
4713e220-4949-429e-9531-d774f42bce48
0
public CheckResultMessage check2(int day) { return checkReport.check2(day); }
c83aec9c-f2b2-45b9-8fb7-aac21426d2cc
4
@Override public void onDisable(){ try { SQLManager.disconnect(); } catch(Exception e){ log.severe("SQL Database encountered an error while disconnecting."); if(e.getMessage()!=null) log.severe("Error: " + e.getMessage()); if(e.getCause()!=null) log.severe("Caused by: " + e.getCause().toString()); } ...
c68452e3-723c-4dd1-813a-3b169608213a
6
@Override protected void press() { switch (selected) { case 0: break; case 1: break; case 2: try { new Client((host.equals("")?"localhost":host), 1999, gameTag); setState(gameId); } catch (Exception e) { System.out.println("Check your internet connection"); } ...
553d45f1-fd8d-476b-a677-4d187b272c46
5
public void maxheap(int i){ left=2*i; right=2*i+1; if(left <= n && numbers[left] > numbers[i]){ largest=left; } else{ largest=i; } if(right <= n && numbers[right] > numbers[largest]){ largest=right; } if(largest!=i){ exchange(i,largest); maxheap(largest); } }
3db248e0-1309-4b75-bb19-34bc9c50f1bb
4
private Integer[] mergeArrays(int low, int high, int middle) { // Copy both parts into the helper array System.arraycopy(numbers, low, helper, low, high + 1 - low); int i = low; int j = middle + 1; int k = low; // Copy the smallest values from either the left or the ...
6e29d674-8466-42ea-b613-0c0fd4eb57f0
1
private ManagerSocketServer() { super(); for (String word : badWords) { bannedWords.add(word); } badWords = null; // Dispose of string to save memory }
4be577bd-7ab9-461b-ac80-f2f5b0244398
7
public void addNode(T data) { boolean goLeft; Node<T> temp = root; if(this.root == null) { this.root = new BiDirectionalNode<T>(data); return; } do { goLeft = ((int)(Math.random()*31))%2 == 0 ? true : false; if (null == (goLeft ? temp.getLeft() : temp.getRight())) { break; } else { temp...
82015f97-270a-4179-a90a-4cefc68dd579
2
@Before public void setUp() { for (int i = 0; i < test1.length; i++) { t1.insert(test1[i]); } for (int i = 0; i < test2.length; i++) { t2.insert(test2[i]); } }
144d21ff-92f6-4bf2-8169-fb81a89d178b
5
private void drawMouse(Graphics g) { int offset = 2; g.setColor(new Color(currentColor)); if (winner == 0) { if ((mx >= boxX1 - offset) && (mx <= boxX2 + offset) && (my >= boxY1 + boxSize - (offset * 2 + 4)) && (my <= boxY2 + boxSize - (offset * 2 + 4))) { g.fillOval(mx - boxSize / 3, my - boxSize, boxSize...
7e2db4e2-33b2-4ffb-b5bc-f7ae4c8cd96b
6
public void body() { // wait for a little while for about 3 seconds. // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(3.0); LinkedList resList = super.getGridResourceList(); // in...
8524a13b-8fc5-42a0-ab05-712f0cf7099c
0
public void setFesIdFuncionario(Integer fesIdFuncionario) { this.fesIdFuncionario = fesIdFuncionario; }
330730f4-c8d9-4408-8eee-8befed62d845
3
public static Day fromString(String inputString) { if (inputString != null) { for (Day day : Day.values()) { if (inputString.equalsIgnoreCase(day.value)) { return day; } } } return SUNDAY; }
0b01a21e-0c77-4a1c-8199-26ee8fae89d8
9
public void sort(Comparable[] arr, int start, int end) { int low = start; int high = end; if(low >= high) { return; } else if(low == high - 1) { if(Compare.gt(arr[low], arr[high])) { swap(arr, low, high); } return; }...
f9088cad-b49a-456c-9037-b621dd262f1b
4
public void loadPlates(){ File file = new File(getDataFolder(),"Plates.prop"); if(!file.exists()){ getLogger().info("Error Loading Plates, Shuting Down"); Bukkit.getPluginManager().disablePlugin(this); } try{ BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); Strin...
749f2aae-033f-4d52-a164-9cdbadc247f5
3
public void genWeapon(){ rand = new Random(); secRoll = (rand.nextInt(100)+1); if(secRoll <= 70){ genCommonWep(); } else if(secRoll <= 80){ genUncommonWep(); } else if(secRoll <=100){ RangedRoll rr = new RangedRoll(); rr.doRoll(); arrowList = rr.getAmmoOutput(); item = rr.getItem(); va...
1900576e-b75a-45a9-95bd-caa6f0f57160
9
public static void main(String[] args) throws FileNotFoundException { long start = System.currentTimeMillis(); Scanner in = new Scanner(new FileInputStream("files/new/triplets/input03.txt")); // Scanner in = new Scanner(System.in); int c = in.nextInt(); long[] n = new long[c]; ...
e401bb10-dfe8-4e28-8f61-8f075e6b0859
8
@SuppressWarnings("deprecation") public static void main(String[] args) { HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>(); HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>(); HashMap<Integer, String> stationIdName...
39236c22-171c-4205-ba6d-5348c30086a7
3
public synchronized Object[] receiveBinary() throws IOException, CycApiException { cfaslInputStream.resetIsInvalidObject(); final Object status = cfaslInputStream.readObject(); cfaslInputStream.resetIsInvalidObject(); final Object response = cfaslInputStream.readObject(); final Object[] an...
cd4f24ce-3af4-4257-98cb-70fc6c076616
7
public void testPresent5() { try { TreeNode result = contains(mkChain(new String[]{ "label1", "label2" }), new TreeNode("label2")); assertTrue(null, "Failed to locate the leaf node of a chain!", result != null && result.getData() != null &...
2265b560-737e-4fd0-8f82-f3dedb25b4cc
7
public void escribir_Arch_Maestro(String nombre_archi) throws IOException { long lreg, desplaza; int n; StringBuffer buffer = null; System.out.println("Archivo Maestro"); RandomAccessFile archi = new RandomAccessFile(nombre_archi, "rw"); try { archi.readInt(...
2d127bdd-c91e-45b5-8440-ed3c116e820a
4
private static void expandEverything(OutlinerDocument doc) { OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) {return;} try { if (doc.tree.getComponentFocus() == OutlineLayoutManager.TEXT) { TextKeyListener.expandEverything(doc.tree); ...
aba940c9-1b5b-40b1-9e5a-e5dbb8705473
0
@Basic @Column(name = "FUN_HABILITADO") public String getFunHabilitado() { return funHabilitado; }
50103b45-ef7b-4a1a-882d-d9b4c739180d
8
public static void savePokemon() { String output ="savedata/"+idString+".pkmn"; try { PrintWriter fout=new PrintWriter(new FileWriter(output)); encryptionKey=0; if(VERSION.equals("Peaches")) fout.println("PDAE"+idString); else fout.println("CDAE"+idString); for (Pokemon aParty...
bf6606f3-f5ba-49aa-b6bf-767b891db2ab
5
public static void main(String[] args) throws VehicleException, SimulationException { CarPark cp = new CarPark(); Simulator s = null; Log l = null; try { s = new Simulator(); l = new Log(); } catch (IOException | SimulationException e1) { e1.printStackTrace(); System.exit(-1); } if(args.le...
f3375d55-9c74-4aec-9d18-59c8d0f5d3d7
0
@Override public Class getObjectType() { // TODO Auto-generated method stub return Person.class; }
af48d012-9901-454c-8527-a58578995144
9
static boolean isXmlDeclarationStart(final char[] buffer, final int offset, final int maxi) { // No upper case allowed in XML Declaration. XML is case-sensitive!! return ((maxi - offset > 5) && buffer[offset] == '<' && buffer[offset + 1] == '?' && ...
07c6b1fd-6dc5-4e11-81ef-e11ffa2d46c2
9
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Tile other = (Tile) obj; if (key == null) { if (oth...
51ac4c8b-af65-44e1-8381-803cdffe7c46
1
public Shader() { program = glCreateProgram(); uniforms = new HashMap<String, Integer>(); if(program == 0) { System.err.println("Shader creation failed: Could not find valid memory location in constructor"); System.exit(1); } }
37f03f41-fb0c-490e-b5ac-8e065097c8ab
5
public static void disposeAll(Class<? extends Component> clz){ for(Set<Component> components : frames.values()){ Set<Component> disposal=new HashSet<Component>(); for(Component component : components){ if(component.getClass().equals(clz)){ disposal.add...
04d0e303-4594-4b11-bf74-bee1f861dee5
5
protected void addEntry(SimpleAutoCompleteEntry entry) { if(mClassRestrictions != null) { Class<?> thisEntryClass = entry.getInstanceClass(); for(Class<?> restriction : mClassRestrictions) { if(restriction.isAssignableFrom(thisEntryClass)) { mAllEntries.add(entry); break; } } } else { ...
a7532784-61f7-40b5-8ae4-c939e2ab35cc
8
public void keyReleased(KeyEvent e){ switch(e.getKeyCode()){ case 37: case 65: left = false; break; case 38: case 87: up = false; break; case 39: case 68: right = false; break; case 40: case 83: down = false; break; } }
42881b55-2c1c-49fc-80fb-19448e54e571
8
public void print(InstanceList docs, double limit, int num, String file) { assert docs.size() == D; try { PrintWriter pw = new PrintWriter(file, "UTF-8"); pw.println("#doc source topic proportion ..."); Probability[] probs = new Probability[T]; for (int d=0; d<D; d++) { pw...
21b4298b-c2a4-41f2-9e95-36d56affc9a1
6
public static boolean getMoney(int money) { Output.printTab("Hole " + (money == 0 ? "alles Geld" : money + " D-Mark") + " ab: ", Output.DEBUG); String moneyPage = Utils.getString("sparkasse/auszahlen"); Control.quietSleep(500); int pos = moneyPage.indexOf("<div align=\"center\">"); if (pos == -1) {...
25dea062-bf43-4c9e-8b8e-5b33f3f3f32a
7
@Override public Iterator<Color> iterator() { return new Iterator<Color>() { private int[] cs = null; private boolean finalized = false; private int[] next_coordinates(int[] cs) { if (finalized) return null; if (cs == null) { cs = new int[]{ 0, 0 }; } else { cs = cs.clone(); ...
16be6dbf-e743-464c-a851-b88bbb59129a
6
private void inputScore(Scanner scanner, int playerNum, int frameNum) { Frame frame = player[playerNum].frame[frameNum]; do { System.out.print("first score : "); int first = scanner.nextInt(); frame.first = first; } while (frame.first > 10); if (frame.first != 10) { do { System.out.print("...
5687ee32-a029-40df-aa32-06fabadaedc6
4
public String getActualLogin(String login) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = getConnection(); statement = connection.prepareStatement(userQuery); int paramCount = u...
7acebc75-fd21-4d1f-8cd5-8a323269ff16
0
@Override public void warning(SAXParseException e) { System.out.println("SAXParserException Warning: " + e.getMessage()); this.errorOccurred = true; }
168f0f8c-e9e8-49ef-a2f4-729112a629a1
5
private static <E> void merge(E[] array, E[] temp,int begin, int end, Comparator<E> comparator){ int i = begin; int tracker = begin; int middex = (begin+end)/2; int rightstart = middex+1; // Goes through and compares the two segments of the array that we are focusing on...
9f6ed296-0f3b-455d-9bd1-c044e0032c7e
3
public void run() { while(threadFlag){ try{ LogController.addNumLogs(); detectEnd(); String _item = queue.take(); this.handleItem(_item); }catch(InterruptedException e){ System.out.println("InterruptedException"); } } //System.out.println("ConsumerImplement thread End"); ...
ff048f3d-eb25-42b4-8cb0-c8e609c4cf2b
2
public void removeProvince(int id) { if (provinceIDCache.containsKey(id)) { String together = provinceIDCache.get(id).worldName + "+" + provinceIDCache.get(id).x + "+" + provinceIDCache.get(id).z; if (provinceLocCache.containsKey(together)) provinceLocCache.remove(together); provinceIDCache.remove(id); ...
33c4ac6e-c721-4212-9f2b-606b40d5bc61
9
public int successThreshold(Player patk, Player pdef){ int successThreshold = 0; if(patk.inventory.contains(Card.spade) && !spectralImmune(patk)){ successThreshold += 1; } if(patk.inventory.contains(Card.spadeii) && !spectralImmune(patk)){ successThreshold += 2; } if(patk.inventory.contains(Card.longbowii)){ ...
0e3e7b6f-0c2f-4616-9492-e71c527fd276
6
public static Color getToolTipBackground() { Color c = UIManager.getColor("ToolTip.background"); // Tooltip.background is wrong color on Nimbus (!) boolean isNimbus = isNimbusLookAndFeel(); if (c==null || isNimbus) { c = UIManager.getColor("info"); // Used by Nimbus (and others) if (c==null || (isNimbus...
ce33bd79-30b2-42aa-bf32-752291993031
2
public ProjectMainView() { setTitle("Edytor LoW"); campaign = new Campaign(); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { boolean quit = true; if (!campaign.isSaved()) { int dialogButton...
dc1fde3c-ba3e-41f7-864e-93fabca08bca
7
public void actionPerformed(ActionEvent e) { if (e.getSource() == saveFile) { int choice = fileChooser.showSaveDialog(PrintWindow.this); if (choice == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); String file...
2fc02d99-db56-4ea9-9048-4129df85f5ea
0
@Override public String getCalle() { return super.getCalle(); }
7f7c4768-6aac-4434-8bbd-689e5cef36b6
4
@Override public String paginate(int page) { // is there a need to paginate? if(this.rows <= 0 || this.rows <= this.per_page) return this.query; // check if the page is valid if(page <= 0) page = 1; if(page > this.pages) page = this.pages; // calculate rows this.currPage = page; int row_fro...
59a99820-3e4e-46d7-b216-0d53bb7f2d25
4
public static double benchmarkMiceNumber(Path path, int nbOcc){ Hashtable<String, Double> tab = new Hashtable<String, Double>(); for (String s : new WordReader(path)) if (!tab.containsKey(s)) tab.put(s, 1.); else { double d = tab.remove(s); tab.put(s, d+1.); ...
c974ca96-b01e-4349-a294-141de84c44cb
4
public void load(){ /** * - FOR TAM - * Database Requirements * * Get dungeon data BASED OF USER ID. * * NEED: Dungeon data - tile_ids (it will be a long string like below), spawner_str (shorter string containing spawner details), trap_srt (same as spawner string). * */ //TODO: ...
436deb84-9aff-4f78-86a4-0476f30060a5
9
public static void main(String[] args) { Reflections reflections = new Reflections("de.drlanka.euler"); List<Class<? extends EulerProblem>> types = new ArrayList<>(reflections.getSubTypesOf(EulerProblem.class)); Collections.sort(types, new Comparator<Class<?>>() { @Override public int compare(...
adb4fad4-be6b-4259-85ea-e0552611890e
5
public void write(final ProtocolEncoder encoder) throws Exception { final StringBuilder log = logger.isLoggable(Level.FINER) ? new StringBuilder() : null; buffer.clear(); encoder.encode(buffer, log); if (log != null) logger.finer("Protocol Encoding\n" + log.toString()); buffer.flip(); if (logger.i...
d85d13db-1ab2-4ae8-91a0-755ee610c069
2
private List<String> getParsedList (NodeList n) { List<String> list = new ArrayList<String>(); for (int i = 0; i < n.getLength(); i++) { String s = n.item (i).getTextContent(); if (!s.trim().isEmpty()) list.add (s); } return list; }
38137c7b-c1ef-468d-bd00-5eeb59d7c4af
7
@SuppressWarnings("unused") protected Entry readEntry(InputStream in) throws IOException { Entry entry = new Entry(); byte temp[] = new byte[4]; in.read(temp); if (!new String(temp).equals("File")) throw new IOException("FileFormat error :: " + new String(temp)); int entryLength = (int)read_s64(in); in....
bb255713-7cc8-4a00-937b-10ea780a9c86
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...
d706bdc4-c93f-45b2-9b5f-f2dc0d1177ed
2
@Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { //System.out.println("getScrollableUnitIncrement"); switch(orientation) { case SwingConstants.VERTICAL: return visibleRect.height / 10; case SwingConstants.HORIZONTAL: return visibleRect.widt...
d1834e2a-7087-4d15-b8d3-a9445fc2747a
3
public boolean issueAssetType(String serverID, String nymID, String contract) throws InterruptedException { if (!otapiJNI.OTAPI_Basic_IsNym_RegisteredAtServer(nymID, serverID)) { OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.CREATE_USER_ACCT, serverID, nymID); String str...
531742dc-067c-40c2-8ddf-c1d9fd9e9768
6
public void run() throws IOException { // MyXMLFileWriter.printNewUserToXMLFile(); String s; System.out.println("Hello, my dear friend!"); printMenu(PrintMenuName.MAIN_MENU); while (true) { s = br.readLine(); System.out.println(s); if (s.equals("1")) { printUsersCount(); } else if (s.equa...
22b1eb20-a4f4-4b40-af6e-2b7df3b586b7
6
@Test public void testCheckOut() throws Exception { checkHelper.deleteCheckOut(b.getIsbn(), 1, 2); bh.deleteBook(-2); bh.addBook(b); // Nothing should be added to the list of checkouts since the book is null checkHelper.checkOut(null, start, 1, 2); CheckOut co = checkHelper.getCorrespondingCheckOut(b.ge...
a741cd42-6840-4cf5-9ad5-cc75b1f1cc32
3
@Override public T mode() { if (N == 0) return null; T mode = null; long found = 0; for (T k : freqTable.keySet()) { long time = freqTable.get(k); if (time > found) { found = time; mode = k; } } return mode; }
bb00d302-3b1f-423f-854b-7dba9b55ffe4
3
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents panelMenu = new JPanel(); menuBar1 = new JMenuBar(); menu1 = new JMenu(); menuItem1 = new JMenuItem(); menu2 = new JMenu(); menuItem4 = new JMen...
e9f1d951-81ed-4d99-a260-b5cfe1cd6e46
5
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened //Set basic frame properties this.getContentPane().setBackground(new Color(152, 174, 196)); this.setLocationRelativeTo(null); //Load window icons Image moddleIcon =...
da4e2f1b-c711-4973-8d4f-75471a59f107
2
@Override public List<Person> meetCriteria(List<Person> persons) { List<Person> femalePersons = new ArrayList<>(); for (Person person : persons) { if (person.getGender().equalsIgnoreCase("Female")) { femalePersons.add(person); } } return femalePersons; }
d3d6fbdb-c936-4cfb-aa1e-258b9854817c
9
public static String downloadPhoto(String address, String path, String fileName) { try { URL html = new URL(address); URI method = new URI(html.getProtocol(), html.getUserInfo(), html.getHost(), html.getPort(), html.getPath(), html.getQuery(), html.getRef()); address = method...
a7dd1f46-0898-4c6f-8d59-cbd196afef6a
2
public void paintComponent(Graphics g) { Log.debug("Painting the canvas."); // Let the swing framework do it's drawing of the JPanel first. super.paintComponent(g); // The following two commands draw the background: // Set the color of the "pen". This color will be used in the following // drawing commands....
f5893df8-d0f7-4bd4-8a6c-f084d55bf78f
0
public void setFunctionInfo(String functionName, int startLineNumber, int endLineNumber) { environmentStack.peek().setEndLineNumber(endLineNumber); environmentStack.peek().setFunctionName(functionName); environmentStack.peek().setStartLineNumber(startLineNumber); ...
0785b330-f359-41fb-bb9a-ee7e91fd86b2
9
public long sort(String inputFile, String outputFile, String tmpdirectory, long numberLinePerFile, int maxNumberOfFile, boolean saveKey, boolean keepTmp, String delimiter, char escape, KeyGenerator keyGenerator, Filter filter) throws DiffException { if (maxNumberOfFile > MAX_FILE_NUMBER) { throw new Dif...
2ec047e5-2bf0-451c-a1d4-5f2d9403fc42
5
private long removeRefBitcoinServer(long lIndex) { // // loop through the elements in the actual container, in order to find the one // at lIndex. Once it is found, then loop through the reference list and remove // the corresponding reference for that element. // BitcoinServer refActualElement = GetBitcoinServe...
0700db7b-3b17-409b-a406-f72a3437ac8e
3
public int recorrerfin() throws FileNotFoundException, IOException { long ap_actual, ap_final; int contador = 0; RandomAccessFile leer_archi = new RandomAccessFile("base_conocimiento", "r"); while ((ap_actual = leer_archi.getFilePointer()) != (ap_final = leer_archi.length())) { ...
87b597b3-caf9-4707-990d-90412e89b736
4
public static <T> List<T> select(String query, ReadGetter<T> rg, ReadFilter<T> rf) { List<T> container = new LinkedList<T>(); try { ResultSet result = Database.getConnection().prepareStatement(query) .executeQuery(); rg.takeResultSet(result); T ref; while (result.next()) { ref = rg.read(); ...
8fbafb94-bd33-4f63-9ea8-a940b482ea45
1
public static void insertAbove(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { // Abort if node is not editable if (!currentNode.isEditable()) { return; } tree.clearSelection(); insertAboveText(currentNode, tree, layout); }
c6579022-3aee-4963-bac5-abd244ae0074
8
private boolean followsFileOrFolderLink(InputStream is, String str) throws IOException { int i, c; int pos = str.indexOf("master"); if (pos != -1) { String beforeMaster = str.substring(0, pos); String afterMaster = str.substring(pos+6); //Syst...
38f2e406-5308-43f1-8e3e-aa9b941fcb0c
3
public static void main( String[] argv ) { String filename = "document_root/system/errors/GenericError.template.html"; CustomLogger logger = new ikrs.util.DefaultCustomLogger("test"); Map<byte[],byte[]> replacementMap = new java.util.TreeMap<byte[],byte[]>( new ikrs.util.ByteArrayComparator() ); try { rep...
fb32adf2-fcfc-4c22-822b-a5577b0a9ffd
3
public String[] prettify(int arr, String prefix, String suffix) { String[] array = new String[keys.length]; int index = 0; if(arr == 0) { for(String string : keys) { StringBuilder builder = new StringBuilder(); builder.append(prefix); builder.append(string); builder.append(suffix); ar...
dc6e48e4-f972-4259-8928-c83c059d9f66
0
public void setProtocol(FileProtocol protocol) { this.protocol = protocol; setText(protocol.getName()); }
f10d1f56-bb5d-4871-8fa7-8802c1bc7e62
9
@Test public void testCheckVictory() { GameController gc = new GameController(paddle1,paddle2,ball,view,padq1,ballq1); int radius = Ball.getSize(); //ball is not near paddle zone boolean b = gc.checkDefeat(); if(b) fail("Failure Trace: "); //ball y=300 ball.setPosition(250, 300, 0); b= gc.checkVi...
1c0313a4-d336-4297-b328-7e2c0d86df34
8
@Override public boolean addAll( Collection<? extends E> c ) { vacuum(); int num = c.size(); if( num == 0 ) { return false; } if( num > mThreshold ) { int targetCap = (int)(num / mLoadFactor + 1); if( targetCap > MAXIMUM_CAPACITY ) { ...
9cc19505-a38b-4a7d-ad49-173aa7dc4aa4
9
public void ComputeBigWindowStatisticByToeflDataSet() throws IOException{ int correctAnswers = 0; File testFile = new File(testFileName); BufferedReader testReader = new BufferedReader(new FileReader(testFile)); String rdline; int LineNo = 0; String[] question = new String[6]; while ((rdline = t...
d6fd2bb1-c1c8-4d92-908a-ff60f3dd3c32
2
int getScheduleFitness(Schedule s){ int scheduleFitness = 0; for (RoomScheme[] schedule : s.schedule) { for (RoomScheme sch: schedule) { scheduleFitness += sch.getFitness(); } } return scheduleFitness; }
c6bbb732-8981-4000-bb00-4eb3341854eb
3
public static final void exampleTemplate() { System.out.println("Starting Cyc connection examples."); try { CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator"); CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE"); access.setCyclist(cycAdministr...
551134e5-b856-454b-83c2-96b6a019bbda
0
public void setDepotlegal(String depotlegal) { this.depotlegal = depotlegal; }
0c9a2c52-738a-4225-9886-1b2287aabc3c
0
public void setIntellingentMovementHistory( List<Integer> intellingentMovementHistory) { this.intellingentMovementHistory = intellingentMovementHistory; }