method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
859b2ed2-f525-4c4c-86d6-df9d770da6a3
5
public void keyPressed(int k){ if(k == KeyEvent.VK_RIGHT) player.setRight(true); if(k == KeyEvent.VK_LEFT) player.setLeft(true); if(k == KeyEvent.VK_W) player.setJumping(true); if(k == KeyEvent.VK_R) player.setScratching(); if(k == KeyEvent.VK_F) player.setFiring(); }
e68944fd-a38c-47e4-a075-a2a0a93172d1
1
@Test public void identity_test() { try{ double [][]exp= {{1.0,0.0}, {0.0,1.0}}; double[][]result = Matrix.identity(2); Assert.assertArrayEquals(exp, result); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } }
3206d7fa-f9fd-4053-ae75-57eb92ad93b7
0
public Student(String no, String name, int age, String sex, Date birthday, String address, String tel, String email) { this.no = no; this.name = name; this.age = age; this.sex = sex; this.birthday = birthday; this.address = address; this.tel = tel; this.email = email; }
09705d64-a301-4813-9724-76bbaf7c3c2a
7
public static Type parseType(short source) throws UnknownTypeError { switch (source) { case 1: return CHGK; case 2: return BRAIN; case 4: return SVOYAK; case 8: return VERSE; c...
971541d5-9d1a-4fa2-8fc2-28b8de21e442
7
@Test public void testExperiment3() { int total = 0; int count = 0; for (int i = 0; i < mServerCount; i++) { try { mDhtClientArray[i].purge(); } catch (RemoteException e) { e.printStackTrace(); System.out.println("dhtCli...
4bb2e902-1e4d-412a-afc9-9608e183d63c
6
@Override public void run() { while (true) { if (!done() && clock != null) { int secondsLeft = (int) (setAt + setMillis - System.currentTimeMillis()) / 1000; clock.setText(String.valueOf((int) (Math.floor(secondsLeft / 60))) + ":" + String....
220e09b2-6a41-40ac-adcb-e31887abb7cc
9
public void setAlignment(MouseEvent event) { EventTarget target = event.getTarget(); VerticalAlignment vAlignment = null; HorizontalAlignment hAlignment = null; if (target.equals(topLeft)) { vAlignment = VerticalAlignment.TOP; hAlignment = HorizontalAlignment.LEF...
61c15461-05e8-4e94-8f99-d8cfd88dde46
4
public static ArrayList<String> getTypeTitle(String type) { ArrayList<String> ret = new ArrayList<String>(); String filename="E:\\doc\\sort.txt"; String line, s[]; try { BufferedReader br = new BufferedReader(new FileReader(new File(filename))); while((line=br.readLine())!=null) { s = line.split(" ");...
349fedf6-edf4-4492-b36d-227ea6aa5c25
2
public void run(){ while(running){ System.out.println(id + ": " + count); count++; this.linha.update(); try{ sleep((long)(wait)); }catch (Exception e){ } } System.out.println("The thread is dead!"); }
dbc6e94b-3590-4e24-9919-00d36e46bab1
0
public static void main(String[] args) { OJ357 oj357=new OJ357(); System.out.println(oj357.countNumbersWithUniqueDigits(3)); }
7c87d4ba-d61f-4040-a26d-d63eb4f0d7c1
2
public void addReplace(String zipPath, String extPath) throws IOException { Path path = fileSystem.getPath(zipPath); if(!Files.exists(path)) { Path parent = path.getParent(); System.out.println(parent); if(parent != null) { Files.createDirectories(parent); } Files.createFile(path); } ...
4d0a749e-f7be-4b46-9174-801373522598
5
private void go(){ ArrayList<HashSet<Integer>> lists = new ArrayList<HashSet<Integer>>(); lists.add(new HashSet<Integer>()); lists.add(new HashSet<Integer>()); int[] count = new int[101]; for(int i=2;i<=100;i++){ lists.add(new HashSet<Integer>()); int power = isPower(i); int base = getBase(i); ...
aee54787-e60e-42b7-82e1-38a0785198a2
1
public void addHeart(Heart h) { synchronized(hearts) { if (!hearts.contains(h)) hearts.add(h); } }
68b57dd9-adf0-4d2b-b8fe-45c30dcd8300
7
private static double DaylightSavingTA(double t) { // Another workaround! The JRE doesn't seem to know about DST // before year 1 AD, so we map to equivalent dates for the // purposes of finding dst. To be safe, we do this for years // outside 1970-2038. if (t < 0.0 || t > ...
ea6703ae-e2e1-41fe-8238-8a94092eac36
5
public static void main(String args[]) { ArrayList<String> output = new ArrayList<>(); Scanner in = new Scanner(System.in); String line = in.nextLine(); while (line != null && !line.equals("")) { /* Do the computations for the given line of input */ St...
1b53a333-c9c7-478e-bb4b-1b9f44fd4fa0
8
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { // queue keep the need visited node. // map keep the has visited node in the new graph Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode >(); HashMap<Integer,UndirectedGraphNode > visitedMap = new HashMap<Integer,UndirectedGraph...
a1dee861-da1c-4080-a95a-4ee8ced6e289
0
public Grid(int xSize, int ySize) { tiles = new Tile[xSize][ySize]; start(); }
92bce620-1531-47cb-a638-336344a5a6d7
7
public static void create(final boolean log) { if (!log) { final VBLogin login = new VBLogin("", ""); login.usergroupId = 0; login.userId = 0; login.logged = true; self = login; } if (self != null) { return; } ...
678e9b4c-13b5-4c97-b155-f00feb4adcac
8
public Set<Map.Entry<Character,Float>> entrySet() { return new AbstractSet<Map.Entry<Character,Float>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TCharFloatMapDecorator.this.isEmpty(); } ...
89c61104-3913-46d1-8ec1-ba70ab1eed09
1
@Test public void pow_test() { try{ double x = 30; Power3CFunction pow = new Power3CFunction(); double result= pow.function(x); double exp = 27000.0; Assert.assertEquals(exp, result, 0.001); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } }
389f06f0-13c5-47a2-b032-d9225ae0941b
3
public static Document parseXmlStream(InputStream xml) throws IOException { createFactories(); // Create the document builder. Document doc = null; if(xml != null) { DocumentBuilder builder = null; try { builder = Utilities.dbFactory.newDocumentBuilder(); } catch(ParserConfigurationException e) {...
3994e5f9-6f52-4205-881a-827b654e1f8e
0
@Override public void push(T task) throws IllegalArgumentException, InterruptedException { taskCount++; // final long startTime = System.currentTimeMillis(); taskAcceptor.push(task); // totalWaitTime += System.currentTimeMillis() - startTime; }
abd84c9a-c3c5-4034-80de-8b0e5e11b183
1
private String getTwoDigits(int num) { String str = Integer.toString(num); return num < 10 ? "0" + str : str; }
8753e2ef-a1bc-4083-b2de-cea820e7ecb4
2
public ContaCorrente get(int pos) { try { if (this.aContas[pos] != null) return this.aContas[pos]; return null; } catch (Exception e) { return null; } }
91ae5657-5b4c-480d-b797-141e26efbe12
6
private boolean initializeMods() { boolean debugVerbose = Settings.getSettings().getDebugLauncher(); final String debugTag = "debug: initializeMods: "; if (debugVerbose) { Logger.logInfo(debugTag + "pack dir..."); } Logger.logInfo(ModPack.getSelectedPack().getDir()); ModManager man = new ModManager(new JFram...
7438c6c9-a9ff-4f9e-b0f4-3c5019bc9d69
9
private char[] readPassword(InputStream in) throws IOException { char[] lineBuffer; char[] buf; int i; buf = lineBuffer = new char[128]; int room = buf.length; int offset = 0; int c; loop: while (true) { switch (c = in.read()) { case -1: case '\n': break loop; case '\r': int c2...
4d902400-bdf1-4c0e-96c5-2034c608cfa6
1
public static ClassInfo getClassInfo(String typeSig) { if (typeSig.charAt(0) != 'L') throw new IllegalArgumentException(); return ClassInfo.forName(typeSig.substring(1, typeSig.length() - 1) .replace('/', '.')); }
f44f7f6a-0a49-4d85-add3-fe6c75b59c0d
3
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { Player player = (Player) event.getPlayer(); if(bm.getSlot(player.getName())!=null){ String bankslot = bm.getSlot(player.getName()); try { if(bankslot.contains("/")) { loader.saveSlot(event.getInventory(), bankslot.split("/")[0],...
0a2a7efe-1c8d-4938-8200-196d5d3df325
4
public static int lerak( String sor, int jatekos, int[][] tabla ) { logger.info("Bábúk lehelyezése"); int oszlopszam = 0, sorszam = 0 ; int[] sorOsz= new int[2]; sorOsz = Helyezz.helyMeghataroz(sor); sorszam = sorOsz[0]; oszlopszam = sorOsz[1]; if(sorszam == -1 || oszlopszam == -1) { System.out....
6899b1a6-7c02-4785-9847-44b52c348584
8
public static Point interseccionDeSegmentos(int u1, int v1, int u2, int v2, int x1, int y1, int x2, int y2) { Point p = new Point() ; int res; int a1,a2,b1,b2,c1,c2,dd; double xx,yy; res = -1; // cuando uno de los segmentos es un punto // res := 0 cuando son paralelas pero no c...
538a0c61-6acf-47ef-9126-53787c142c23
0
public void setBookingDate(Date bookingDate) { this.bookingDate = bookingDate; }
e0f1f439-389b-4a49-bdd0-016238a218ec
8
public String updateMarketIndexData(String index, String arg) { String dataText = ""; String urlvar = ""; String urlfull = ""; String in = ""; /* Build the appropriate URL string. urlbase is the beginning format of all CSV data requests. urlvar is the for...
d0aa9193-2a72-4949-bca8-c67f8df449c0
6
public void paintComponent(Graphics g) { super.paintComponent(g); Calendar now = Calendar.getInstance(); hour = now.get(Calendar.HOUR_OF_DAY); minute = now.get(Calendar.MINUTE); second = now.get(Calendar.SECOND); if (hour < 10) { this.correctionHour = "0"; } if (hour >= 10) { this.corr...
13ed1cf6-738e-4d0d-8e90-36ff5914aa32
0
public DocumentAttributesPanel() { super(); }
cd104e78-9b4f-40cf-b9fb-2e664c5de3f2
4
public void remove(int offs, int len) throws BadLocationException { // return immediately when selecting an item if (selecting) return; if (hitBackspace) { // user hit backspace => move the selection backwards // old item keeps being selected if (offs>0) { ...
308d2f7e-c408-4ed9-9326-1dc0630b6b80
2
@Override public boolean evaluate(T t) { if(firstSearchString.evaluate(t) && secondSearchString.evaluate(t)){ return true; } else{ return false; } }
4e7be6b7-4cee-4570-99b5-02f907f0d326
5
public static void decompress(File in, File out) throws Exception { File inFile = in; File outFile = out; BufferedInputStream inStream = new BufferedInputStream(new FileInputStream(inFile)); BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(outFile)); int propertiesSize = 5; ...
bbcb089a-ff53-4014-9f4a-fb90bb5828ab
3
public void test_04_parse() { String vcfFile = "tests/test.nextProt_paren.vcf"; int count = 0; for (VcfEntry ve : new VcfFileIterator(vcfFile)) { for (VcfEffect eff : ve.parseEffects()) { System.out.println(eff); if (eff.getEffect() == EffectType.NEXT_PROT) count++; } } System.out.println("Coun...
2ded626a-fbd4-43d4-8e84-b265cef34a6e
0
public int getCurrCol(){ return currCol; }
29bc0487-f622-4da7-8357-d779c5ec2109
7
public void addStatusCode(String response) { if ("200".equalsIgnoreCase(response)) { add200OK(); } else if (response != null && response.startsWith("50")) { add50X(); } else if (response != null && response.startsWith("40")) { add40X(); } else if (resp...
e0168e47-1f93-4b3c-b25e-5620273cf370
7
private void updateSpriteImage() { String spritename = "player/"; Anchor anchor; if (xvel < 0) { spritename += "left/"; anchor = Anchor.TOP_RIGHT; } else if (xvel > 0) { spritename += "right/"; anchor = Anchor.TOP_LEFT; } ...
1a4ad3de-dfdd-4874-82d8-489d471c89c1
4
public static void main(String[] args) { //Heap Time HeapBasedPriorityQueue<Integer> heapBasedPriorityQueue = new HeapBasedPriorityQueue<Integer>(Integer.class); for (int i = 20; i > 0; i--) { heapBasedPriorityQueue.offer(i); } System.out.println("Heap-PQueue's size after adding 20 items: " + heapBasedPrio...
4e814608-b392-478d-87b2-aef076bcc237
2
public ResultSet checkPatient(String patient_info) { try { // checking whether the user enters health care no or patient name if (Helper.isInteger(patient_info)) { String selectPatientByNoQuery = "SELECT * FROM PATIENT WHERE health_care_no = " + Integer.parseInt(patient_info); rs = stmt.executeQ...
4edf8abc-a674-4309-a599-e693b4049e31
6
public boolean isSameTree1(TreeNode p, TreeNode q) { if (p == null && q == null) { return true; } if (p == null || q == null || p.val != q.val) { return false; } return isSameTree1(p.left,q.left) && isSameTree1(p.right, q.right); }
7405012e-03ab-4f59-b781-93215d3f942e
0
public YahooLifestyleSpider(String startSite, String dirPath, Cobweb cobweb, int maxDepth) throws Exception { super(startSite, dirPath, cobweb, maxDepth); }
ea74a226-b607-418a-bd76-64b5f475c40b
8
void cropVertically() { int oldWidth = width; int oldHeight = height; int topCrop = 0; crop: while (topCrop < height) { for (int mx = 0; mx < width; mx++) { if (mask[topCrop][mx]) { break crop; } } topCrop++; } int bottomCrop = 0; crop: while (bottomCrop < height - topCrop) { for ...
dbd41efc-f7ac-421e-93e3-6c302aacf958
7
public Vector<RawMaterial> getMyWool(MOB M) { final Vector<RawMaterial> wool=new Vector<RawMaterial>(); if((M!=null) &&(M.charStats().getMyRace()!=null) &&(M.charStats().getMyRace().myResources()!=null) &&(M.charStats().getMyRace().myResources().size()>0)) { final List<RawMaterial> V=M.charStats().getMy...
cb15fe06-6355-43d5-a437-b5f4793b5551
9
public void removerControle(){ if ( this.num_controles == 0 ){ System.out.println("\nNão existe nenhum controle ainda."); } else{ System.out.println("\nQual dos consoles você gostaria de remover? " + "[ 1 - " + this.num_controles + " ]"); int ...
07f5e8df-513d-461c-aaee-b7d8ab8ac21a
6
@SuppressWarnings("unchecked") private static short getIndexOfColor(String color) { Hashtable<String, HSSFColor> hashtable = HSSFColor.getTripletHash(); StringBuffer sb = new StringBuffer(); if(color.startsWith("#")) { //color = color.substring() color = color.substr...
c620ff0b-ddd4-4048-951f-65fc5c650291
3
public static long getFileSize(File file) { if (!file.isDirectory()) return file.length(); long length = 0; for (File f : file.listFiles()) { if (f.isDirectory()) length += getFileSize(f); else length += f.length(); } return length; }
e5cc3da1-d4a2-4cf9-b38a-71adb064f03e
9
private void checkCollisions() { /* Actualizamos la posicion en X en base a si hay o no colision */ double posX = player.getPos().getX(); double velX = player.getVel().getX(); double newX = posX + velX; Rectangle playerBox = new Rectangle((int) newX, (int) player.getPos().getY(), player.getWidth(),...
0b63041b-ebee-4e28-91ff-29447c09b8c5
6
public List<String> categories() { LinkedList<String> allCat = new LinkedList<String>(); if(wallpaper!=null) { allCat.add("wallpapers"); } if(icons.size()>0) { allCat.add("app_icons"); } for(int i=0; i<files.size(); i++) { if(!allCat.co...
d47d9d9d-e3d6-4dea-8618-c7658b6002c1
3
private void readPreferences() { File f = new File("preferences.json"); try { if (f.exists()) preferences = Preferences.readNew(new FileReader(f)); else { preferences = new Preferences(); f.createNewFile(); preferences.write(new FileWriter(f)); System.out.println(translation.translate("file.create...
078f614b-6722-44f7-bf93-25de0b796657
8
private boolean swapForRequest() { for(Team team : teams) calcConnections(team); for(Team team1 : teams) for(int t2 = teams.size()-1; t2 >= 0;t2--){ if(!team1.equals(teams.get(t2))) for(int i =0;i < team1.members.size();i++){ ...
6980d545-8855-4f4e-9638-018ee233945b
1
public synchronized void start() { if (running) { return; } running = true; thread = new Thread(this); thread.start(); }
03933e09-158f-4382-a29d-97ff3c1c8785
7
public void keyReleased(int k) { if(k == KeyEvent.VK_UP)player.setUp(false); if(k == KeyEvent.VK_DOWN)player.setDown(false); if(k == KeyEvent.VK_LEFT)player.setLeft(false); if(k == KeyEvent.VK_RIGHT)player.setRight(false); if(k == KeyEvent.VK_Z)player.setJumping(false); if(k == KeyEvent.VK_X)player.setFiri...
d818d226-bad0-4686-9465-0295253a46bf
7
private boolean writeLabel(String label) { boolean validLabel = true; // Used to determine if the label is a valid label label = label.trim(); // Remove all trailing/leading whitespace if (label.indexOf(":") == label.length() - 1) label = label.substring(0, label.length() - 1); ...
722590bd-c0ee-4b76-a423-0ee4b3d6323c
5
private boolean isMethodImplemented() { boolean retVal = false; if (this.request.getMethod().equals("GET")) { retVal = true; } if (this.request.getMethod().equals("POST")) { retVal = true; } if (this.request.getMethod().equals("OPTIONS")) { retVal = true; } if (this.request.getMethod().equals("...
35743cc9-5749-4e8f-87bd-7538052a68c3
4
public ParseResult parseAll(Map<String, String> values) throws FormValidationException { Map<Field, Object> results = new HashMap<>(fields.size()); Map<Field, ValidationException> failures = new HashMap<>(fields.size()); for (Field field : fields) { String value = values.get(field.getName()); Ob...
aceace3a-3387-469c-a24a-926b12496dea
8
public static void main(String[] args) { try { String cla = "java.util.Calendar"; String method = "getInstance"; String param = "2.5"; Class<?> c = Class.forName(cla); //System.out.println(Arrays.toString(c.getMethods())); Method[] methods = c.getMethods(); boolean called = false; for (int i =...
ec9d8a58-a9ad-45ce-be3a-44547e3a15bc
8
private void handleProperties(final Properties p){ if(p != null){ if(p.containsKey(DB_DIR_KEY)){ dbDir = p.getProperty(DB_DIR_KEY); } if(p.containsKey(OVERWRITE_KEY)){ overWrite = Boolean.parseBoolean(p.getProperty(OVERWRITE_KEY)); } if(p.containsKey(READ_ONLY_KEY)){ readOnly = Boolean.p...
4f544e50-23b7-4816-8381-9e46b80d3215
8
public void rotateEdges(TileColor face) { List<int[]> corners = new ArrayList<int[]>(); List<int[]> edges = new ArrayList<int[]>(); if (face.equals(TileColor.white)) { // corners corners.add(createArray(1, 0, 2)); corners.add(createArray(1, 2, 2)); corners.add(createArray(2, 0, 0)); corners.add(cre...
041b858e-9404-47d5-bf94-3dcf3f5ab5f0
7
public boolean doMovement(Movimiento mov) { /*decida que hay que hacer */ if(isBloqued){ return false; } if (mov.getTipo().equals("recargo")) { if (this.Recargo(mov.getImporte())) { this.registerMovement(mov); return true; ...
1330902b-3d4e-407a-8052-c7c7ee5b3ea9
5
private static Moves performStep0(BotState state) { Moves out = new Moves(); List<Region> distanceTwoRegions = new ArrayList<>(); for (Region region : state.getVisibleMap().getOwnedRegions(state)) { if (region.getDistanceToOpponentBorder() == 2 && region.getIdleArmies() > 0) { distanceTwoRegions.add(region...
49a04f1b-b707-45b6-b309-41fb9a80babb
0
public int getATK() { return atk; }
6eee6b11-7e04-4227-8f93-93e46de8d79c
3
public double getTotalWeight(ArrayList<Double> amounts) { double total = 0; if (amounts.size() < items.size()) { for (int i = amounts.size(); i < items.size(); i++) { amounts.add(0.0); } } for (int i = 0; i < amounts.size(); i++) { tota...
90488bbf-fed5-4919-8d49-de1c66b53df1
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Message other = (Message) obj; if (text == null) { if (other.text != null) return false; } else if (!text.equals(other.text)) re...
fad4e6c9-6767-4c25-a266-116731307475
9
public void add(String href, boolean traversed) { if (href != null) { if (href.startsWith("javascript") || href.startsWith("news")) return; if (href.startsWith("http") || href.startsWith("mailto")) { if (traversed) { mon.addTraversed(href); } else { mon.addRemaining(href); } } else { ...
ec92bde2-f178-485d-b895-599ac921685b
4
@RequestMapping(value = "/signin", method = RequestMethod.POST) public String signinForm(@ModelAttribute User user, Model model, HttpSession session) { String userPassword = user.getPassword(); String dbPassword = Database.getPassword(user.getUsername()); String username = user.getUsername(); if(userPassword ...
9aacf9bd-1a55-4216-b929-a469ffb0476a
3
public void altFire(Player player, Environment enviro){ if(canShoot){ canShoot = false; Position posToCreateCube = Position.screenToWorld(Display.getWidth()/2, Display.getHeight()/2); BoundingBox bounds = new BoundingBox(1,1,1); shoot(new SpawnedCube("spawnedcube.png", bounds, posToCreateCube, enviro), en...
b41a9293-23b5-4cb3-8b6d-6e7a072cf6ce
0
public Wrapping wrapping(int x) { // Base constructor call: return new Wrapping(x) { // Pass constructor argument. public int value() { return super.value() * 47; } }; // Semicolon required }
155315f1-0c6c-4697-a13e-8ffdea149419
6
public static void startupMethods() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (S...
00545be2-c472-4370-ae2f-9c5c97020b36
3
public void openTile(int aX, int aY) { final byte openId = mField.getMasks().getOpen().getId(), openBombId = mField.getMasks().getOpenBomb().getId(); if (mField.getTileValue(aX, aY).isEmpty() && isInsideAreas(Tile.create(aX, aY))) openArea(getContainingArea(Tile.create(aX, aY))); else { if (mField.getTileVa...
f024b89b-0599-4b28-9819-248765e6a469
8
ArrayList<seed> hexPack(double distToWall, double width, double length, ArrayList<Pair> treeLst) { ArrayList<seed> seedLst = new ArrayList<seed>(); boolean canFitMore = true; boolean treeCollision = false; double xIter = distToWall; int isEven = 1; double yIter = distToWall; while( canFitMore ) { ...
3b91d944-511b-4791-9ae8-4eec7eafd127
2
private void addToCount(String name, int N) { if(this.count.containsKey(name)) { int n = this.count.get(name); if(N < n) { this.count.remove(name); this.count.put(name, N); } } else { this.count.put(name, N); } }
a6fa0763-d938-4936-b988-575118cf2fc5
0
@Override public void commandReceived(String command) { console.writeLine("The command is " + command); }
9505707a-1971-43ab-a785-3493e1991081
1
@Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return iface.isInstance(this); }
8687d6b3-9ae0-47f5-95e6-5a91c496d7f1
7
public List<ArquivosBeans> getListaBkup() { try { listaBkp = new ArrayList<ArquivosBeans>(); int j = 0; if (dir.isDirectory()) { String[] filhos = dir.list(); for (int i = 0; i < filhos.length; i++) { File nome = new File(d...
d7b65f28-483a-4448-b148-5cdcda05ced7
8
private static BigFraction parse(String s){ try{ if(s == null){ return null; } if(s.isEmpty()){ return null; } char[] c = s.toCharArray(); c = removeChar(c, (char) 32); c = removeChar(c, (char) 43); int l = c.length; byte[] b = new byte[l]; b[0] = findFirst(c[0]); ...
22d73681-55c2-460c-ba93-20f8189a24a3
1
public int getSkillRechargeTimeLeft(SkillBarSkillSlot skillSlot) throws IOException { int skillRecharge = this.getSkillRecharge(skillSlot); if (skillRecharge == 0) { return 0; } int timeStamp = this.getTimeStamp(); return skillRecharge - timeStamp; }
e3a04615-4fb7-46b2-a686-af7145e45743
6
public synchronized static DiceHand translateToDiceHand(String rawMsg) { int totalMod = 0; ArrayList<Die> dice = new ArrayList<>(); String rollee = "NO_ROLLEE_FOUND"; String[] elements = rawMsg.split(ELEMENT_SEP); for (int m=0; m<elements.length; m++) { // ex...
c789564c-db51-46a9-a9b0-6b5afaa13fce
7
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int p = sc.nextInt(); String str = sc.next(); int firstDiff = -1; int lastDiff = -1; int count = 0; for (int i = 0; i < str.length() / 2; i...
bcd428cf-1d8d-48ed-8917-1452cf364587
8
public static void MP_STRING_LIT() { char currentChar = file.charAt(index); currentLexeme = ""; String tempLexeme = ""; int state = 0; while(true){ currentChar = file.charAt(index); switch(state){ case 0: if(currentChar == '\'') { //tempLexeme += currentChar; -- don't want quotes in our lexe...
dd8cdfbe-3751-4a04-ae78-686c5044b029
6
private NoteLengthEnum[] generateIrregularTimes(TimeSignatureEnum timeSignature, int maxTime, int speedPercent, Random r) { int beats = timeSignature.getBeats(); NoteLengthEnum lastBeat = timeSignature.getOneBeat(); NoteLengthEnum currBeat = null; double remaining = 1.0; ArrayLis...
6a304be6-b9a9-4f52-ae81-3cfd1e6152e5
0
public void setNowDate() { setSysDate(getNowYear(), getNowMonth()); getSysRunDate(); setDateNull(); combo1.setSelectedIndex(getShowYear() - 1900); combo2.setSelectedIndex(getShowMonth()); setDays(getMonthDays(getNowYear(), getNowMonth()), getInitWeek(sysRunTime[0]), getNowDay()); // labelTime.setText...
f8549885-1154-4bf7-b623-d73fd1f9c7ea
2
public void setCommandButtonPadding(int[] padding) { if ((padding == null) || (padding.length != 4)) { this.buttonCom_Padding = UIPaddingInits.COM_BTN.getPadding(); } else { this.buttonCom_Padding = padding; } somethingChanged(); }
9f716686-88f6-4df8-841a-20f5d76696ea
5
public NBT(byte[] data) throws IllegalArgumentException { byte[] uncompressed; try { GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(data)); ByteArrayOutputStream out = new ByteArrayOutputStream(); int res = 0; byte buf[] = new byte[1024]; while (res >= 0) { res = in.read(...
720cc30e-cfcc-42b2-bbfc-67a7818f13cb
4
@Override public Dimensions getDimensions(){ if(getId()==1){ return new Dimensions(30, 30, 70); }else if(getId()==2){ return new Dimensions(30, 70, 70); }else if(getId()==3){ return new Dimensions(70, 70, 70); }else if(getId()==4){ return new Dimensions(70, 30, 70); } return null; }
a7b0e33c-48f0-4d55-867f-ca0a0131b2b4
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
8a3f531b-e135-4718-b18d-2bb850c02384
0
@SuppressWarnings("unchecked") public void showAllData() { data = (Vector<String[]>) allPorts.clone(); fireTableDataChanged(); }
d3bdae8d-ec73-4792-abe0-eee651b0d22b
4
private String hash(char[] arg){ MessageDigest md; byte[] passbyte = null; byte[] encoded = null; String hash = ""; try { // TODO: Check integrity of SHA256 vs MD5 md = MessageDigest.getInstance("SHA-256"); // Creates an SHA-256 generator passbyte = new String(arg).getBytes(); encoded...
dcfa75da-cb72-474f-b2b1-ec5623ce2798
4
protected void writeItem(OutputStream out, Item item) throws IOException { out.write(item.asEnum().ordinal()); if(item instanceof Key){ out.write(((Key)item).ID); out.write(((Key)item).getDescription().length()); out.write(((Key)item).getDescription().getBytes()); } else if(item instanceof Powerup){ ...
8d2e01fe-ab1b-4ab8-997a-5fe1e734b347
9
private void startBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_startBtnMouseClicked initialize(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { buttons[i][j].setIcon(null); buttons[i][j].setEnabled(true); } ...
333c7f91-9b6e-4ad7-87d4-5ee43036d805
4
public void stopAll(String type) { if (type == "wav") { for (int i = 0; i < clips.size(); i++) { clips.get(i).stop(); } } else if (type == "ogg") { for (int i = 0; i < oggs.size(); i++) { oggs.get(i).stop(); } } else { game.log.jukebox("unknown file type '" + type + "'"); } }
26657938-57eb-4183-915e-9dc6a1b2d554
2
public boolean method564(int id) { for (int i = 0; i < mapIndices1.length; i++) { if (mapIndices3[i] == id) { return true; } } return false; }
1cbaa570-9b1b-45c1-aeea-8d81a743e7fc
2
private Rama_Hoja buscarObjeto(String pNombre,Rama_Hoja pNodo){ Rama_Hoja resp = null; if(pNodo.getIdentificador() == pNombre) resp = pNodo; else for(Nodo<Rama_Hoja> iterador = pNodo.getEntradas().getHead(); iterador != null; iterador = iterador.getSiguiente()) ...
5156871e-1dc9-40dc-9717-5a8b7e2cd1f8
4
public void DHPhase1() { // Prep DH dhParameters = new DHParameterSpec(prime, base); // Setup key generator keyGen = null; try { keyGen = KeyPairGenerator.getInstance("DH"); } catch (NoSuchAlgorithmException e) { mylog.out("ERROR", "There is no DH algorithm available."); } try { keyGen.initial...
d1add55a-00d6-4165-a4e0-1faffff6fb59
5
public List<GespieltesSpiel> getSpiele(String teamId, int maxResults) { List<Spiel> alleSpiele = eloPersistence.findAll(Spiel.class, Integer.MAX_VALUE, "order by m.zeitpunkt desc"); for (Iterator<Spiel> i = alleSpiele.iterator(); i.hasNext();) { Spiel spiel = i.next(); if (!spiel.getGewinner().getId().equals(...
c905dd9f-3d88-4ca4-a4db-0741573548c2
1
public int updateUser(User userToUpdate) { try { // Erforderlicher SQL-Befehl String sqlStatement = "UPDATE bookworm_database.users SET username = '" + userToUpdate.getUserName() + "', userrole = '" + userToUpdate.getUserRole() + "' WHERE id =" + userToUpdate.getUserID() + ";"; // ...
fb779543-89e4-4cbb-809f-89e30e86a2ae
3
private boolean cargar() { int opcion; boolean cargado = true; JFileChooser jfc = new JFileChooser(); opcion = jfc.showOpenDialog(this); if (opcion == JFileChooser.APPROVE_OPTION) { try { File archivo = jfc.getSelectedFile(); ObjectInpu...