method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3ed8e7b8-bfbd-46bf-a387-bc4866ff7cf8
9
void run(){ Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; sc.next();sc.next(); page = new R[n]; ref = new TreeMap<String, Integer>(); id = 0; for(int i=0;i<n;i++){ int x = get(sc.next()); int k = sc.nextInt(); while(k--!=0){ page[x].l.ad...
595811d6-f6fe-4dd0-9d90-24bef9e430f1
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
afd6aacd-ac73-462e-ab50-ba1add06f5e7
4
@Override public AbstractState getState(int i, int j) throws ArrayWidthException, ArrayHeightException { if (i < 0 || i > this.width - 1) { throw new ArrayWidthException(i); } if (j < 0 || j > this.height - 1) { throw new ArrayHeightException(j); } ret...
a4c38f66-2237-4c59-9a54-cda3952fe788
9
public static int getSpace(int board, int space) { switch (space) { case 0: return (board / 100000000)%10; case 1: return (board / 10000000)%10; case 2: return (board / 1000000)%10; case 3: return (board / 100000)%10; case 4: return (board / 10000)%10; case 5: return (board / 1000)%10; case 6: return (b...
5d17fa1d-3aa6-4504-a9d1-82e776519ee2
5
public static boolean isMonotonic(double[] x){ boolean monoFlag = true; int n = x.length; double gap1 = x[1] - x[0]; double gap0 = gap1; if(gap1==0.0){ monoFlag = false; } else{ for(int i=2; i<n; i++){ gap1 = x[i] - x[i-1]; ...
12b79dd3-6af8-484b-96ee-c067bc661c99
5
public void messageReceived(Client source, Message m) { if (m instanceof ChatMessage) { chatHud.addMessage((ChatMessage) m); } else if (m instanceof ActionMessage) { ActionMessage am = (ActionMessage) m; if (am.action.equals(ActionMessage.ACTION_JUMP_PLA...
556fa139-a951-4e87-bcb3-2832474cc019
0
@Override public String toString() { return "[Type: io.chronize.adsb.interfaces.Circle] [Area: " + getArea() + "] [Perimeter: " + getPerimeter() + "] [Radius: " + _radius + "]"; }
37514f88-66f6-4ed8-a3f5-215b2b849c42
8
void floyd(int rows) { for (int i = 0; i < rows; i++) { for (int j = 0; j < rows; j++) { padres[i][j] = i; if (distancias[i][j] == INF || i == j) padres[i][j] = -1; } } for (int k = 0; k < rows; k++) for (int i = 0; i < rows; i++) for (int j = 0; j < rows; j++) if (dista...
cbf048ce-4535-4cdf-8537-210ee583fa79
0
public Entity(int x, int y) { this.x = x; this.y = y; }
49414bdf-e028-4b90-8065-b6f11151df94
7
private void loadLetterPool() throws IOException, FileNotFoundException{ BufferedReader in = null; try { in = new BufferedReader(new FileReader(LETTER_POOL)); String line; while((line = in.readLine())!=null){ line = line.trim(); int numLetters = Integer.parseInt(line.substring(0, 2)); line = li...
bf1dc5c3-8765-4960-add7-1be71a6d4f23
8
public boolean isValidNewTask() { try { String subject = params.get(DataXMLManager.SUBJECT); String content = params.get(DataXMLManager.CONTENT); String recipient = params.get(DataXMLManager.RCPT); String date = params.get(DataXMLManager.DATE); String time = params.get(DataXMLManager.TIME); return !...
245fd533-1d73-4cb2-820b-0a391b6caf15
3
public double variance(int nt) { double var = 0; double dnt = nt; double dn = n; double mu = mean(nt); for( int i = 1; i <= n; i++ ) for( int j = 1; j <= n; j++ ) { double di = i; double dj = j; if( i == j ) var += di * dj * dnt / dn; else var += di * dj * dnt * (dnt - 1) / (dn * (dn - 1));...
52e7d189-e228-48b3-ba7f-363f3c24820f
9
private String getBinaryFromBase(String valueAndBase) throws AssemblerException{ char base = valueAndBase.charAt(valueAndBase.length() - 1); String value = valueAndBase.substring(0, valueAndBase.length() - 1); // Binary if (base == 'B') { if (value.isEmpty()) throw new AssemblerException( "Valu...
1501eea3-ab9f-401c-a675-3edb7305929a
7
private void parseFunction(String declaration) { int parametersStart = declaration.indexOf("("); int parametersEnd = declaration.indexOf(")"); valid = parametersStart >= 0 && parametersEnd >= 0; if (valid) { String parametersString = declaration.substring(parametersStart + 1, parametersEnd).trim()...
c45672e4-7f8e-416f-932c-fde24ffceff1
9
public static void main(String[] args) { Watch.start(); List<Integer> primes = Utils.sievePrimes(N); HashSet<Integer> primesSet = new HashSet<>(primes); int[] divisors = new int[N]; for (int n = 2; n < N; n++) { if (primesSet.contains(n)) { divisors[n]...
179bc9f7-45b9-4f2b-b451-c10fa15ca03c
6
boolean needToInstall(File installDir) throws MalformedURLException { File downloadDir = Utils.downloadDir(); for (int i = 0; i < jars.length; i++) { File d = new File(downloadDir,jars[i]); File f = new File(installDir, jars[i]); if (!f.exists() || f.length() == 0 || ...
ab6f78d3-5a74-47f7-9285-c535b0acc9ab
2
@Override public void update(GameContainer gc, int delta) { if(isChatting && !gui.isVisible()){ isChatting = false; gameObject.setMovementLock(false); player.setMovementLock(false); } }
b0543816-fa47-4d58-b52d-a46d0910c33e
1
private String getName(int next) throws IOException { StringBuilder str = new StringBuilder(); while (isAlNum(next)) { str.append((char) next); next = getChar(); } ungetChar(next); return str.toString(); }
dadc979a-fe19-44c7-a6bc-041a4c9be013
4
public void saveCollection(String fileName) { //open the file File file = new File(new Direc().get(), fileName); BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(file)); writeCollection(bufferedWriter); } catch (FileNotFoundException ex) { System.err.prin...
52a74974-cc40-4094-8c1b-ee636e784c59
3
public int getEnemyCount() { int enemys = 0; int number = 256; while (true) { if (containsNumber(number)) { if (containsNumber(number + 1)) { enemys++; number += 2; } else { Logger.log("Found enemy " + number + " without patrol location " + (number + 1), Logger.ERROR); Game.exit(1);...
c11e4177-5465-405c-970f-91c5de216935
5
public int getDojoBorder(boolean close, int dojo) { if(close){ if (dojo == 1) return 50; else if(dojo == 2) return 220; }else{ if (dojo == 1) return JudokaComponent.WIDTH - 250; else if(dojo == 2) return JudokaComponent.WIDTH - 350; } return 0; }
400c2704-47d4-4949-b39f-16a2804b8f50
7
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerInteract(PlayerInteractEvent event) { if (!event.isCancelled()) { if (event.getAction() == Action.LEFT_CLICK_BLOCK) { final Block block = event.getClickedBlock(); if (event.getClickedBlock().getType() .equals(Material.WALL_SIG...
a5179bea-f502-4f2f-b089-7b56b8f3e1eb
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 to * string. If we reach an early end, bail. */ for ...
0fb075e0-d0e5-4cfe-8691-5719d4642e83
7
public void addShip(int id, String vesselClass, Double cog, Double sog, Double lat, Double lon, Byte shipType, Byte navStatus) { if (cog == null) { cog = 0d; } if (shipType == null) { shipType = 0; } if (sog == null) { sog = 0d; } // Round cog to nearest 10 long cogL = Math.round(cog / 10...
905b89a9-8203-4fa5-8be1-fefe5b7187cc
9
public static String[] getVariablesFromSMVModel(String smvFile) throws IOException { Set<String> variables = new HashSet<String>(); BufferedReader r = FileUtil.openFileForRead(smvFile); try{ String nextLine = null; do { nextLine = r.readLine(); } while (nextLine != null && !nextLine.trim().equalsIg...
a6577328-2e3e-453f-a6a4-2d123e6b413f
8
private void encodeRefresh(ItemInfo itemInfo, Object[] orderEntries, boolean completed, boolean solicited) { OMMMsg outmsg = _mgr.getPool().acquireMsg(); outmsg.setAttribInfo(itemInfo.getOMMAttribInfo()); outmsg.setItemGroup(0); // Set the message type to be refresh respons...
a417de33-836f-429c-bbf7-71a131dbc6e2
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(commandLabel.equalsIgnoreCase("qdeop")){ Player target = (Bukkit.getServer().getPlayer(args[0])); if (target == null) { sender.sendMessage(ar...
a6f1b377-937b-47ad-b3f9-3bc8dfed0d46
6
public Vector WriteRain(String folderPath, String fname) { String filename = this.getClass().getResource("/Data/188/2012-03-21/"+ fname+".cdf").getPath(); System.out.println("filename for NHMM:" + filename ); Vector vec = new Vector(); NetcdfFile ncfile = null; try { ncfile = NetcdfDataset.openF...
15f0af4c-1e51-421c-9b56-e9ecbfc4f574
3
static void set(final Field fld, final Object target, final Object value) throws IllegalAccessException { if (System.getSecurityManager() == null) fld.set(target, value); else { try { AccessController.doPrivileged(new PrivilegedExceptionAction() { ...
14a2d57b-3996-45fd-bf26-7fd82e1a474b
3
static void interfaces(Class<?> type) { System.out.print("Interfaces in " + type.getSimpleName() + ": "); List<String> result = new ArrayList<String>(); for (Class<?> c : type.getInterfaces()) result.add(c.getSimpleName()); System.out.println(result); }
ff19bc61-15da-49b0-b835-52e19f58a851
7
public static boolean reportError(final ShipEngine me, final Software controlI, final MOB mob, final String literalMessage, final String controlMessage) { if((mob!=null) && (mob.location()==CMLib.map().roomLocation(me)) && (literalMessage!=null)) mob.tell(literalMessage); if(controlMessage!=null) { if(cont...
88f56a5a-cf35-4fdb-bba2-fbc9a1a2c955
6
public void handleKeyRelease(int value) { switch (value) { case MinuetoKeyboard.KEY_UP: this.frameRate++; window.setMaxFrameRate(frameRate); break; case MinuetoKeyboard.KEY_DOWN: this.frameRate--; if (this.frameRate < 1) this.frameRate = 1; window.setMaxFrameRate(frameRat...
a956227c-52d6-4119-bbeb-0518fe5d7618
7
public static String arrayToString(Object array) { String result; int dimensions; int i; result = ""; dimensions = getArrayDimensions(array); if (dimensions == 0) { result = "null"; } else if (dimensions == 1) { for (i = 0; i < Arra...
2b4a6e9b-0794-47e9-b26c-5f453dc19ad2
6
public void menuLoop () throws FileNotFoundException { //Establish the variable that will keep track of the user's choice. Also establish a Scanner to read the user's choice. int choice = 0; System.out.println("~GoblinKing Enemy-Horde-Management System~ \n"); //Launch the Creator and Combat menus. Creat...
db1c03cc-c016-4c9a-bde9-c29dae13ecad
9
static boolean esSlump(char[] str, int cotaInf, int cotaSup){ if(cotaInf >= cotaSup)return false; if(str[cotaInf] != 'E' && str[cotaInf] != 'D')return false; int posIni = cotaInf+1; if(str[posIni] != 'F')return false; for(;posIni <= cotaSup; posIni++)if(str[posIni]!='F')break; if(posIni>cotaSup)return false...
eafa4e90-065d-4675-8fa3-f6186580089d
6
public static User createUser(String line,ServerMonitor mon){ try{ String[] args = new String[3]; for(int i = 0; i< 3; i++){ int first = line.indexOf(fields[i]); int second = line.indexOf(fields[i+1]);; args[i] = line.substring(first+fields[i].length(),second-2); } int rank = Integer.parse...
419c3e98-fcb4-4dfe-bb57-a8a66f138ef3
8
public static int compareTo(byte[] lhs, byte[] rhs) { if (lhs == rhs) { return 0; } if (lhs == null) { return -1; } if (rhs == null) { return +1; } if (lhs.length != rhs.length) { return ((lhs.length < rhs.length) ? ...
7bea08a9-ad6f-4d69-9497-8cee9918a244
7
public int read(int address) { long before = System.nanoTime(); int sets = Cache.MAX_SIZE / this.assoc / this.blockSize; int blockNo = address / this.blockSize; int pos = blockNo % sets; byte tag = (byte) (blockNo / sets); //MRU Way Prediction if (this.mru[pos] >= 0 && tag == this.tags[pos+this.mru[pos]])...
bd7ad479-9970-4a0e-a86d-264416148dc7
9
public static void main(String[] args) throws IOException, ParseException { // TODO Auto-generated method stub Options opt = new Options(); opt.addOption("", "db", true, "The File used for Training"); opt.addOption("", "method", true, "The method used for Training"); opt.addOption("", "probabilities", false, ...
41c6c95a-b0bb-4031-a008-64c199090f41
3
@Override public boolean touchObject() { boolean touch = false; for (int j = 0; j < Board.getObstacles().size(); j++) { Rectangle r = new Rectangle((int)Board.getObstacles().get(j).getX(),(int)Board.getObstacles().get(j).getY(),Board.getObstacles().get(j).getWidt...
435f88ba-d6a0-4cb6-93cd-5c9bf81edfbb
9
public static String getEncode(File f){ String code = "gb2312"; try { InputStream inputStream = new FileInputStream(f); byte[] head = new byte[3]; inputStream.read(head); if (head[0] == -17 && head[1] == -69 && head[2] == -65) code = "UTF-8"; if (head[0] == -1 && head[1] == -2) code = "UTF-16...
db73a4c3-e247-47b8-a085-03fb6e2f3f73
4
@Override public boolean movePointIntoLevel(PointD p){ boolean ans = false; if(p.x < -0.5f){ p.x = -0.5f; ans = true; } if(p.x > level.w - 0.5f){ p.x = level.w - 0.5f; ans = true; } if(p.y < -0.5f){ p.y = -0.5f; ans = true; } if(p.y > level.h - 0.5f){ p.y = level.h - 0.5f; ans =...
fca5de4b-4ddf-4e27-b578-e79e2c058335
2
public void run() { while (true) { try { StockControl.doUpdate(); Thread.sleep(time); } catch (InterruptedException ex) { Logger.getLogger(StockControl.class.getName()).log(Level.SEVERE, null, ex); } ...
8804f25c-4c2a-499c-b161-e323794bcc18
2
public static void main(String[] args) { try { File file = File.createTempFile("icon", ".txt"); FileSystemView view = FileSystemView.getFileSystemView(); Icon icon = view.getSystemIcon(file); file.delete(); UIManager.put("Tree.leafIcon", icon); UIManager.setLookAndFeel("com.s...
307ddee1-8922-4cc0-9e5e-0ccad05b93fe
0
public String getMimeType() { return mimeType; }
330ec354-ed7d-4cb2-888b-0afa6ed8c876
1
public FontPanel(Font font) { super(new FlowLayout(FlowLayout.LEFT, 5, 0)); setOpaque(false); mFontNameMenu = new JComboBox<>(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); mFontNameMenu.setOpaque(false); mFontNameMenu.setToolTipText(NAME_TOOLTIP); mFontNameMenu.setMaximu...
ff44e119-8dc4-481b-a319-6cb9d4603ea8
4
public void startListening() { SwingWorker w = new SwingWorker() { protected Object doInBackground() { boolean retry = true; while (retry) { try { RESTDatabase.this.listen(); } catch (JSONException e1) { System.err.println("WARNING: " + RESTDatabase.this + " " + e1)...
cde9dd42-a880-4369-8d03-a9568735989d
1
public float getImageWidth() { if(texture != null) { return (float)texture.getImageWidth(); } else { System.err.print("RoyalFlush: Texture2D.getImageWidth - No texture has been loaded.\n"); return -1.0f; } }
170902f3-eaa2-4922-9561-8b90e4305653
2
public Triangle(Vertex[] vertices, int[] indices) { if (vertices.length != 3) { System.err.println("Triangles require 3 verts, you sent " + vertices.length); return; } if (indices.length != 3) { System.err.println("Triangles require 3 indices, you sent " + in...
d06df9d8-7265-4fab-a8a9-15f349bed326
3
private void blueTeamScoreFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_blueTeamScoreFocusLost // TODO add your handling code here: try{ Integer.parseInt(blueTeamScore.getText()); } catch(Exception e){ blueTeamScore.setText("0"); } ...
350d9872-9523-43d1-bd85-e7d2455ba488
1
private Coord localToReal(Coord lc) { Gob pl = ui.sess.glob.oc.getgob(mv.playergob); if (pl == null) return Coord.z; // MAGIC!~ return pl.rc.add(lc.sub(pl.rc.div(tileSize).add(mv.mc.div(tileSize).add(off.div(scales[scale])).inv()).add(sz.div(scales[scale]).div(2))).mul(tileSize)); }
fcf5545b-f5a7-4c18-bc17-f870d8c313af
5
public int move() { int pointEat = 0; pacMan.nextMove(); if (pacMan.isOutOfCellBounds()) { pointEat = nextCell(pacMan); } for (Phantom phantom : phantoms) { if (phantom.isAValidDirection(phantom.getDirection()) && canExit(phantom)) { ...
123cd46e-5fb4-4873-b427-346382a07456
3
private void setKey(byte[] keyBytes) { workingKey = keyBytes; x = 0; y = 0; if(engineState == null) { engineState = new byte[STATE_LENGTH]; } //reset the state of the engine for(int i = 0; i < STATE_...
171635ff-8c3e-4acd-9ddc-29e88ee26748
9
public void send() throws XPathException { if (root==null) { throw new XPathException("DOMSender: no start node defined"); } if (receiver==null) { throw new XPathException("DOMSender: no receiver defined"); } receiver.setSystemId(systemId); pipe.s...
5e79ed76-cb90-4804-ba70-de1c30bf3a4d
9
public void handleInput() { if (allowClick) { if (game.mouse.getX() > button1X && game.mouse.getX() < button1X + buttonWidth && game.mouse.getY() > button1Y && game.mouse.getY() < button1Y + buttonHeight) { button1Image = buttonHoverOn; if (game.mouse.getButton() == 1) { if (previousState == GameState...
5c2002e5-7227-4cba-a60b-f98b503260e5
4
void parse_frame() throws BitstreamException { // Convert Bytes read to int int b=0; byte[] byteread = frame_bytes; int bytesize = framesize; // Check ID3v1 TAG (True only if last frame). //for (int t=0;t<(byteread.length)-2;t++) //{ // if ((byteread[t]=='T') && (byteread[t+1]=='A') && (byteread[t+2]=='G')) ...
b8a96b85-76a7-40eb-aa27-289945ed7a0f
6
@Override public int run(CommandManager manager, Object... args) { String word = ""; boolean verbose = false; //HANDLE ARGUMENTS if(args != null && args.length ==2){ word = (String)args[0]; verbose = (Boolean)args[1]; } //If arguments are invalid, prompt the user. else{ @SuppressWarnings("res...
a2603cc5-1c3c-400a-909f-7f9cc8bf28f9
0
public void setCtrMoaConsec(int ctrMoaConsec) { this.ctrMoaConsec = ctrMoaConsec; }
380cc759-ad06-4fe1-89f3-d2732127c14b
1
public String addToDeck(int indexFrom) { List<Card> cards = board.get(indexFrom); Card topCard = cards.get(cards.size() - 1); if (topCard.getRank().ordinal() == indexFrom) { deck.push(cards.remove(cards.size() - 1)); return ""; } else { return "Cannot ...
48b727fa-1a76-4a2a-a1bd-67d2bd14acef
2
public static void start() { try { serverSocket = new ServerSocket(3333); System.out.println("[SERVER] Started"); waitingForClients = true; while(waitingForClients) { Socket socket = serverSocket.accept(); System.out.println("[SER...
99a74519-eb79-4dc2-8511-6f7f249130f1
7
public static Chunk loadChunk(GameMap map, String name, int posx, int posy) throws Exception { String chunkPath = path +"/"+ name +"/chunks/"; if (!new FileHandle(chunkPath + posx + " " + posy + ext).exists()) return null; NBTInputStream nbtin = new NBTInputStream(new FileInputStream(new FileHandle(chunkPath +...
7086b002-5dca-4fb4-aefe-e4c4a9d84338
3
public int firstExonPositionAfter(int pos) { for (Exon ex : sorted()) { if (pos <= ex.getStart()) return ex.getStart(); if (pos <= ex.getEnd()) return pos; } System.err.println("WARNING: Cannot find first exonic position after " + pos + " for transcript '" + id + "'"); return -1; }
5a710b7f-7f14-4847-9d6e-735691711781
6
public void renderFilter() { image = loader.getImage(); raster = image.getRaster(); int[] pixels = new int[image.getWidth() * image.getHeight() * 3]; raster.getPixels(0, 0, image.getWidth(), image.getHeight(), pixels); for(int i = 0; i < pixels.length; i += 3) { //Get the r, g, and b individually. ...
f0549bbd-2aad-4ab7-a6bd-d3b37bc29eed
5
public void dequeueSound( String filename ) { if( filename == null || filename.equals( "" ) ) { errorMessage( "Filename not specified in method 'dequeueSound'" ); return; } synchronized( sequenceQueueLock ) { if( sequenceQueue != null ) ...
84aebb99-4802-4174-a21e-d736243d4b97
6
public PayFineDialog(BorrowerAccountPanel parent, Controller session, int FID, String borrowerName, String Title, String date, String amount) { setResizable(false); setTitle("Pay Fine"); this.parent = parent; this.mySession = session; this.fineID = FID; this.borrowerName = borrowerName; this.title = Titl...
18f626a8-31d3-4cfa-9bcd-671d1342737a
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...
8aa800f8-89b2-4bf3-97e6-c43c47bcad4c
5
@Override public void validate() { super.validate(); if (SUBMIT.equals(getSubmit())) { if (StringUtils.isBlank(issueBookVO.getStudentID()) //|| !(StringUtils.isAlphanumeric(issueBookVO.getStudentID())) ) { addFieldError("issueBookVO.studentID", "Enter valid student ID"); } if (StringUtils.isB...
84f37c4f-fd1a-40c7-8d7a-49da66ea0603
6
public static double log1p(final double x) { if (x == -1) { return x / 0.0; // -Infinity } if (x > 0 && 1 / x == 0) { // x = Infinity return x; } if (x > 1e-6 || x < -1e-6) { double xpa = 1.0 + x; double xpb = -(xpa - 1.0 - x); double hiPrec[] = new double[2]; final double lores = log(x...
90356f5b-bc01-4043-8614-878620c16c08
1
public static void main(String[] args) throws FileNotFoundException { String result = ""; PropertiesReader propertiesReader = new PropertiesReader(); if (args.length > 0) result = propertiesReader.printPropertiesFromFile(args[0]); else result = propertiesReader.printPropertiesFromFile(DEFAULT_FILE_NAME); ...
f7b107a1-6d6c-44e4-a670-ff22a2513c1d
7
@Override public <E extends Serializable> void handle(Transport<E> unwrappedRoot, Set<String> includesPath, Method setter, Serializable value) throws SerializationProcessingException { if (includesPath==null || includesPath.isEmpty()) { //Don't bother - nobody wanted to see this value on client side return; } ...
56ee66a0-95fa-430b-9690-91fa3b9b75b1
1
public boolean store(int user,int isbn) throws IOException { if(new Library().store(user,isbn)) { user_id=user; book_isbn=isbn; String str= String.valueOf(user_id+book_isbn); FileWriter fw=new FileWriter("BookRepository.dat",true); BufferedWriter Bw=new Buffere...
c4f43a63-0790-4bf1-b2eb-8ccc1601c7a5
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...
8cac514c-512e-4d8e-a8fb-dec74a4f9452
0
public String getAlgoName(){ return algoName; }
24364266-2743-4eea-b133-1b961ab62049
9
private void updateTableFromTextEditor() { tableHeaderMenu = new Menu(tableViewer.getTable()); // PropertyFile propertyFile = (PropertyFile) treeViewer.getInput(); model.removeModelListener(csvFileListener); model.setInput(editor.getDocumentProvider() .getDocument(editor.getEditorInput()).get()); ...
5708e533-522e-42b5-93fe-1f2db05f3187
8
public void update(float delta) { for (GameObject g: gameObjects) { // update velocity g.getVelocity().add(new Vector2(g.getAcceleration().mul(delta))); if (g.getVelocity().len2() > g.getMaxVelocity2()) g.getVelocity().div(g.getVelocity().len()).mul(g.getMaxSp...
a4006c0f-d1d6-4c6a-a80d-657aee485cc4
0
@Override public Node getNode() {return node;}
7cae46a5-4cc3-4484-9ecc-fc132a74dd2a
7
public boolean hasPrev() { if (left.hasPrev()) return true; else if (right.hasPrev()) return true; else if (last_choice == null) return false; else if (last_choice == left && !rightBOF) return ((Comparable)left.current()).compareTo(right.current()) > 0; else if (last_choice == right && !leftBOF)...
bb2503a6-a8d7-4167-a13b-9de30d4a4e3a
9
public boolean isBipartite() { this.setState(States.ARR_ADJ); boolean result = true; int[] part = new int[this.getVertexCount()]; Arrays.fill(part, -1); int fromNode = 0; part[fromNode] = 1; Queue<Integer> queue = new LinkedList<Integer>(); queue.add(fromNode); while (!queue.isEmpty()){ int u ...
b03c2c1c-2975-4bfa-b9cf-49d50653e7b6
5
private void btn_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_loginActionPerformed boolean failed = false; try { Database db = MysqlDatabase.getInstance(); db.first(txf_host.getText()+":"+txf_port.getText(), txf_database.getText(), ...
162c250b-22c9-45f4-8d3f-cc886cae6b83
5
private TimeSeriesCollection createTimeSeriesData() throws VehicleException, SimulationException { TimeSeriesCollection tsc = new TimeSeriesCollection(); TimeSeries vehTotal = new TimeSeries("Total Vehicles"); TimeSeries parkedTotal = new TimeSeries("Parked Vehicles"); TimeSeries carsTotal = new TimeSeries("C...
c6287d5f-45ae-480a-9392-b289848cb8fd
7
protected void onBeforeRender() { MySession sess = (MySession)getSession(); Board bd = sess.getBoard(); // =================================== // リンクの有効化、無効化 // =================================== // TODO あとで消す //add(new SimpleAttributeModifier("style", "")); add(new SimpleAttributeModifier("style", ...
5eee01f1-f223-4ad1-adac-00827a0030f3
6
private void queryBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryBtnActionPerformed dbTA.setText(""); try { //Collecting contents of relevant data input fields from the GUI String theFN = firstNameTxt.getText(); String theLN = lastNameTxt....
698cee33-51e3-4747-a8c7-76fbb66ec1da
5
private String genMovem() { int a = Generator.nextInt(5); switch(a) { case 0: return ""; case 1: return "W"; case 2: return "A"; case 3: return "S"; case 4: return "D"; } return ""; }
463f691f-b463-41f9-9650-ad165f8f92a2
5
public boolean receiveBook(IssueBookVO issueBookVO) throws LibraryManagementException { boolean returnValue = false; IssueBookDAO issueBookDAO = new IssueBookDAO(); try { if (issueBookDAO.getStudentByUniqueId(issueBookVO) && issueBookDAO.getBookByUniqueId(issueBookVO)) { if (issueBookDAO.getStudent...
212b0247-cb70-4b2e-96ee-f40e38511afb
2
public int pop() { while (!isEmpty()) { temp.push(super.pop()); } int ret = temp.pop(); while (!temp.isEmpty()) { push(temp.pop()); } return ret; }
0c4848fc-9b86-4635-ac69-1a8e20ae3f94
6
public static long gvLong(Map<?,?> array, String key, long defLong) { if (array == null || key == null) return 0; Object retObj = gv(array,key); if (retObj == null) return defLong; long retLng = 0; try { retLng = Long.parseLong(retObj.toString()); } catch (Throwable e) { retLng = defLong; } return...
ecb44811-d803-408a-86e4-d8b17e093705
9
public int getSizeModifier() { switch (size) { case FINE: return 8; case DIMINUTIVE: return 4; case TINY: return 2; case SMALL: return 1; case MEDIUM: return 0; ...
3a34bb38-9f39-400e-a646-405ace8eb4b4
7
@Test public void testNotify() { final Object o = new Object(); Runnable r = new Runnable(){ @Override public void run() { assertThreadIsRunnable(); try { synchronized(o){ o.wait(); // wait can only be invoked on an object if the thread which invoked wait owns the moni...
b06a415f-bc4f-40a5-aa5a-de1f6c814e3f
8
public void run() { seqNo = (int)Math.floor(Math.random() * 65535D); logMessage("Starting for \"" + botID + "\"."); try { connection = new Socket("toc.oscar.aol.com", 21); connection.setSoTimeout(10000); in = new DataInputStream(connection.getInput...
a07e6374-aff0-4012-b1a3-06358ec8dd44
4
public static List<String> expandWithThesaurusBroader(String node) throws JSONException { List<String> resultsList = new ArrayList<String>(); List<String> expandedNodes = new ArrayList<String>(); List<String> expandedTerms = new ArrayList<String>(); List<String> broader = searchBroader(node); List<String> ...
1d0b1d0d-0eb3-4920-a936-95317b6e21dc
8
@Override public double getResult(double[] incoming) throws Exception { double result = Double.NaN; boolean found = false; for (int i = 0; i < m_fieldDefs.size(); i++) { Attribute a = m_fieldDefs.get(i); if (a.name().equals(m_fieldName)) { if (a.isNumeric()) { if (m_opT...
7d7e258e-6027-4af3-a15d-11278530cb8d
7
private void loadStacks(BufferedReader br, String line) throws IOException{ String[] stackNames = line.split(","); for(int i=1; i<stackNames.length; i++){ if(stackNames[i].length()>0) stackMap.put(i, new Stack(stackNames[i])); } line=br.readLine(); while((line=br.readLine()).length()>1 && !line.s...
49bdf169-fea4-4c7d-b50c-dcf04fb81280
2
public static ArrayList<String> getBlobsList(String startsWith) { ArrayList<String> list = new ArrayList<String>(); try { CloudStorageAccount storageAccount = CloudStorageAccount .parse(Connection.storageConnectionString); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); CloudBlobC...
9bc89a30-0b5d-41e4-a7a7-b4994e62bd45
5
public void union3(int p, int q){ int pid = id[p], qid = id[q], psz = sz[pid], qsz = sz[qid]; if(pid == qid) return; count--; if(psz >= qsz)id[q] = pid; else id[p] = qid; sz[pid] += sz[qid]; sz[qid] = sz[pid]; //update sz for(int i : id){ if(id[i] == pid || id[i] == qid) sz[i] = sz[p]; ...
3fd903ab-6971-46d5-9a49-9e8fc7c54fa8
5
private void addToList(List<Integer> list, TreeNode left, TreeNode right, boolean isLeft){ if(isLeft){ if(null != left) list.add(left.val); if(null != right) list.add(right.val); }else{ if(null != left) list.add(0, left.val); if(null != right) list.add(0, right.val); } }
bb64d691-e462-4396-a484-14d83e74be46
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Time)) { return false; } Time other = (Time) obj; if (hours != other.hours) { return false; } if (minutes != other.minutes) { return false; } if...
8f690b98-f1b0-45b7-9b88-c9f8b9eef433
0
public void setSuppliercode(int suppliercode) { this.suppliercode = suppliercode; }
1300447f-6e21-4ea1-b9b7-c835def11d6d
5
static final String method1753(int i, Widget class46) { anInt5924++; if ((Client.method105(class46).method3307(116) ^ 0xffffffff) == -1) return null; if (((Widget) class46).aString780 == null || ((Widget) class46).aString780.trim().length() == 0) { if (Class299_Sub2.aBoolean6327) return "Hidden-use"...
a707c8a9-2516-458b-acad-99238def7eb1
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed //verifica si hay mas de una pista. // se recuperan todos los archivos .gdb y solo escribe los que estan en escenes. int escritura = 0; if (escenes.size() > 1) { Lis...
4af25871-3a42-4ed7-a29e-fd11bf0d463d
9
public synchronized void actionFailed(Action action) { if(action instanceof ConnectAction) { ConnectAction connectAction = (ConnectAction) action; if(connectAction.getError() != null) { info("Kon niet verbinden met " + connectAction.getHostnamePort() + ":...