method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
585a6e93-0301-4dc6-aee7-6073abf81bed
9
public static void countMatchesWeighted(double minIDF, double minTFIDF) { System.out.println("countMatchesWeighted running"); allDocPairs.clear(); Iterator it2 = dictionaryMap.entrySet().iterator(); while (it2.hasNext()) { Map.Entry termEntry = (Map.Entry) it2.next(); ...
ba0d3e73-2ffb-4dcd-bc7a-3d304951ab6c
4
public void testCycNart() { System.out.println("\n*** testCycNart ***"); try { CycNart cycNart = new CycNart(ARITY_RELATION_FN, 1); testCycObjectRetrievable(cycNart); CycNart arityRelationFn1 = cycNart; assertNotNull(cycNart); assertEquals("(ArityRelationFn 1)", cycNart.toString())...
1ecf8b56-bbad-446f-80dc-7d3f88202c66
1
private boolean jj_2_35(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_35(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(34, xla); } }
25064de7-3349-4f55-ad2f-104b666cd0cf
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 GridSquare)) { return false; } GridSquare other = (GridSquare) object; if ((this.gridRef == null && other.gridR...
30104425-a49b-4f9a-a5db-1ad27847d13f
6
public void paint(Graphics g){ this.setDoubleBuffered(true); Insets in = getInsets(); g.translate(in.left, in.top); int[][] gameboard = logic.getGameBoard(); int cols = gameboard.length; int rows = gameboard[0].length; //draw borders for (int i = 0;i<cols;i++) ...
7c7169e7-bb85-4c3a-bc6a-76ae188bacdb
8
public void onUpdate() { super.onUpdate(); if (this.field_35126_c > 0) { --this.field_35126_c; } this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= 0.029999999329447746D; if (this.wor...
0a0f07cf-5bd7-4566-a183-d5178118f5d3
4
synchronized public void updateLog() { try { PrintWriter writer = new PrintWriter("log.txt", "UTF-8"); writer.println("allocatedmemory: " + this.maxSize); writer.println("usedmemory: " + this.currSize); writer.println("lastchunk: " + this.nextAvailableFileNo); for(BackupFile file : files) { writer...
a9552b96-6f91-4564-9635-bd4ba060c315
7
public static boolean incrementAuctionEndTime( int auctionID, int incrementAmount ) throws DatabaseException { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; int uid, bids; String qUpdateAuctionTime = "UPDATE auctiontime SET endingTime = endingTime + ? WHERE auctionID = ?"; try ...
22447fb2-6cd1-450d-9f3c-69388aa22f5b
1
@Override public String toString() { StringBuilder string = new StringBuilder(); for (String key : commands.keySet()) { string.append(key); string.append(", "); } string.delete(string.length() - 2, string.length()); return string.toString(); ...
8c8fa4cc-662f-454a-b57e-8be68589426a
7
private void rescaleDiameters(double[] realDiameters, int iteration) { if (iteration > 5) { return; } else if (iteration == 0) { double averageDiameter = 0; for (int j = 0; j < nCircles; j++) averageDiameter += realDiameters[j]; averageDiameter /= nCircles; for (int j = 0; j < nCircles; j++) ...
a06d7eb9-c951-49a5-80d2-afb3f721c2e8
6
final void method3049(ByteBuffer class348_sub49, int i, int i_0_) { if (i_0_ != 31015) anInt9470 = -15; int i_1_ = i; while_213_: do { do { if (i_1_ != 0) { if (i_1_ != 1) { if (i_1_ == 2) break; break while_213_; } } else { anInt9474 = class348_sub49.getShort(); ...
eccb5ca2-fa6d-4c8c-bb65-70e3a6918e7f
9
public void paint(Graphics g) { int xh, yh, xm, ym, xs, ys, s = 0, m = 10, h = 10, xcenter, ycenter; String today; currentDate = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("s",Locale.getDefault()); try { s = Integer.parseInt(formatter.format(curren...
ec2e12e3-7be0-4e01-8b74-a99263ff265c
0
public List<AbstractResource> getResources() { return this.resources; }
6d582088-c9e4-4df7-a030-b316d1c67595
6
public void push(String stack, E element) { synchronized(lock) { if(STACK1.equals(stack)) { array[tail1] = element; tail1 += 3; if(tail1 >= array.length) { resize(); } } else if (STACK2.equals(stack)) { array[tail2] = element; tail2 += 3; if(tail2 >= array.length) { resize(...
254cece0-b494-4cb6-919e-0326ed494141
6
public void readOpponentMoves(String[] moveInput) { opponentMoves.clear(); for (int i = 1; i < moveInput.length; i++) { try { Move move; if (moveInput[i + 1].equals("place_armies")) { Region region = visibleMap.getRegion(Integer .parseInt(moveInput[i + 2])); String playerName = moveInput...
5e94f802-4a01-40f0-a802-8276b824209f
2
private void updateInfo() { StyledDocument doc = info.getStyledDocument(); try { doc.remove(0, doc.getLength()); for (int i = 0; i < content.length; i++) { doc.insertString(doc.getLength(), content[i] + newline, doc.getStyle(style[i])); } } catch (BadLocationException ble) { System.err.println("...
8c484638-acdc-41b3-a9f2-f55872f2873f
0
public void setFunGrado(String funGrado) { this.funGrado = funGrado; }
c470f0c2-92ce-41b7-8d9b-d4887cae3671
2
public static int getIndexOfUser(User u, ArrayList<User> users) { int counter = 0; for(User e:users) { if(e.getUsername().equalsIgnoreCase(u.getUsername())) { return counter; } counter++; } return -1; }
79db446d-25ca-46eb-b473-c5505777039a
3
@Test public void testPlayerHandSize() { // tests that all players have about the same number of cards int handSize = game.getPlayers().get(0).getCards().size(); for (Player p : game.getPlayers()) { int currentSize = p.getCards().size(); Assert.assertTrue((handSize-2) < currentSize || (handSize+2) > curren...
6dc0ea27-d0c5-432b-954c-77292f631d96
8
public boolean isDataValid() { Boolean retval = hasValidData; if(retval == null) { final int n = pointVector.size(); if((n < 2) || ((n < 3) && !isOpen())) { hasValidData = new Boolean(false); return false; } for(int i = 0; i < size(); i++) { ...
7deff947-a45c-40b3-b000-e23600b7e0bd
5
private void doPop(MouseEvent e){ int tilex = game.player.getX(); int tiley = game.player.getY(); if(tilex < game.tilemap.width && tilex >= 0 && tiley < game.tilemap.height && tiley >= 0) { if(game.tilemap.items[tiley][tilex] != null) { ItemPopupMenu menu = new ItemPo...
d345c8ed-4c9b-4205-8c9e-d66470b63137
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 75 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 75 ...
819e3a08-8626-4b16-bd77-47f9e007f3ae
8
private void insertNode(Color color, Node root) { int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); root.setReferences(root.getReferences() + 1); String binary11 = Integer.toBinaryString(red); String binary12 = Integer.toBinaryString(green); St...
37064617-102c-4419-b4ca-73703a9a4b81
8
public void onMessage(String channel, String sender, String login, String hostname, String message) { String msg = message.toLowerCase(); String[] msgSplit = msg.split(" "); for (int i = 0; i < msgSplit.length; i++) { String urlTitle = ""; if (isYoutube(msgSplit[i])) { ...
9d13d9ba-3613-425d-8099-3552a0947118
6
@Override public boolean execute(CommandSender sender, String identifier, String[] args) { String playerName = args[0]; String titleId = args[1]; if (sender instanceof Player) { try { if (!DBManager.idExist(titleId)) { sender.sendMessage("No titles exist with this id."); return false; } ...
02d60486-1481-4df7-b33f-9aca5d6c1f1d
4
public void fletchingComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("1", "Bronze arrow", 882, 0); menuLine("5", "Ogre arrow", 2866, 1); menuLine("7", "Bronze 'brutal' arrow", 4773, 2); menuLine("15", "Iron arrow", 884, 3); menuLine("18", "Iron 'brutal' arrow", 4778, 4); menuLine("...
844368f2-93bf-4c4e-be3b-f70bb8db59a1
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 CompanyPerson)) { return false; } CompanyPerson other = (CompanyPerson) object; if ((this.companyPersonPK == nu...
fedb78cd-25ed-4f8d-afce-56fda7bf2fab
0
public void setEventBus( EventBus eventBus ) { this.eventBus = eventBus; }
089bbb8a-af7b-4e63-80f8-7dd9af55d354
4
public static void setMediaPath(String directory) { // check if the directory exists File file = new File(directory); if (!file.exists()) { System.out.println("Sorry but " + directory + " doesn't exist, try a different directory."); FileChooser.pickMediaPath(); } ...
cc57bf89-e151-4741-8855-ab2400ebf523
8
void pushDuskObject(DuskObject objIn) { synchronized(objEntities) { if (objIn.intLocX < 0 || objIn.intLocY < 0 || objIn.intLocX >= MapColumns || objIn.intLocY >= MapRows) { return; } DuskObject objStore; objStore = objEntities[objIn.intLocX][objIn.intLocY]; if (objIn == objStore) // needed to...
a45ceeda-1887-4eb6-a79d-0f86d2e3f9f3
7
public void update(float time) { HandleBlockSpawn(time); for(int i = 0; i < ActiveBlock.size(); i++) { PuzzleBlock b = ActiveBlock.get(i); b.update(time); } for(int i = 0; i < BlockMap.size(); i++) { for(int j = 0; j < BlockMap.get(i).size(); j++) { PuzzleBlock block = BlockMap.get(i).ge...
f10644bf-868d-4743-9fb8-0ce12af22bea
5
public boolean comparePuzzle(Puzzle p1) { boolean answer = true; Puzzle solution = new Puzzle(); char s = p1.getID().charAt(0); int x = s - 'A' + 1; solution.loadPuzzle("solution" + x); int row = 0; int column = 0; while (column != 9 && answer == true) { while (row != 9 && answer == true...
2288e9c3-7d62-42e1-898e-b7e2cc2f6a61
1
public CtField getField(String name) throws NotFoundException { CtField f = getField2(name); if (f == null) throw new NotFoundException("field: " + name + " in " + getName()); else return f; }
4a0d81c7-46eb-41d4-9ce1-40912570b31a
7
public boolean execute() { Log.i(" "); Log.i("Executing: " + Utils.cmdToString(cmd)); boolean success = false; long startTime = System.currentTimeMillis(); try { Runtime rt = Runtime.getRuntime(); Process p; if (folder == null) p = rt.exec(cmd); ...
43d2a48b-a012-4b7a-8473-1d75789bd380
4
public LogDialog(final Panel panel) { setTitle("Log filter"); setBounds(1, 1, 250, 250); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan1 = new JPanel(); pan1.setBo...
3fbe2dfa-b3d3-426c-a820-8c7b7a0722db
2
public void init() { this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setLayout(new FlowLayout()); this.setResizable(false); this.setLocationRelativeTo(null); // Initialize labels. startLevelLabel = new JLabel("Resolution Start Level: "); stopLevelLabel = new JLabel("Resolution ...
88aac41a-a0f5-42fe-8bba-d505aa996786
0
public void save() throws SQLException { Map<String, String> values = new HashMap<String, String>(); values.put("reminderAhead", String.valueOf(this.reminderAhead)); super.save(values); }
71986bff-6608-4e9d-8695-27f5771117fa
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 Salarie)) { return false; } Salarie other = (Salarie) object; if ((this.num == null && other.num != null) || (t...
1c009def-915d-4ccb-b4ea-9433492ad8f9
5
private Color selectColourForButton(Keyboard keyboard, char key) { int[] RGB = new int[3]; int all = keyboard.getAmountOfAllKeys(); int keyAmount = keyboard.getAmount(key); double percentageOfKeyInFile = 100 * (double) keyAmount / all; if (keyAmount == 0) { return new...
7fc2c08c-b66f-4e6a-806e-42bc927a0341
6
private boolean tryMove(Shape newPiece, int newX, int newY){ for (int i = 0; i < 4; ++i) { int x = newX + newPiece.x(i); int y = newY - newPiece.y(i); if (x < 0 || x >= BoardWidth || y < 0 || y >= BoardHeight) return false; if (shapeAt(x, y) != Tet...
dcfafb52-4a9f-4d9b-9e9c-cd4c94465a0a
2
private void multiplicar(int columna, int fila, int[] datos) { int index = 0; int total = 1; for (int i = 0; i < fila; i++) { tableHtml += "<tr>"; for (int j = 0; j < columna; j++) { total *= getNumero(datos, index); tableHtml += "<td>" + g...
d603834a-d50a-4946-b97c-5ba720fbe260
5
@Override public void removeState(String toRemoveID) throws UnresolvedReferenceException { State toRemove = this.getState(toRemoveID); //Make sure that toRemove is not referenced in another state's transition table for (State toCheck : this.getStates()) { if (!toCheck.equals(toRemove)) { for (char symb...
967cdaf5-0a0d-467f-97b3-d697d8bca214
2
public String execute(String[] args){ int intPriority = Integer.parseInt(args[1]); if(intPriority < 1 || intPriority > 9) return "ERROR: Priority is only 1 - 9!"; runList.setPriority(Long.parseLong(args[0]), intPriority); return process.toString(); }
5550ed08-7158-446e-a63d-52bd4b8c525a
6
public boolean loadDataFiles(String filePath, String dataType) { File folder = new File(filePath); LoadDataWithJDBC obj2 = new LoadDataWithJDBC(); String filename = ""; File[] listOfFiles = folder.listFiles(); int count = 0; try { for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].is...
add05b35-0c22-4944-9895-385fa2671b5e
9
public static void main(String[] args) throws InterruptedException { if (args.length == 0) { System.err.println("usage: [-threads value] <files...>"); System.exit(1); } int numberOfThreads = 2; int startIdx = 0; if (args[0].equals("-threads")) { ...
9a092edf-aaf6-4662-9828-c8463ca9de64
8
public static Module load_mod( byte[] header_1084_bytes, DataInput data_input ) throws IOException { int num_channels, channel_idx, panning; int sequence_length, restart_idx, sequence_idx; int num_patterns, pattern_idx, instrument_idx; Module module; num_channels = calculate_num_channels( header_1084_bytes );...
6438a379-075a-4527-8fa0-7ddc13159b99
0
public WaitForGameThread(PongWindow window) { super("WaitForGameThread"); this.window = window; }
15382203-53da-4195-bb3b-96720cc305ae
1
public static void main(String args[]) { try { int port =4321 ; int poolSize =10; //init forum sys ForumSystem forumSystem = new ForumSystem(); User admin= forumSystem.startSystem("halevm@em.walla.com", "firstname", "admin", "1234"); //init reactor Reactor reactor = startEchoServer(port, p...
ac5020dd-612e-4639-bd2a-ade4eb2c5d73
8
private void testSend(final TransactionResultData data) { final Collection<InnerDataSubscription> allowed = _allowedDataIdentifications.get(data.getDataDescription()); final Collection<InnerDataSubscription> required = _requiredDataIdentifications.get(data.getDataDescription()); for(final TransactionDataset data...
79a7c342-2b67-4e68-8684-c2622f0ea7b2
3
private void writeObject(ObjectOutputStream out) throws IOException { out.writeUTF(getLevel().getName()); out.writeUTF(getLoggerName()); out.writeUTF(getMessage()); out.writeLong(getMillis()); out.writeInt(getParameters().length); for (Object p : getParameters()) { ...
783029fd-dce8-4556-ab1e-5dea0d1b2ea7
4
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); for (int i = 0; i < handler.objects.size(); i++) { GameObject tempObject = handler.objects.get(i); switch (tempObject.getID()) { case Player: switch (key) { case KeyEvent.VK_D: case KeyEvent.VK_A: tempObject.setVelX(0); ...
64b8c71d-f8bc-4e6d-8238-e58d97bf86ba
0
public static void publishQueryEvent(TicketQueryArgs args) { long sequence = _ringBuffer.next(); TicketQueryArgs event = _ringBuffer.get(sequence); args.copyTo(event); event.setSequence(sequence); // 将消息放到车轮队列里,以便处理 _ringBuffer.publish(sequence); }
e2b6ffbe-683e-4d2e-954d-b37160bed0a0
5
private boolean judgeRuleAuthorized(String deliQuery, ArrayList<String> paras, String localQuery) { boolean authFlag = false; if (localQuery.equalsIgnoreCase("null")) { System.out.println("[checkQuery] null"); // } else if (localQuery.equalsIgnoreCase("all")) { System.out.println("[checkQuery] all"); //...
1edbcb58-0ee7-41a3-b99e-c825d5ee0f50
1
public void deleteItem(Item item){ try{ session.beginTransaction(); session.delete(item); session.getTransaction().commit(); } catch(HibernateException e){ Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage()); } }
11a41f34-00f9-416f-b4d2-ff634997c277
2
@SuppressWarnings("empty-statement") public boolean gagne(){ int i; for(i=0; i < tabMarq.length && tabMarq[i] == 1; i++); return (i >= tabMarq.length); // On à trouvé aucun false }
31b4912c-93e8-4f90-bd9d-6bf94c2d9295
5
private int miehenAvecinPaikallaToistaSukupuolta(boolean mies) { int pisteita = 0; try { if (paikka.getMiehenAvecinPaikka() != null) { if (paikka.getMiehenAvecinPaikka().getSitsaaja().isMies()) { if (mies == false) { pisteita += 500...
00b036b8-c8fc-46f5-8604-53445d58aad1
3
public void act(Matrix matrix, Player player) { if (!isAlive) { return; } LinkedList<Node> neighbours = matrix.allNeighbours(x, y); if (neighbours.contains(matrix.getNode(player.getX(), player.getY()))) { hit(player); return; } ArrayList<Node> shortestRoute = matrix.shortestRoute(matrix.getNode(...
2f8d82c7-f36e-4781-b30e-0fcd99638285
8
public SummaryResult read(String filePath) { BufferedReader in = null; try { in = new BufferedReader(new FileReader(filePath)); String s; int line = 1; FileSplitUtil util = new FileSplitUtil(); while ((s = in.readLine()) != null && !strategy.endReading()) { } int i = 0; for (; (s = in...
2fee17c0-40dd-4dee-b72e-80fb762f02d0
2
public static void scan(InputStream source, InputStream format) throws IOException{ Scanner scanner = new Scanner(source); SimpleFormat sf = JAXB.unmarshal(format, SimpleFormat.class); CSVParser parser = new CSVParser(sf); Integer r = 0; while (scanner.hasNext(...
4d2831cc-7a84-4396-b9c3-0e1663eab757
5
void testFormulaCalc( String fs, String sh ) { WorkBookHandle book = new WorkBookHandle( fs ); sheetname = sh; try { sht = book.getWorkSheet( sheetname ); } catch( Exception e ) { log.error( "TestFormulas failed.", e ); } FormulaHandle f = null; Double i = null; /*************************...
5bd0ac33-ba0a-4592-b4a4-46591a33d7d4
5
public static boolean viewPassengerByTrain(ObjectOutputStream toServer, ObjectInputStream fromServer, Scanner scanner) throws IOException, ClassNotFoundException { log.debug("Start \"viewPassengerByTrain\" method"); System.out.println("Input train name"); String trainName = scanner.next().toLowe...
9f1e9d6a-2ebe-47be-9537-55e0969f741e
7
public static void main(String[] args) throws Exception { //input files String pathNetinf = args[0]; String pathGroundTruth = args[1]; //nodes HashSet<Integer> usedNodes = new HashSet<Integer>(); HashSet<String> predictedEdges = new HashSet<String>(); HashSet<String> trueEdges = new HashSet<String>...
e70a6e44-fe2f-40cb-92b3-63cae15d1861
5
private Comparable[] mergeTwoArrays(Comparable[] a, Comparable[] b) { Comparable[] merged = new Comparable[a.length + b.length]; int i = 0, j = 0, k = 0; while (i < a.length && j < b.length) { if (b[j].compareTo(a[i]) >= 1) { merged[k++] = a[i++]; } else...
b7e4c62f-1798-4b41-95d2-26992ae77813
5
public static void main(String[] args) { running = true; // Preliminary stuff (config handler and packet manager setup) System.out.println("Welcome to BBServer " + VERSION + ", the portal for Blazing Barrels multiplayer!"); File configFile = new File ("config.txt"); // File is within the jar for simplicity in ...
62cf7b83-92b2-4f28-9966-4fa1146ad469
6
public void start() throws IOException { System.out.println("GraphTrimmer started!"); PrintWriter errorLogWriter = new PrintWriter(new File( "./logs/GraphTrimmer-error-log.txt")); // PrintWriter logWriter = new PrintWriter("./logs/GraphTrimmer-log.txt"); int beforeCnt = 0, afterCnt = 0, finishedUsers = 0; ...
db52025e-8635-47cb-8d7b-b617a1f12d0b
0
@Override public void actionPerformed(ActionEvent e) { CommandFromGod cmd = (CommandFromGod) e.getSource(); cmd.execute(); }
4cd093e4-d728-4617-ba84-7b7c5cb30f52
3
private JSONWriter end(char mode, char c) throws JSONException { if (this.mode != mode) { throw new JSONException(mode == 'a' ? "Misplaced endArray." : "Misplaced endObject."); } this.pop(mode); try { this.writer.write(c); }...
5e559032-86e9-4fef-9131-7c694b6ef7c3
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employee other = (Employee) obj; if (deptId != other.deptId) return false; if (id != other.id) return false; if (name == null) { if ...
7fe06c68-e3b4-4216-9772-58fe78ded05e
4
public boolean specspell(int castID, int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int startHeight, int endHeight, int enemyY,int enemyX, int Lockon) { try { fcastid = castID; fcasterY = casterY; fcasterX = casterX; foffsetY = offsetY; foffsetX = offsetX; fangle = angle; fspeed = speed; fsh...
a214720c-f79c-4cfe-9d23-30ebb598a022
3
public final void accept(SpaceVisitor visitor) { // The return type is captured, this gives the visitor a change // to halt any further recursion in this space. boolean proceed = visitor.visit(this); if(proceed && !isLeaf()) { for(Space space : nodes) { space...
92bee464-330b-4f09-b7f2-c8086e956e05
7
public HashMap<String, ?> getAll(HashMap<String, ?> map) { Object def; String[] loc; for (String key : map.keySet()) { try { def = map.get(key); loc = key.split("."); if (def.getClass() == Boolean.class) { getBoolean(loc[0], loc[1], (Boolean) def); } else if (def.getClass() == Integer.clas...
1834fdee-9d42-4f58-9727-7adabb787a24
2
public static ChunkCoord getChunkCoord(int x, int z, World world) { long hash = ((long)x & 0xFFFFFFFFL) | (((long)z & 0xFFFFFFFFL) << 32); ChunkCoord coord = mCache.get(hash); if(coord == null) { coord = new ChunkCoord(x, z, world); mCache.put(hash, coord); } Validate.isTrue(coord.x == x && coord....
933bf642-f8ee-4ce2-853e-06185b8dec73
0
public void enable() { super.enable(); _accelerator.setEnabled(true); }
58954057-d35d-49bc-a548-8521b0636c3b
9
private void InsertionSort(List<Endpoint> endPoints, List<Integer> lookUp) { int endpSize = endPoints.size(); for (int j = 1; j < endpSize; ++j) { Endpoint key = new Endpoint(endPoints.get(j)); int i = j - 1; while (i >= 0 && key.compareTo(endPoints.get(i)) == -1) { Endpoint e0 = new En...
c476bcc3-5708-4087-a333-d6defb239dfe
8
public int get(byte[] data, int offset, int len) { if (len == 0) return 0; int dataLen = 0; synchronized (signal) { // see if we have enough data while (getAvailable() <= 0) { if (eof) return (-1); try { signal.wait(1000); } catch ...
26b66687-3250-4c2a-84fd-588c32093415
5
@Override public String execute() throws Exception { System.out.println("from ajax: account :" + account + " , password: " + password); user = this.service.login(account, password); // Invalid Account if(user == null) { status = 2; msg = "Invalid Account, plz check it out"; } // Wrong ...
62169f7e-5745-48c6-a4f2-0a5441e8cc55
2
private static void generationBased(int start, int maxDepth) { boolean done = false; int i=start; while (!done&&i<=maxDepth) { project.generateAlternativesGeneration(i++); project.log(path); done = project.calculateEnergyConsumptionGeneration(); } project.findBestSystemGeneration(); project.visuali...
03e08687-e26a-4c9f-a9ea-2ec5d4907462
1
public Player(String[] newDeck, GameState gameState) { playedLand = false; this.life = 20; this.deckList = newDeck; deck = new ArrayList<Card>(); hand = new ArrayList<Card>(); this.gameState = gameState; this.manaOpen = new int[6]; this.graveyard = new ArrayList<Card>(); //this.playerStyle = (int) Mat...
c9692182-8e31-4e48-9062-6609c7c9cb26
7
private void setUpLists(int level) { strandOne.clear(); strandTwo.clear(); strandThree.clear(); strandFour.clear(); inPlayOne.clear(); inPlayTwo.clear(); inPlayThree.clear(); inPlayFour.clear(); score = 0; progress = 0; oddBalls.add(new CurrentBall(5, imageMap.get("greyBall"), imageMap.get("apcoli"), null, nu...
48645bab-e6e0-437b-b873-c51d86815010
6
private void copyRGBtoRGBA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
960b8934-1ad1-4e37-9f69-642b765a1c4b
9
private void onMessageDecoded(final CoreMessage message) { if (message.getType().equals(CoreMessageType.READY_TO_RECEIVE_FILE)) { File file = new File(this.sendingFile.pathName); try { this.readingFile = new RandomAccessFile(file, "r"); this.readChannel = this.readingFile.getChannel(); this.beginSen...
8dc46ce0-f911-4495-88e5-c92e0e66d1f0
9
@Override public boolean doMove() { int startSteps = curGb.stepCount; prepareMovement(); while(true) { if(!check) { curGb.step(dir); // walk break; } else { State s = curGb.newState(); int add = EflUtil.runToAddressLimit(0, dir, 100, curGb.pokemon.walkSuccessAddress, curGb.pokemon.walkFa...
802a68c9-9b4a-4da0-9436-6125b84619ef
0
public static void main(String args[]){ new Client(); }
718e5705-20e3-423e-b818-bb55521b10b0
7
public static void SymbolTest2() { int counter = 1; // set up stdout for output PrintStream stdout = new PrintStream( new FileOutputStream( FileDescriptor.out ) ); // // Construct SymbolData Table // // // When symbol stable is constructed, it creates one scope with the // name supplied in the...
c40baf88-ada9-4470-b88f-17fba667d7f6
6
public String findFindWhat(String $_original_invoice) throws Exception { if($_original_invoice.contains("map")){ return new DiscisionForMap().findOrShowMapof($_original_invoice); } else if($_original_invoice.contains("hotel")){ return findHotel($_original_invoice); } else if($_original...
58830d1d-b1a2-458a-aea2-19a0aaa47a85
1
public void paint(Graphics g) { if (img == null) super.paint(g); else g.drawImage(img, 0, 0, null); }
6e7dba83-837b-4aa8-8d8c-4145d896ef94
3
public void saveBounds() { String keyPrefix = getWindowPrefsPrefix(); if (keyPrefix != null) { Preferences prefs = getWindowPreferences(); boolean wasMaximized = (getExtendedState() & MAXIMIZED_BOTH) != 0; if (wasMaximized || getExtendedState() == ICONIFIED) { setExtendedState(NORMAL); } prefs.st...
cb27c2d8-36b4-4904-9147-9248f8027a45
8
private void adjustDirection() { // set a random movement vector based on where the feeder is. // will determine the quadrant to point vector to (relative to the // feeder's current location). if (currentLocation.x < Environment.getMinX()) { // on left edge if (currentLocati...
ad8fb735-9e36-462f-87a4-94204568e8b8
6
public static Stella_Object accessRelationSlotValue(Relation self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_ABSTRACTp) { if (setvalueP) { self.abstractP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper)(value))); } else { ...
c01477b0-8b8c-4f6e-9808-0f3666a8a391
8
public Object getObjectInstance(final Object ref, final Name name, final Context nameCtx, final Hashtable<?, ?> environment) throws Exception { final ClassLoader classLoader = SecurityActions.getContextClassLoader(); if(classLoader == null) { return ref; } final String factor...
da1568d6-44b9-449e-9834-ca742b3df228
7
@Override public <T extends Serializable> boolean unRegisterSubscriber(String subscriverId) { LOGGER.log(Level.FINEST, "request unSubscription on OdynoDataBus"); for (Iterator<Subscriber<?, ?>> it = subscribers.iterator(); it.hasNext();) { Subscriber<? extends Serializable, ? extends Fi...
c4536561-fcfa-45ff-804e-ec112f611ff3
2
public void addComponent(Component component){ component.setOwner(this); components.add(component); if(Renderable.class.isInstance(component)){ renderers.add((Renderable)component); } if(Updatable.class.isInstance(component)){ updaters.add((Updatable)component); } }
b83cba5c-2e9c-4fbb-b71a-a2c247891f59
4
public void toggleOpen() { if (moveTimer > 0) return; containerOpen = !containerOpen; if (containerOpen) { Item active = getActiveItem(); if (active != Item.FIST && active != null) inventory.addItem(active, 1); setActiveItem(Item.FIST); } }
0c169175-7d05-4f1c-aa88-324660332612
4
private boolean validate(String road) throws IOException, InputException { if (road == null ||road.equals("")) return false; InputStream fis; BufferedReader br; String line; fis = new FileInputStream("data/road_names.txt"); //skal ændres til det rigtige fil navn ...
d57b40f0-cd3a-491c-b08c-7149ee9e88a6
7
@SuppressWarnings("deprecation") public void addCbaseItem(ServiceInfo info) { if( info.getServiceId() == -1 ) return; // first create status array conn.query("SELECT * FROM "+SCHEMA+".service_date_uptime where service_id = "+info.getServiceId()); ResultSet rs = conn.getQueryResult(); String uptimeDate = "...
43243292-f59e-46ed-a245-934335e8aa4e
1
ColorComboBoxRendererWrapper (JComboBox comboBox) { this.renderer = comboBox.getRenderer(); if( renderer instanceof ColorComboBoxRendererWrapper ) { throw new IllegalStateException("Custom renderer is already initialized."); //NOI18N } comboBox.setRenderer( this ); }
bd2b583f-30a4-4c61-b115-60b66fffbc71
3
public T dequeue() throws Exception { T res; if (s1.isEmpty()) { throw new Exception("Empty queue"); } while (!s1.isEmpty()) { s2.push(s1.pop()); } res = s2.pop(); while (!s2.isEmpty()) { s1.push(s2.pop()); } return res; }
b97bc2a0-34e6-4a68-a59a-7f6ccd51aae5
9
public static ArrayList<String> separaTokens(String expr) throws Exception { ArrayList<String> tokens; String token = ""; boolean entreAspa = false; expr = expr.trim(); if (expr.length() != 0) { tokens = new ArrayList<String>(); entreAspa = false; for (int i = 0; i < expr.length(); i++) { if (e...
3592dc0e-c727-43ef-9141-a711a2d44d8c
2
static void p2(int pos, int maxUsed) { if(pos == k) { System.out.println(Arrays.toString(a)); } else { for(int i = maxUsed; i <= n; i++) { a[pos] = i; p2(pos+1,i); } } }
51e33dba-18e9-4e91-a787-d39d191d18f9
0
public PolynomialTerm(double power) { _power = power; }