method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
61a4011e-0275-4452-82f8-5a523b36980f
9
public final void removeGnuFunctions() { // Parcours de tous les CFG pour extraire les fonctions for (ICfg cfg : this.cfgs) { // TODO: Définir les fonctions GNU et autres dans un fichier externe (de configuration ?) for (IFunction function : cfg.getFunctions()) { // Suppression des fonctions GNU if (f...
87354d8e-e833-4bec-b6da-4f2eb58dae7c
1
@Override public void addBuffers(GameAction action) { if (!action.hasAnAttack()) { // do not add attacking actions to the tower super.addBuffers(action); } }
fbf8fe93-8b20-4fef-b274-5023dffca7cd
1
ByteVector put11(final int b1, final int b2) { int length = this.length; if (length + 2 > data.length) { enlarge(2); } byte[] data = this.data; data[length++] = (byte) b1; data[length++] = (byte) b2; this.length = length; return this; }
842e4195-9f02-4083-9b33-4e0b672722b1
0
public static Point3 getRandomIdentityVector2(double seed) { double angle = seed * Math.random() * 2 * Math.PI; return new Point3(Math.sin(angle), Math.cos(angle)); }
0808ad4e-5ec6-4bdf-b49c-a7e4950a947e
4
private void procTweets( List<Status> tweets ) { for ( Status tweet : tweets ) { if ( tweet.getGeoLocation() != null && !statusIdCache.contains( tweet.getId() )) { Logger.log( TAG, "found tweet from @" + tweet.getUser().getScreenName() ); ...
bffe0ef3-eae8-471d-986c-0713e08f3230
3
@Override public void run() { while(true) { try { Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 100); if (Agent.getConflictExists()) { Agent.voteConflict(agentId, agentType); Thread.sleep(12000); } } catch (InterruptedException e) { System.out.pr...
9eae2c3f-e5a2-4b5c-a046-8f66c39efd95
0
private String readInput() throws IOException { return this.keyboard.readLine(); }
229529bb-c792-485b-8d50-385f0c7df021
2
public void render(Graphics2D g) { if(beginningAnimation){ g.drawImage(beginningImage, x, y, null); } else if(combineAnimation){ g.drawImage(combineImage, (int)(x + WIDTH / 2 - scaleCombine * WIDTH / 2), (int)(y + HEIGHT / 2 - scaleCombine * HEIGHT / 2), null); } else{ g.drawImage(tileI...
8d55d958-f59d-4147-9920-a09222940479
5
private DataStructures createArray(Object type){ Structure structure; if(type.getClass() == Integer.class){ structure = new IntegerArray(kitSize, length, chars); } else if(type.getClass() == Float.class){ structure = new FloatArray(kitSize, length, char...
fa0778ea-1b0b-4e51-8095-3c4738f59493
5
public static double getDunnIndex(ArrayList<ArrayList<Integer>> clusters, double[][] distance, int VERBOSE) { int logFlag = Constants.LOG_DUNNINDEX; // get the min inter cluster distance double MINDIST = Double.MAX_VALUE; for (int i=0; i<clusters.size()-1; i++){ for (int j=i+1; j<clusters.size(); j++) ...
d396e0a0-4030-4b54-baab-e8d68f2dd510
3
public void follow(int followerId, int followeeId) { if(followeeId==followerId) return; //update subscribe list TreeSet<Integer> subscribeList=subscribeMap.get(followerId); if(subscribeList==null) subscribeList=new TreeSet<>(); subscribeList.add(followeeId); subscribeMap....
5c81a56b-3c4e-4016-9147-97120bd7054d
0
public String getItemName() { return this.itemName; }
edf7866c-035a-4949-b374-787805c9548a
7
public boolean getLogin() { final int line = API.i().getLogin(this.username, this.password); ConsoleLogger.i().info(String.valueOf(line)); Long time = Long.parseLong(String.valueOf(line * 20)); if (line > -1) { if (Sessions.i().locations.containsKey(this.username)) // Let the player do things ...
79a8dac7-33cf-4b56-982f-1959773ee9a2
4
private void enumerateWorkbenchParts(List<IWorkbenchPartReference> editors, List<IWorkbenchPartReference> views) { IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow workbenchWindow : workbenchWindows) { IWorkbenchPage[] pages = workbenchWindow.getPages()...
45786752-5ab9-452d-903a-9f8fc1948cb3
6
public static void logException(Throwable e, LoggerLevel logLevel) throws CriticalFailure { try { throw e; } catch (JWorldGenException e1) { if (level.getValue() >= logLevel.getValue()) { System.err.println(logLevel+": "+e1.getMessage()); } } catch (Throwable e1) { if (logLevel == LoggerLevel....
faf791a0-662d-4456-84b4-0865dc5ca20b
9
public static void println(int line, String text) { if (line < 1 || line > 6) { return; } //truncate the text if it's longer than the maximum length and add a marker to indicate that it was truncated if (text.length() > MAX_LINE_LENGTH) { text = text.substring(0, ...
657ca338-69cc-4e39-9229-3e3fea60c101
8
public double winkel(Point p1, Point p2) { double winkel = 0; if (p1.getY() > p2.getY() && p1.getX() <= p2.getX()) { winkel = (Math.atan((p1.getY() - p2.getY()) / (p1.getX() - p2.getX())) * 180 / Math.PI) + 180 + 90; }// rechts oben if (p1.getY() <= p2.getY() && p1.getX() > p2.getX()) { winkel = (Mat...
249e3705-e7f7-41ee-aca4-a4f727f87466
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
ec42aef8-1fec-4da6-9619-6298a111c115
9
public static void main(String[] args) throws Exception { if (args.length != 4) { System.err .print("Incorrect number of arguments! The correct syntax is:\n" + " <inputfile> <outputfile> <ne_feature> ( iob1 | iob2 )\n"); System.exit(1); } int arg = 0; String inFileName = args[arg++]; Strin...
71238414-de18-4fbe-a1b8-f15ac1e8aedc
4
public void tick(){ if(input.right) xScroll++; if(input.left) xScroll--; if(input.down) yScroll++; if(input.up) yScroll--; //screen.render(10, 10, 0, 16, 16); //for (int i = 0; i < pixels.length; i++){ //pixels[i] = random.nextInt(); //pixels[i] = random.nextInt()<<16; bit-shift: this turns it ...
1ff19907-5eaf-4dfe-82e2-d06b1f8fd6ad
0
public static void main(String[] args) { Shape shape = new Triangle(); shape.draw(); // shape.flip(); // Error Triangle triangle = (Triangle)shape; triangle.draw(); triangle.flip(); }
9f312971-2042-4c37-bad8-33e3262c476f
5
@Override public void execute() { HashMap<Integer, String> stringGroups = new HashMap<>(); int playersOnLine = 1, playersPerLine = 3, line = 0, displayNumber = 1; for (Player player : cm.getMain().getQM().getQueue()) { String currString = stringGroups.get(line); if (currString == null) stringGroups....
0dffc525-4405-4d51-bcfc-2f3dbeeff4ce
2
private static void ForWithBreak() { int[] numbers = { 10, 20, 30, 40, 50 }; System.out.println("Begin of ForWithBreak"); for (int x : numbers) { if (x == 30) { break; } System.out.print(x); System.out.print("\n"); } System.out.println("End of ForWithBreak"); System.out.println("\n"); }
2dc70fc5-b0dd-4212-9c5c-7251e3b5c1ee
9
View (Model m, Model m2) { model = m; model2 =m2; model.addObserver(this); model2.addObserver(this); sp = new ImageIcon(getClass().getResource("pic/start.png")); rp = new ImageIcon(getClass().getResource("pic/replay.png")); quit = new ImageIcon(getClass().getResou...
c1bcebe0-8606-49f2-b503-fbee65cc5b74
5
public Tile(int _x, int _y, String _URL, int backID, int _maxX, int _maxY) { backgroundTileID=backID; URL = _URL; imageIcon = new ImageIcon(this.getClass().getResource("resources/Editor/textures/environment/tiles/"+URL)); //imageIcon = new ImageIcon(this.getClass().getResource("resources/textures/environment/t...
7eca9acb-3616-4ba5-9c6d-bcb3920a4606
9
private Node parseLiteral(boolean allowQuantifier) { Node result = null; char c = input.charAt(offset); switch (c) { case '.': { result = new Wildcard(this); offset++; break; } case '\\': { char e = input.charAt(offset + 1); switch (e) { case 'w': { result = new Pre...
0bd9a3df-2523-44b8-a30a-6085d799ce09
6
@Override public void run() { while(true){ long startTime = System.currentTimeMillis(); // Check for event triggers events.update(); // Updates the player player.update(); // Checks collision collision.update(); // Check for mapswitch mapChange.update(); // Updates enemies I...
29719189-5a99-4116-968d-edeaa7534525
8
public void renderSprite(int xp, int yp, Sprite s) { int w = s.W; int h = s.H; xp -= xOffs; yp -= yOffs; int[] iso = twoDToIso(xp, yp); xp = iso[0]; yp = iso[1]; for (int y = 0; y < h; y++) { int ya = y + yp; // absolute position ...
d62f06b7-3060-4cfe-975b-7e9dc2473f21
9
String mapTypeName(int tag) { switch (tag) { case StackMapTable_attribute.verification_type_info.ITEM_Top: return "top"; case StackMapTable_attribute.verification_type_info.ITEM_Integer: return "int"; case StackMapTable_attribute.verifica...
201520e7-fd69-4e86-b344-d47e91c5ac1d
8
Vector<Double> solveTwoEquationForX(double equationsValue1,double equationsValue2, double leftLimitForT, double rightLimitForT, boolean includeLeftLimitForT, boolean includeRightLimitForT ){ Vector<Double> roots = new Vector<Double>(); if (equationsValue1 != 1.0 ...
c40324f7-2ef9-495c-81e6-724f1a2753b9
5
public void start(String[] args){ try{ if(args.length == 0){ processDirectoryTree(new File(".")); } else{ for(String arg:args){ File fileArg = new File(arg); if(fileArg.isDirectory()){ processDirectoryTree(fileArg); } else{ if(!arg.endsWith("."+ext)){ arg += "."...
d7d42bbb-9955-4b77-a2c5-5a883a84b192
5
public void testGoalWithModulePrefix5() { String goal = "f(x):length([],0)"; try { Query.hasSolution(goal); // should throw exception fail(goal + " (compound module prefix) wrongly succeeded"); // shouldn't get to here } catch (org.jpl7.PrologException e) { // correct exception class if (e.term().hasFunc...
e5b55530-6a37-4afb-96ec-b4d30ed36924
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r': prevCharIsCR = true; ...
c57b13f7-5177-49b2-9a6c-25117566b095
4
public static String toString(JSONObject jo) throws JSONException { StringBuffer sb = new StringBuffer(); sb.append(escape(jo.getString("name"))); sb.append("="); sb.append(escape(jo.getString("value"))); if (jo.has("expires")) { sb.append(";expires="); s...
6ae8c47e-42ac-4406-96b6-9442eb766508
9
public static Object changeSrctypeToTargeType(String srcType, String targetType, Object val) throws Exception { if(srcType.equals(targetType)){ return val; } Object obj = null; if (targetType.equals("java.lang.String")) { if (srcType.equals("java.sql.Timestamp")) { Timestamp timestamp = (Tim...
80571ed7-7958-4334-9262-d50c7cbdc540
9
public PrettyPrintUtility() { try { writer = new PrintWriter(new FileWriter(new File("Log.txt"), true)); writer.println(">> opened Log FILE"); writer.println(">> started PrettyPrintUtility"); namesIn = new DataInputStream(new BufferedInputStream( ...
0b045170-9a93-431a-899f-1b92ad03a3ef
4
public void write(String value) { try { dataOut.println(value); dataOut.flush(); if (loggedin==1){ if (value.equals("\n")){} else if(value.equals("")){} else{GosLink2.dw.append(value);} } } catch (Exception e) { e.printStackTrace(); } }
580c92fd-350e-44e9-8b4d-17d18613d106
0
public int size() { return myList.size(); }
76f46a0f-a1b0-43bd-8b5c-3d31909b696b
1
@Override public void run() // read server messages and act on them. { doClient(); if (clientReceiveThread != null) { clientReceiveThread.setRunning(false); } return; }
fd85500b-62f3-4187-a186-029f5e07ad40
5
public void heapIncKey(int indeksi, int arvo) { if (indeksi >= 0 && indeksi < keko.size()) { if (arvo > keko.get(indeksi)) { keko.set(indeksi, arvo); } while (indeksi > 0 && keko.get(parent(indeksi)) < arvo) { int apuluku = keko.get(parent(inde...
18b0aa32-6676-404d-b1b6-21edd6b4ea75
7
public void tick() { width = sprt.getWidth(null); height = sprt.getHeight(null); if(dead) deathAni(); chgDir(); move(); if(dir == 0 || dir == 1){ x -= SPEED; if(x <= 10){ x += x; dir = 2; } } if(dir == 2 || dir == 3){ x += SPEED; if(x >= 250){ dir = 0; } } tic...
5f579aa8-aeda-4c05-9930-3645ecae3a7b
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
95248310-fb95-42d2-9921-6ed434d1f53b
5
public int[] searchRange(int[] A, int target) {// binary-search bounding version int lb = 0, ub = 0; int len = A.length; int l = 0, r = len - 1, mid = 0; while(l <= r){ mid = (l+r) >> 1; if(A[mid] < target) l = mid + 1; else r = mid - 1; } lb = l; l = 0; r = len - 1; while(l <= r){ mid = (l+...
79722407-ee67-4801-a44f-cbbee14cb540
6
private void merge(int startIndex, int endIndex, int midPoint) { // TODO Auto-generated method stub int leftLength = midPoint - startIndex + 1; int rightLength = endIndex - midPoint; int [] leftArray = new int [leftLength]; int [] rightArray = new int [rightLength]; int leftIndex = 0; int rightIndex = 0; ...
fc5a08cc-d798-413f-9a2c-9ce3601c9f79
5
public static void voteYes(Player player, String playerName) { if (player == null) { StefsAPI.MessageHandler.buildMessage().addSender("$") .setMessage("error.onlyIngame", AdminEye.messages).build(); return; } if (VoteHandler.type == VoteType.NO_VOTE) { StefsAPI.MessageHandler.buildMessage().addSend...
5b8a28ea-27b1-4c4f-9e0f-b751e711840a
5
public void update() { /*for(Map m : maps.values()) { for(TileLayer layer : m.getBackgroundLayers()) { for(Entity e : layer.getTiles()) { e.update(); } } }*/ player.update(); /*for(Map m : maps.values()) { for(TileLayer layer : m.getForegroundLayers()) { for(Entity e : layer.getTiles()...
294ec62e-7020-473d-91c0-54995df31cee
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((NAME == null) ? 0 : NAME.hashCode()); result = prime * result + ((PUBLIC == null) ? 0 : PUBLIC.hashCode()); result = prime * result + (QUIRKS ? 1231 : 1237); result = prime * result + ((SYSTEM == null) ? 0 :...
80544e4e-6b90-48cd-8116-8a7164292ab9
3
protected TreeNode<K, D> iterativeSearch(TreeNode<K, D> root, K k) { TreeNode<K, D> pointer = root; int side = this.comparator.compare(k, pointer.getKey()); while (side != 0) { if (side < 0) { pointer = pointer.getLeftChild(); } else { poin...
fbfc8f4c-324c-452e-8546-c53862e1e0bc
4
@Override public ValueType returnedType(ValueType... types) throws Exception { // Check the number of argument if (types.length == 1) { // if array if (types[0] == ValueType.NONE) { return ValueType.NONE; } // If numerical if (types[0].isNumeric()) { return ValueType.DOUBLE; } // if ...
f44c35d0-55cc-4ecb-8f71-aea7629be496
1
protected void createFrame() { MyInternalFrame frame = new MyInternalFrame(); frame.setVisible(true); desktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) {} }
1040d03f-0f78-4988-a900-5621a459a281
6
public void draw(Bitmap bitmap, int xOffs, int yOffs) { for (int y = 0; y < bitmap.height; y++) { int yPix = y + yOffs; if (yPix < 0 || yPix >= height) continue; for (int x = 0; x < bitmap.width; x++) { int xPix = x + xOffs; if...
7dd88364-e433-4b42-9a1c-fdf5af31cee5
3
@Override public void run() { try (Scanner in = new Scanner(System.in)){ boolean done = false; while (!done && in.hasNextLine()){ String msg = in.nextLine(); sendMSG(msg.getBytes(), msg.getBytes().length, address, port); if(msg.trim()...
46341507-4310-469b-9818-1b57241725ec
1
public void buscarPagos() { if (pago.getRuc() != null) { String jpql = "select p from Pagos p where p.ruc= :dato "; Query query = JPAUtil.getEntityManager().createQuery(jpql); query.setParameter("dato", pago.getRuc().toString()); pagos = query.getResultList(); ...
7d595481-f38c-42c8-b89d-991d4e71e29a
5
@Override public void run() { List<Task> tasks; while ((tasks = getProducerService().generateTasks(batchSize)).size() > 0) { try { for (Task task : tasks) { getQueue().put(task); } } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("producer: sending shutd...
83f79bb5-4097-4add-87e2-5ca56ffdfe92
5
@EventHandler public void onJoin(PlayerJoinEvent event) { final CraftPlayer p = (CraftPlayer) event.getPlayer(); final EntityPlayer ep = p.getHandle(); final String guideAlert = "{\"text\":\"\",\"extra\":[{\"text\":\""+Core.getPrefix()+"§bClick me for help in this game!\",\"clickEvent\":{\"a...
0c50436d-5ffd-4650-8fe1-4a409930d718
2
@Override public void addNotify() { // Record the size of the window prior to calling parents addNotify. Dimension dimension = getSize(); super.addNotify(); if (componentsAdjusted) { return; } // Adjust components according to the insets setSize(ge...
a0ef0829-21a1-480b-b01f-1c36b5635388
9
public void externalSortTextFile(String inputFileName, String outputFileName, boolean is_int) { String tfile = "temp-file-"; ArrayList<String> buffer = new ArrayList<String>(); try { File inputFile = new File(inputFileName); FileReader fr = new FileReader(inputFile.getAbsoluteFile()); BufferedRe...
211b9d21-c639-4360-9dc7-dd53d39e56c2
8
private synchronized void deleteNow() { useable.set(false); if (png2 != null && png2.isLoaded()) { try { Log.info("Deleting temporary file " + png2.getNow()); final boolean ok = png2.getNow().delete(); if (ok == false) { Log.error("Cannot delete: " + png2.getNow()); } } catch (IOException...
9a805247-a570-4d78-a7d6-cbcca74df5bc
4
public static void main(String[] args) throws Exception { Jeu j=new Jeu(); j.nouvellePartie(); j.nouvellePartie(); for (int i=0;i<j.getListeParties().size();i++) { for (int n=0;n<j.getListeParties().get(i).getFlechesPartie().getListeFleches().size();n++) { System.out.println("La partie "+i+" comport...
3376672a-8557-45b7-a71d-117a071a8413
6
@Override public void run() { Condition.sleep(500); ctx.inventory.deselect(); if (ctx.game.tab() == Game.Tab.EMOTES || ctx.game.tab(Game.Tab.EMOTES)) { final Component emote = ctx.widgets.widget(216).component(1).component(Random.nextInt(0, 20)); if (emote.valid() && emote.click()) { if (Condition.wait...
6cce9502-a2dd-4246-9d99-d6448ab7df3b
9
private void calculatePageInfo(int pageSize) { // if not paging,pageSize should be less than 0 if (pageSize <= 0) { return; } if (totalCount == 0) { this.totalPageNumber = 0; } else { long left = totalCount % pageSize; this.totalPa...
68a4a90c-3c6d-472a-bae1-fa1ac75cda88
3
public static ITrackTile getTrackFuzzyAt(World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof ITrackTile) return (ITrackTile) tile; tile = world.getTileEntity(x, y + 1, z); if (tile instanceof ITrackTile) return (...
2fb9eac5-604f-4294-848c-c6978579a08b
3
public static void setAccounting(Accounting accounting) { accounts=accounting==null?null:accounting.getAccounts(); accountTypes=accounting==null?null:accounting.getAccountTypes(); projects=accounting==null?null:accounting.getProjects(); manage.setEnabled(projects!=null); project....
8fceb74c-fd53-4a4b-9a96-4e48de84f9f1
7
@EventHandler public void onChat(AsyncPlayerChatEvent event) { Player player = (Player) event.getPlayer(); double uppercharacters = 0.0D; double totalcharacters = 0.0D; double percentage = 0.0D; String msg = event.getMessage().replaceAll(" ", ""); for(int i = 0; i < msg.length(); i++) { if(Cha...
297ad5ea-32f5-42ff-887b-a4eae078c9d5
8
private static String getMethodTwo(long elapsedMs) { long elapsedSec = elapsedMs/1000; long ms = elapsedMs - (elapsedSec * 1000); long s = elapsedSec % 60; long elapsedMin = elapsedSec/60; int m = (int) (elapsedMin % 60); long elapsedHour = elapsedMin/60; int h = (int) (elapsedHour % 60); boolean higher...
f8ff81cd-de36-4165-b773-1a95105798f5
9
public int maxPathSum2(treeNode curRoot) { HashMap<treeNode, Integer> node_notRootMax = new HashMap<treeNode, Integer>(); HashMap<treeNode, Integer> node_asRootMax = new HashMap<treeNode, Integer>(); int maxPathNotRoot; int maxPathAsRoot; int curMax; int maxPathFinal = -10000; treeNode p = curRoot; if...
6b43d3ea-848b-4769-8188-ed9bb8de9366
2
public void bfs(Vertex<T> start) { //BFS uses Queue data structure Queue<Vertex<T>> que=new LinkedList<Vertex<T>>(); start.visited=true; que.add(start); printNode(start); while(!que.isEmpty()) { Vertex<T> n=(Vertex<T>)que.remove(); Vertex<T> child=null; while((child=getUnvisitedChil...
6ba8e8f1-7ded-4036-bbb0-05a335d38266
9
private void MinimumRouteSearch ( boolean[] Visited, int[][] RouteArray, int[] Dist, int[] prev, int pos, int N, int[] nodes ) { while (true) { Visited[pos] = true; //̏VisitedtO𗧂Ă for ( int x = 0; x < N; x++ ) { if ( Visited[x] ) continue; //łɂXȂ炱̏̓X[ if ( RouteArray[pos][x] > 0) { //oHꍇ̏ int d = ...
dc772faa-5659-4b9a-8686-8bf4961aa635
2
public void testPropertyAddYear() { YearMonthDay test = new YearMonthDay(1972, 6, 9); YearMonthDay copy = test.year().addToCopy(9); check(test, 1972, 6, 9); check(copy, 1981, 6, 9); copy = test.year().addToCopy(0); check(copy, 1972, 6, 9); copy =...
1c63ebd7-9466-402a-ad1f-a3de22fc1344
0
public Browser getBrowser() { return browser; }
f193b100-4575-45d5-9ac8-aee8349bdae7
2
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { processMap.put("getBook", new getBook()); processMap.put("saveBook", new ...
880ca825-2edb-49d0-8d00-21fc65f5ecda
5
public List<String> getMountFolders() { List<String> dirs = new ArrayList<>(); sc: for (ServerCategory cat : this.categories.values()) { String path = cat.getPath(); Iterator<String> it = dirs.iterator(); String dir; while(it.hasNext()) { dir = it.next(); if(path.startsWith(dir + "/")) { // We ...
005796f4-019b-4ac1-adaf-14e8cc9b3033
1
protected void processWindowEvent(WindowEvent e) { if(windowListener != null) { windowListener.windowResized(e); } }
4e3f5702-11f8-4311-937c-73265f411511
8
@Override public void run() { // get student folder File studentFolder; if (main.arguments.length >= 2 && main.arguments[1].length() > 1) { studentFolder = lib.recognize.find(main.arguments[1]); } else { File root = new File(System.getProperty("user.dir")); ...
c8ba73e2-c438-442f-9899-06587a8bdfda
3
public void teleportElement(Element element, Teleporter destination) { final Position to = getElementPosition(destination); updateElementPosition(element, to); for (Element e : getElementsOnPosition(to)) if (e instanceof Collide && !(e instanceof Teleporter)) ((Collide) e).collideWith(element); }
87d3e860-26eb-441b-a9a8-c47e8103c876
2
private void closeSesion() { if (session != null && session.isOpen()) session.close(); }
70000580-a485-4ed2-ad22-72c23ebd1ae1
7
public void connect() { setConnectionState(ConnectionState.BUSY); new Thread( new Runnable() { public void run() { String comPort = window.getSelectedCOMPort(); try { Controller.log("Connecting to serial port " + comPort + " (please wait) ...", "message"); int baudRate = usingOldOABaudRate ? 11...
193acfd0-6296-43ac-84ad-698e912ed6bd
3
public void wavRunner(String s) { try { File file = new File(s); AudioInputStream audiosource = AudioSystem .getAudioInputStream(file); DataLine.Info info = new DataLine.Info(Clip.class, audiosource.getFormat()); clip = (Clip) AudioSystem.getLine(info); clip.open(audiosource); } catch (Unsu...
7b511147-c5c0-41d3-a79d-c3c524549474
1
public long skip(long count) throws IOException { if (length < count) { count = length; } count = super.skip(count); length -= (int) count; return count; }
8265db9e-ed52-44fe-89b3-ad251abb7f83
3
public void put(int o, int inc, int postingListToBeAccessed, int accessedPostingLists) { intWrapper oo=new intWrapper(); oo.value=o; double currentScore; long time=System.currentTimeMillis(); doubleWrapper oi=tempRes.get(oo); if (oi!=null){...
14c208a2-d81c-476b-999d-c64ef0bb0163
6
public void exit() { // For each buffer, the command for (FileBuffer fb : dm.getOpenBuffers()) { // checks to see if it's saved if (fb.isSaved()) { // if it is, it closes the buffer try { dm.close(fb); } catch (BufferNotOpenException e1) { e1.printStackTrace(); } } // if it is ...
48154417-aaca-4919-9002-39e338de80b8
3
private void processFields(CtClass clazz) throws CannotCompileException, NotFoundException { CtField[] fs = clazz.getDeclaredFields(); for (int i = 0; i < fs.length; ++i) { CtField f = fs[i]; int mod = f.getModifiers(); if ((mod & Modifier.PUBLIC) != 0 && ...
cbb2d3a5-f240-4ebe-b218-df1c08d12cd3
4
private void update_weights(int index){ // update the weight of the currently indexed node tree.elementAt(index).family_weight = tree.elementAt(index).chance_weight; // First, update self with children's weights // daughters are found at 2(x+1) if( 2*(index+1) < tree.size() ) { // add ...
511a8cf9-4742-4586-9620-c02749ed4495
1
@SuppressWarnings("deprecation") public void testFactoryFieldDifference4() throws Throwable { DateTimeFieldType[] types = new DateTimeFieldType[] { DateTimeFieldType.year(), DateTimeFieldType.monthOfYear(), DateTimeFieldType.dayOfWeek(), }; YearMonthDay st...
6f18d88a-2a07-47e7-baf7-132326e1402b
5
private final void updateMapObjectVisibility(final MapleCharacter chr, final MapleMapObject mo) { if (!chr.isMapObjectVisible(mo)) { // monster entered view range if (mo.getType() == MapleMapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= GameConstants.maxViewRangeSq()) { ...
f81152aa-2480-4c0e-8348-d8b0f00635c3
1
public byte[] getByteArray() { if (!isByteArrayComputed) { byteArray = computeByteArray(); } return byteArray; }
6a97d223-9ece-4923-aa6b-087ced3775e0
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
b1ba4f84-bc88-42b8-ac5e-04c6fd3e8303
8
private void init() { frame = new JFrame(); frame.setLayout(new GridLayout(26, 26)); frame.addKeyListener(this); // JLabel cannot get keyboard focus frame.setResizable(true); frame.setSize(520, 520); frame.setBackground(WATER); frame.setDefaultCloseOperation(JF...
94df4f67-6c12-49e7-98bd-88113a75bb38
5
public void blob(Message msg) { while (!msg.eom()) { switch (msg.uint8()) { case GMSG_TIME: Timer.server = msg.int32(); ; Timer.local = System.currentTimeMillis() / 1000; break; case GMSG_ASTRO: double dt = defix(msg.int32()); double mp = defix(msg.int32()); double yt = defix(msg....
90f3f2be-40eb-4b71-a99c-ca0bc38217f4
4
private String stripPunctuationFromString(String s) { StringBuffer buff = new StringBuffer(s); int index = 0; while (index < buff.length()) { if (Character.isLetterOrDigit(buff.charAt(index)) || Character.isWhitespace(buff.charAt(index)) || isEndingPunctuation(buff.charAt(index))) { index++; } else { ...
ec07f14f-74ff-4a0d-8d21-86d47bf3c2ff
5
public Dijkstra() { for(int i=0;i<maxnode;i++)node[i]=new Node(); routelen=1;nodelen=1; for(int i=0;i<maxn;i++)route[i]=new Route(); time1=new double[maxnode][maxnode]; distanceTwoNodes=new double[maxnode][maxnode]; leastTimeTrack=new int[maxnode][maxnode]; for(int i=0;i<maxnode;i++) for(int j=0;j<maxn...
4294442d-d977-452e-9798-2e05cde0193d
3
public int inserir(Categoria c){ Connection conn = null; PreparedStatement pstm = null; int retorno = -1; try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(INSERT, PreparedStatement.RETURN_GENERATED_KEYS); pstm.setString(1, c....
6ee4a31a-5398-4b1d-a74b-9a53eeb8f6e5
4
@Test public void test_mult_matrix() { int a = 2; int b = 3; int c = 4; Matrix m1 = new MatrixArrayList(a, b); Matrix m2 = new MatrixArrayList(b, c); Matrix m3 = new MatrixArrayList(a, c); for (int i = 1; i <= a; i++) { for (int j = 1; j <= b; j++) m1.insert(i, j, (double) (2 * i - j)); } fo...
5e94d486-89f2-462a-b212-50e6f99c343b
9
public void keyTyped(KeyEvent evt) { int modifiers = evt.getModifiers(); char c = evt.getKeyChar(); if(c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0) { if(c >= 0x20 && c != 0x7f) { KeyStroke keyStroke = KeyStroke.getKeyStroke( Character.toUpperCase(c)); Object o = c...
7bef718a-020e-4904-815e-67fbeca11501
5
@Override public int loop() { if (Game.getClientState() != Game.INDEX_MAP_LOADED || Players.getLocal() == null) return 500; final Tile player = Players.getLocal().getLocation(); if (follow && (tile == null || !tile.equals(player))) { updateTile(player); } return 50; }
5972055b-cf3d-4d29-a1d6-8495f724810d
1
public static CurrencySet getInstance() { if (instance == null) instance = new CurrencySet(); return instance; }
4a377eb8-88e8-4ba3-b8ee-ef8a98e45401
7
public boolean insert(int key) { TreeNode pnode = parentHead; TreeNode node = pnode.left; while(node!=null) //left or right subtree { if(node.key>key) { pnode=node; node=node.left; }else if(node.key<key) { pnode=node; node=node.right; }else if(node.key==key) return false; }...
f450bc7c-6bf7-49f2-9294-03f9690cbcd6
3
public void initLevel() throws SlickException{ menu = new Image("resources/images/menu.png"); wowtime=true; try { InputStream inputStream = ResourceLoader.getResourceAsStream("game_over.ttf"); Font awtFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont = awtFont.deriveFont(84f); // set fo...
b5eeedf5-c01a-4fd0-a42c-792f92cd462f
7
public static void oldevaluateRecommender(IGraph testDataSet, IRecommender reco) { int hitRecommed = 0; int userNumber = 0; List<INode> users = testDataSet.getNodesByType(RecommenderPropertiesHandle.getInstance().getUserType()); for (INode user : users) { List<IEdge> ranks = user.getOutEdge(...
3194d4ef-9552-4981-94e6-c65943f08300
9
public void draw(Object obj,Component comp,Graphics2D g2,Rectangle rect) { Color color = (Color) AbstractDisplay.getProperty(obj, "color"); if (color == null && obj instanceof Color) color = (Color) obj; Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor"); if (textColor == null) textC...