method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f109d219-9307-4782-9767-5ff942d19c15
9
private static Set<Integer> kClosestElements(int[] items, int key, final int k) { final int crossOverIndex = findCrossOverIndex(items, key, 0, items.length - 1); System.out.println("Crossover index: " + crossOverIndex); int left = crossOverIndex; int right = crossOverIndex + 1; if (key == items[left]) { left--; } final Set<Integer> kItems = new LinkedHashSet<Integer>(k); while (kItems.size() < k && left >= 0 && right < items.length) { if (key - items[left] < items[right] - key) { kItems.add(items[left--]); } else { kItems.add(items[right++]); } } while (kItems.size() < k && left >= 0) { kItems.add(items[left--]); } while (kItems.size() < k && right < items.length) { kItems.add(items[right++]); } return kItems; }
e25cd697-e487-4084-99c9-271f37659e7f
8
private void applyHeightScaling() { double min = Double.MAX_VALUE, max = -Double.MIN_VALUE; for(int x = 0; x < detail; x++) { for(int y = 0; y < detail; y++) { if(vert[x][y][1] < min) { min = vert[x][y][1]; } if(vert[x][y][1] > max) { max = vert[x][y][1]; } } } min = min + (min_to_max_scaling / 100.0) * 0.1 * max; min = min > max ? max : min; max -= min; for(int x = 0; x < detail; x++) { for(int y = 0; y < detail; y++) { vert[x][y][1] -= min; vert[x][y][1] = vert[x][y][1] < 0 ? 0 : vert[x][y][1]; vert[x][y][1] *= (200 - max_scaling) / max; vert[x][y][1] = (float)(d3_height_scale * calculateHeight(vert[x][y][1]) - 100); } } }
b6d54a6c-fda4-4d5c-baff-51b97e5ecc63
5
public void music() { File soundFile = new File("tada.wav"); AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(soundFile); } catch (Exception e) { e.printStackTrace(); System.exit(1); } AudioFormat audioFormat = audioInputStream.getFormat(); SourceDataLine line = null; DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); try { line = (SourceDataLine) AudioSystem.getLine(info); /* The line is there, but it is not yet ready to receive audio data. We have to open the line. */ line.open(audioFormat); } catch (LineUnavailableException e) { e.printStackTrace(); System.exit(1); } catch (Exception e) { e.printStackTrace(); System.exit(1); } line.start(); int nBytesRead = 0; byte[] abData = new byte[128000]; while (nBytesRead != -1) { try { nBytesRead = audioInputStream.read(abData, 0, abData.length); } catch (IOException e) { e.printStackTrace(); } } line.drain(); line.close(); /* Welcome note */ // m.noteOn(62, 64); // Thread.sleep(1000); // m.noteOn(64, 64); // Thread.sleep(500); // m.noteOn(62, 64); // Thread.sleep(1000); // m.noteOn(64, 64); // Thread.sleep(500); // m.noteOn(62, 64); // Thread.sleep(1000); // m.noteOn(64, 64); }
bb92b8c3-8f53-479c-8de8-9d59c6db8b3e
1
public void flagChildren(){ if(children!=null){ children.get(0).flag(); //System.out.println("\tChild flagged: "+children.get(0).toStringf()); children.get(1).flag(); //System.out.println("\tChild flagged: "+children.get(1).toStringf()); children.get(0).flagChildren(); children.get(1).flagChildren(); } }
c3b7930e-e7a8-44ea-a70b-8b346412d8a4
4
@Override @EventHandler public void handleTeamPlayerDeath(PlayerDeathEvent e) { if (inTeam( CTFPlugin.getTeamPlayer(e.getEntity()) )) { System.out.println("Played died"); //set the respawn point e.getEntity().setBedSpawnLocation(spawnLocations.get(rand.nextInt(spawnLocations.size()))); for (Iterator<ItemStack> i = e.getDrops().iterator(); i.hasNext();) { ItemStack item = i.next(); if (item != null){ if (item.getType().equals(Material.WOOL)) { //DROP ANY FUCKING WOOL System.out.println("PLAYER WAS HOLDING WOOL"); } else{ i.remove(); } } } //Remove inventory e.getEntity().getInventory().clear(); } }
df51e6d8-37c5-4b79-b4d4-739e2912f8d2
5
public String makeMove(CardGame game, CardPanel panel) { if (indexTo != -1) { switch (moveTypeFrom) { case FROM_ACE_PILES: return makeAcePilesMove(game); case FROM_KING_PILES: return makeKingPilesMove(game); case FROM_BOARD: return makeBoardMove(game); case FROM_HAND: return makeHandMove(game); } } return "ERROR"; }
6b31f3ea-3b76-41fb-819d-805e78ac0472
2
public static String getFilename(String path) { if (path == null) { return null; } int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path); }
b6497eea-ac19-44d8-80aa-0ccd340a28a9
6
@EventHandler public void ZombieInvisibility(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Invisibility.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if ( plugin.getZombieConfig().getBoolean("Zombie.Invisibility.Enabled", true) && damager instanceof Zombie && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, plugin.getZombieConfig().getInt("Zombie.Invisibility.Time"), plugin.getZombieConfig().getInt("Zombie.Invisibility.Power"))); } }
ea7219b8-e639-484a-b81b-2c771ace7d49
7
public final void method70(int i, int i_31_, byte i_32_, int i_33_, int i_34_, int i_35_, int i_36_, byte[] is, Class304 class304) { if (((Class310_Sub2) this).aClass304_3896 != class304 || ((Class310_Sub2) this).aClass68_3895 != Class68.aClass68_1183) throw new RuntimeException(); if (i_32_ < -4) { PixelBuffer pixelbuffer = (((DirectxToolkit) ((Class310_Sub2) this).aClass378_3893) .aPixelBuffer9803); int i_37_ = anIDirect3DTexture6332.LockRect(0, i_36_, i, i_35_, i_34_, 0, pixelbuffer); if (ue.a(i_37_, false)) { i_33_ *= (((Class304) ((Class310_Sub2) this).aClass304_3896) .anInt3850); i_35_ *= (((Class304) ((Class310_Sub2) this).aClass304_3896) .anInt3850); int i_38_ = pixelbuffer.getRowPitch(); if ((i_35_ ^ 0xffffffff) == (i_38_ ^ 0xffffffff) && i_33_ == i_35_) pixelbuffer.a(is, i_31_, 0, i_35_ * i_34_); else { for (int i_39_ = 0; i_34_ > i_39_; i_39_++) pixelbuffer.a(is, i_31_ + i_39_ * i_33_, i_39_ * i_38_, i_35_); } anIDirect3DTexture6332.UnlockRect(0); } } }
cdd7d266-22dc-4db0-bac8-4d6e69c72e33
7
public void transform(String romanNr) { if (checkValidLetters(romanNr)) { if (syntaxCheckToggle) { if (!checkRomanNr(romanNr) || !checkThreeConsecLetters(romanNr)) { System.out.println("Sintaxa incorecta"); System.exit(statusCode); } } float decimalNr; decimalNr = 0f; int j = 0; char c2; while (j < romanNr.length()) { c2 = '0'; float value1; float value2 = -1; char c1 = romanNr.charAt(j); value1 = getValue(c1); j++; if (j < romanNr.length()) { c2 = romanNr.charAt(j); value2 = getValue(c2); } if (value1 >= value2) { decimalNr += value1; } else { decimalNr += (value2 - value1); j++; } } System.out.println("Your decimal number is: " + decimalNr); } System.exit(statusCode); }
2328d6c9-0da0-413a-b8ed-86130f611785
0
public String getValue() { return value; }
cfb2383a-a7ba-4ff9-8c5a-522fd4229dbf
9
@Override public void run() { try { if(!socket.isConnected()) return; //just for tests !! setUserPublicFields(); synchronized (server) { for (User user : server.userList){ if (user.userName.equals(userName)) { printStream.println("This UserName already engaged"); closeSocket(); return; } } } server.onUserConnected(this); printStream.println("Hello " + userName + "!"); while(true) { try { printStream.println("Type new command"); String messageReceived = bufferedReader.readLine(); if(messageReceived==null) { closeSocket(); break; } else if(!messageReceived.isEmpty()) { if (messageReceived.equalsIgnoreCase("quit")) { closeSocket(); break; } messageHandling(messageReceived); } } catch (IOException e1) { e1.printStackTrace(); closeSocket(); break; } } } catch (IOException e) { e.printStackTrace(); } }
c814ad02-2865-4fd0-be33-eee6b7517b68
0
@Override @XmlElement(name="id") public int getId() { return this.id; }
5ccaed32-e09b-4242-baff-eb30e73cab3d
2
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueDecending( Map<K, V> map ) { List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>( map.entrySet() ); Collections.sort( list, new Comparator<Map.Entry<K, V>>() { public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2 ) { return (o2.getValue()).compareTo(o1.getValue() ); } } ); Map<K, V> result = new LinkedHashMap<K, V>(); for (Map.Entry<K, V> entry : list) { result.put( entry.getKey(), entry.getValue() ); } return result; }
87566c2b-9b4c-45dd-88ff-487c1a415e97
9
private boolean isValidPath(String PathToFile){ if (PathToFile==null) return false; if (PathToFile.length()<1) return false; //if (File.isDirectory()) return false; String FileName = getName(); if (FileName.length()<1) return false; if (FileName.length()>260) return false; PathToFile = toString(); PathToFile = PathToFile.replace((CharSequence) "\\", "/"); String[] Path = PathToFile.split("/"); String[] arr = new String[]{ "/", "?", "<", ">", "\\", ":", "*", "|", "\"" }; for (int i=0; i<Path.length; i++){ for (int j=0; j<arr.length; j++){ if (arr[j].equals(":") && i==0 & Path[i].length()==2){ //&& File.pathSeparator.equals(":") //skip check b/c we've got something like "C:\" in the path } else{ if (Path[i].contains((CharSequence) arr[j])) return false; } } } return true; }
cab45b1a-2536-451a-8e6c-737f872faf58
3
public static void main(String[] args) { try { // find out what pictures are stored inside your .mp3 file MP3 mp3 = new MP3("c:\\music\\bon jovi\\livin on a prayer.mp3"); List<AttachedPicture> attachedPictures = mp3.getPictures(); // if there was any invalid information (ie, frames) in the .mp3 file, // then display the errors to the user if (mp3.hasErrors()) { mp3.displayErrors(System.out); // display the errors that were found mp3.save(); // discard the invalid information (frames) and } // save only the valid frames back to the .mp3 file // print out each picture's type, picture's mime type, optional description of the picture, and the number of bytes in the image for(AttachedPicture picture : attachedPictures) System.out.println(picture); // store a picture of the cd's front cover in the .mp3 file // get the cd's front cover from a URL AttachedPicture picture = new AttachedPicture(PictureType.FRONT_COVER, "image/jpg", "front cover of CD", new URL("http://www.beaglebuddy.com/content/downloads/mp3/bon%20jovi.slippery%20when%20wet.cd%20front%20cover.jpg")); mp3.setPicture(picture); // store a picture of the cd's back cover in the .mp3 file // get the cd's back cover from a local file mp3.setPicture(PictureType.BACK_COVER, "c:/images/bon jovi.slippery when wet.cd back cover.jpg"); // save the pictures we added to the .mp3 file mp3.save(); } catch (IOException ex) { // an error occurred reading/saving the .mp3 file. // you may try to read it again to see if the error still occurs. ex.printStackTrace(); } }
f3cedac3-9930-4100-b8ec-1c9dfac723a3
5
private boolean checkDepository(String res) { boolean flag = false; if (formulaMap.containsKey(res)) { //存在该目标物品的合成公式 ResourceFormula rf = formulaMap.get(res); for (ResourceItem formulaItem : rf.getResourceFormula()) { if (!res.equals(formulaItem.getResourceName())) { //只check待投入的资源 if (!depository.containsKey(formulaItem.getResourceName()) || depository.get(formulaItem.getResourceName()) < formulaItem .getResourceNum()) { //若仓库中不存在公式中需要的资源或资源数量不足时报错 System.err.println("资源不足,无法合成!"); return false; } } } flag = true; } return flag; }
23c988ba-7830-493a-9b88-6392a0d72b80
0
public confirmRemoval() { this.requireLogin = true; this.addParamConstraint("id", ParamCons.INTEGER); this.addRtnCode(405, "venue not found"); }
9520414a-46d1-4922-a28b-6841f3865987
1
@Override protected void compute() { Loader loader = new Loader(); try { loader.setUrl(url); loader.load(); } catch (Exception e) { System.out.println(e); } System.out.println(i); }
def5351a-2a76-417e-91a5-3331867869d7
2
public Object fail(NullParamFn<? extends Object> fn) { return !this.suc ? fn.fn() : null; }
d7afb8b6-e428-414d-ac14-559fafff55dc
4
@Override public void onChatComplete(Player player, String reason, Object... playerList) throws EssentialsCommandException { // kick everyone on our list @SuppressWarnings("unchecked") ArrayList<Player> targetPlayers = (ArrayList<Player>)playerList[0]; String playerName = player.getName(); String playerListString = ""; for(Player target: targetPlayers) { // make sure the target still exists if(target == null) { continue; } if(!playerListString.equals("")) { playerListString += "&6, "; } ColourHandler.sendMessage(target, "&cYou have been kicked by %s: %s", playerName, reason); target.kickPlayer(reason); playerListString += "&e" + target.getName(); // log it Logger.log("%s kicked %s: %s", playerName, target.getName(), reason); recordKick(playerName, target.getName(), reason); } // send the message to the kicking player if(player != null) { ColourHandler.sendMessage(player, "&6You kicked the following people:"); ColourHandler.sendMessage(player, playerListString); } }
a9e51ef0-933e-4863-af4b-439cf49b0ced
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 2) { final String remoteVersion = title.split(delimiter)[1].split(" ")[0]; // Get the newest file's version number if (this.hasTag(localVersion) || !this.shouldUpdate(localVersion, remoteVersion)) { // We already have the latest version, or this build is tagged for no-update this.result = Updater.UpdateResult.NO_UPDATE; return false; } } else { // The file's name did not contain the string 'vVersion' final String authorInfo = this.plugin.getDescription().getAuthors().size() == 0 ? "" : " (" + this.plugin.getDescription().getAuthors().get(0) + ")"; this.plugin.getLogger().warning("The author of this plugin" + authorInfo + " has misconfigured their Auto Update system"); this.plugin.getLogger().warning("File versions should follow the format 'PluginName vVERSION'"); this.plugin.getLogger().warning("Please notify the author of this error."); this.result = Updater.UpdateResult.FAIL_NOVERSION; return false; } } return true; }
448ec3d0-a755-4dfe-b120-f350399b986e
5
public List<String> parseXml(Text value) { List<String> listAnchor = new ArrayList<String>(); String word=null; String xmlString = value.toString(); String[] listTitle = xmlString.split("<anchor>"); for (int i = 1; i < listTitle.length; i++) { int stop = listTitle[i].indexOf('<'); word=listTitle[i].substring(0, stop).toLowerCase(); word=word.replace("&quot;", ""); word=word.replace("&amp;", ""); int isPortail=word.indexOf("portail:"); if(word.length()>8 &&word.indexOf("/article")>-1 &&isPortail>-1){ word=word.substring(isPortail+8,word.indexOf("/article"));} int isWikipedia=word.indexOf("wikip??dia:"); if(isWikipedia>-1)word=word.substring(isWikipedia+10); listAnchor.add(word); } return listAnchor; }
d4e097e9-9b14-4395-81d2-6f7b05c01efa
9
public static void main(String[] args) throws Exception{ SOP("==========Chapter 4 Trees and Graphs==="); SOP("To run: java c4 [function name] [function arguments]"); SOP("Example: java c4 q1"); SOP(""); SOP("Possible functions:"); SOP("q1\tQuestion 1"); SOP("q2\tQuestion 2"); SOP("q3\tQuestion 3"); SOP("q4\tQuestion 4"); SOP("q5\tQuestion 5"); SOP("q6\tQuestion 6"); SOP("q7\tQuestion 7"); SOP("q9\tQuestion 9"); SOP("==============================="); SOP(""); if(args.length < 1){ SOP("ERROR: Must specify function to run"); return; } String function = args[0]; if(function.equals("q1")) q1(args); else if(function.equals("q2")) q2(args); else if(function.equals("q3")) q3(args); else if(function.equals("q4")) q4(args); else if(function.equals("q5")) q5(args); else if(function.equals("q6")) q6(args); else if(function.equals("q7")) q7(args); else if(function.equals("q9")) q9(args); else SOP("ERROR: Unknown function"); }
bdaed0e7-693b-4350-8e53-7010acf8b15a
5
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == saveProblem) { saveProblem(); } else if (source == saveDomain) { saveDomain(); } else if (source == openProblem) { openProblem(); } else if (source == exit) { exit(); } else if (source == newProblem) { newProblem(); } }
a40c73b4-fa8e-4b62-8fb5-bd88a1def097
2
private boolean isBetterThanOptimal(ArrayList<Rod> list, int pointer) { int currentOptimal = 0; int currentLength = 0; for(int i = 0; i < pointer; i++) { currentOptimal += list.get(i).getPrice(); currentLength += list.get(i).getLength(); } // TODO: Perform Greedy for the TEMP length // for everything after the pointer, perform Greedy Solution and get price for new ratio. RodCuttingGreedySolution greedy = new RodCuttingGreedySolution(); ArrayList<Rod> rods = new ArrayList<Rod>(); for(int i = pointer; i < list.size(); i++) { rods.add(list.get(i)); } double rational = RodCuttingCommon.getInstance().getPricesFromRodsStrategy(greedy.getMaximumRevenueRods(totalLength - currentLength, rods)); return currentOptimal + rational > optimal; }
bfb5bf92-54f0-4cb3-acd1-b5ada7ea3703
6
private Tela navegarTelaVisualizarDadosDocente(NavigationEvent event) { if(dbController != null && event != null && event.getArg("Docente") != null){ Docente docente = (Docente) event.getArg("Docente"); TurmaDAO turmasDAO = new TurmaDAO(dbController); Collection<? extends Object> turmasDocente = turmasDAO.search(docente); TelaVisualizarDadosDocente telaDadosDocente = new TelaVisualizarDadosDocente(docente, turmasDocente); if(docente.getPessoa() != null){ PublicacaoDAO publicacaoDAO = new PublicacaoDAO(dbController); Collection<? extends Object> publicacoesDocente = publicacaoDAO.search(docente.getPessoa()); telaDadosDocente.setPublicacoesDocente(publicacoesDocente); } return telaDadosDocente; } //else return new TelaVisualizarDocentes(); }
d81935fb-375e-442f-8155-38077f5bf0fc
7
public boolean validateMethodCall(List<binaryExpression_AST> actualArgs) { int argSize = 0; if (actualArgs != null){ argSize = actualArgs.size(); } int formalArgSize = 0; if (formalArgs != null){ formalArgSize = formalArgs.size(); } if (formalArgSize != argSize) { return false; } if (formalArgSize == 0) { return true; } boolean validMethod = true; for (int i=0; i<formalArgSize; i++){ VariableUnit formalArg = (VariableUnit)formalArgs.get(i); try { if (! formalArg.getType().typeObj.name.equals(actualArgs.get(i).typeObj.name)) { validMethod = false; break; } } catch (Exception e) { return true; } } return validMethod; }
911c9e17-36ac-45ef-a734-31d59157f2df
6
static TypeAdapter<?> getAnnotationTypeAdapter(Gson gson, ConstructorConstructor constructorConstructor, JsonAdapter annotation) { Class<? extends TypeAdapter<?>> adapterClass = annotation.value(); ObjectConstructor<? extends TypeAdapter<?>> constructor = constructorConstructor.get(TypeToken.get(adapterClass)); TypeAdapter<?> adapter = constructor.construct(); Gson.$$Internal.addGeneratedTypeAdapter(gson, adapter); return adapter; }
35b3d0f1-25dc-480b-99c5-1f4f8c77ce22
2
@Override public String execute() throws Exception { Member a = (Member)memberDAO.findByUsername(member.getUsername()).get(0); if(a == null) return ERROR; if(!a.getPassword().equals( member.getPassword())) return ERROR; return SUCCESS; }
2eb3b41f-931b-450a-827b-9ab5b4fbb26b
3
public static Vector Reverse(Vector Vec, boolean X, boolean Y, boolean Z) { if (X) {Vec.setX(Vec.getX()*-1);} if (Y) {Vec.setY(Vec.getY()*-1);} if (Z) {Vec.setZ(Vec.getZ()*-1);} return Vec; }
cad97d87-adc3-47f3-9581-f86d3fae5a91
8
private static String[] splitToTwoParams(String param) throws Exception{ String[] splits=param.split(","); if(splits.length==2){//ֻ1šַûиϽṹ return splits; }else if(splits.length>2){//ж log(x,log(2,3)) , log(4,6) int commaIndex=0; //ָŵ int oddBracket=0; //ż1żһ int spiltCommaCount=0; //ָ. for(int i=0;i<param.length();++i){ if(param.charAt(i)=='('){ oddBracket++; }else if(param.charAt(i)==')'){ oddBracket--; }else if(param.charAt(i)==','){ if(oddBracket==0){//Dzָ commaIndex=i; spiltCommaCount++; } } } if(spiltCommaCount==1){//ֻ splits=new String[2]; splits[0]=param.substring(0, commaIndex); splits[1]=param.substring(commaIndex+1, param.length()); }else{ throw new Exception(ERROR_MESSAGE[FUCTION_PARAMS_ERROR]); } }else{ throw new Exception(ERROR_MESSAGE[FUCTION_PARAMS_ERROR]); } return splits; }
42e7a39d-1356-4f74-8688-d777e8ed7a00
5
public static void printSpeed(){ DecimalFormat df = new DecimalFormat("#.000"); double calca = force/mass; double a = calca; distance = 0; IO.println("> Speed Calculation for " + force + "n with " + oforce + " opposing force, at acel " + a + ", between " + itime + "s & " + ftime + "s"); IO.print("Cofirm Operation... (y/n) "); Scanner s = new Scanner(System.in); String confirm = s.nextLine(); IO.logln("<IN> " + confirm); if(confirm.equals("y")){ long dtime = System.currentTimeMillis(); for(int i = itime; i <= ftime; i++){ speed = a*i; distance = 0.5d*(a*(i*i)); IO.print("Time: " + (int)i + "s"); for(int i2 = 0; i2 < 20-Integer.toString(i).length(); i2++){ IO.print(" "); } IO.print("| Speed: " + df.format(ispeed+speed) + "m/s"); for(int i2 = 0; i2 < 50-String.valueOf(df.format(ispeed+speed)).length(); i2++){ IO.print(" "); } IO.print("| Distance: " + df.format(distance) + "m"); for(int i2 = 0; i2 < 50-String.valueOf(df.format(distance)).length(); i2++){ IO.print(" "); } IO.println(""); } IO.println("> Operation Completed in " + (int)(System.currentTimeMillis() - dtime)/1000 + "s"); } else { IO.println("> Operation Aborted"); // If reply is 'n' } }
070216cc-2d55-4f61-a95d-99018003290d
2
public void buildMask(int width, int height) { fogMask = new int[width][height]; for(int i = 0;i <width;i++){ for(int j = 0; j < height;j++){ fogMask[i][j] = 0; //ADD SOME CONVENTION // 0 is unseen // 1 is previously seen // 2 is observed } } }
1ea80ecd-eefa-4a2e-be34-a339c6ae130a
4
public void mouse_released (MouseEvent evt) { if ( (selectedCursor!=null) ) { if (!stickyCursors.contains(selectedCursor.session_id)) { selectedCursor.stop(); cursorMessage(); if (manager.verbose) System.out.println("del cur "+ selectedCursor.session_id); if (jointCursors.contains(selectedCursor.session_id)) jointCursors.removeElement(selectedCursor.session_id); manager.terminateCursor(selectedCursor); cursorDelete(); } else { selectedCursor.stop(); cursorMessage(); } selectedCursor = null; } }
eaa56b6f-4b89-4008-b44f-d531ff5f7f9b
1
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
94ce62a9-d650-420b-a5b3-4bb6b225fcb6
2
private Point mousePosition() { try { Point mp = this.getMousePosition(); if(mp != null) return this.getMousePosition(); else return new Point(0, 0); } catch (Exception e) { return new Point(0, 0); } }
eac9e2d2-4911-40a3-94d6-5eaef39a1eac
6
public void beginPreviewMode(boolean copy) { // !!!! awful awful hack !!! will break as soon as CPMultiUndo is used for other things // FIXME: ASAP! if (!copy && !undoList.isEmpty() && redoList.isEmpty() && (undoList.getFirst() instanceof CPMultiUndo) && (((CPMultiUndo) undoList.getFirst()).undoes[0] instanceof CPUndoPaint) && ((CPUndoPaint) ((CPMultiUndo) undoList.getFirst()).undoes[0]).layer == getActiveLayerNb()) { undo(); copy = prevModeCopy; } else { movePrevX = 0; movePrevY = 0; undoBuffer.copyFrom(curLayer); undoArea.makeEmpty(); opacityBuffer.clear(); opacityArea.makeEmpty(); } moveInitSelect = null; moveModeCopy = copy; }
8ad35490-8cea-45d8-bf29-aadb74b15c88
8
private void sonificate() { try { if (outputFile.exists()) { /* * Check if chosen output file already exists. If so, we ask * gently whether the user wants to overwrite */ int selected = JOptionPane.showOptionDialog(null, String.format(props.getProperty("overwrite"), outputFile.getAbsolutePath()), props.getProperty("overwriteTitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, YES_NO_QUESTION_OPTIONS, YES_NO_QUESTION_OPTIONS[0]); // If "No", we do nothing if (selected == 1) { return; } } Sonificator.sonificate(Genre.getByName(selectedGenre), inputFile, outputFile); JOptionPane.showMessageDialog(null, props.getProperty("success"), props.getProperty("successTitle"), JOptionPane.INFORMATION_MESSAGE); /* * We offer the possibility to open the created MIDI file * with the default program on the users' computer. But * first we need to check whether the users JVM implementation * allows us to do that. */ if (!OS.contains("win") && Desktop.isDesktopSupported()) { int selected = JOptionPane.showOptionDialog(null, props.getProperty("play"), props.getProperty("success"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, YES_NO_QUESTION_OPTIONS, YES_NO_QUESTION_OPTIONS[0]); /* * If "Yes", we open the created MIDI file with the * default program */ if (selected == 0) { Desktop.getDesktop().open(outputFile); } } } catch (IOException e) { JOptionPane.showMessageDialog(null, e.getMessage(), props.getProperty("error"), JOptionPane.ERROR_MESSAGE); } catch (InvalidMidiDataException e) { JOptionPane.showMessageDialog(null, props.getProperty("corrupt"), props.getProperty("corruptTitle"), JOptionPane.ERROR_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getStackTrace(), props.getProperty("error"), JOptionPane.ERROR_MESSAGE); } }
e90df9c8-dfed-4aca-a28a-8c667668cd75
8
public byte[] read (Handle hdl, long offset, int count, AttributeHandler fmt) { // check for auth data. if (offset == 0) { String dbUser = null, dbPassword = null; if (dbAuth != null && dbAuth.length() > 0) { int pos = dbAuth.indexOf (':'); if (pos != -1) { dbUser = dbAuth.substring (0, pos); dbPassword = dbAuth.substring (pos+1); } // reset auth string dbAuth = null; } // connect to database if (dbUser != null) { // establish session with database String sessionId = "" + nextSessionId; Connection conn = db.connect (dbInst, dbUser, dbPassword); if (conn != null) { // create subdirectory. String client = hdl.userCredential.getUser(); String group = hdl.userCredential.getGroup(); Permissions perm = new Permissions (client, group, Permissions.PERM_400); Directory session = new SessionDirectory (sessionId, perm, conn); parent.add (session); content = sessionId + "\n"; nextSessionId++; } else content = "Can't connect to database!\n"; } else content = "No (valid) authentication data!\n"; } // check bounds. byte[] data = content.getBytes(); int size = data.length; if (offset < 0 || offset > size-1) return null; // assemble result. int num = (int) Math.min (size-offset, count); byte[] res = new byte [num]; System.arraycopy (data, (int)offset, res, 0, num); return res; }
b69f9be7-4936-4768-9585-8db534b65021
4
public static List<ShopInfo> getAllShops() throws HibernateException { List<ShopInfo> shopList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); String hqlString = "select s from ShopInfo as s"; Query query = session.createQuery(hqlString); @SuppressWarnings("unchecked") List<ShopInfo> list = query.list(); if (list.size() > 0) { shopList = new ArrayList<ShopInfo>(); for (int i = 0; i < list.size(); i++) { shopList.add(list.get(i)); } } // End unit of work session.getTransaction().commit(); } catch (HibernateException hex) { logger.error(hex.toString()); HibernateUtil.getSessionFactory().getCurrentSession() .getTransaction().rollback(); } catch (Exception ex) { logger.error(ex.toString()); HibernateUtil.getSessionFactory().getCurrentSession() .getTransaction().rollback(); } return shopList; }
5c1a9fcf-fe52-4581-bdbf-1fdd74449514
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MostraFornecedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MostraFornecedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MostraFornecedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MostraFornecedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MostraFornecedor().setVisible(true); } }); }
60337e73-69b1-4afe-9aa7-5a07a2806d4b
6
@Override public BMPImage apply(BMPImage image) { BMPImage filteredImage = new BMPImage(image); BMPImage.BMPColor[][] bitmap = image.getBitMap(); BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap(); int height = filteredImage.getHeight(); int width = filteredImage.getWidth(); for(int i = 1; i <= height; i++) { for(int j = 1; j <= width; j++) { int r; int g; int b; if((i - 1) % 2 == 0 && (j - 1) % 2 == 0) { int i1 = width / 4 + (i - 1) / 2; int j1 = height / 4 + (j - 1) / 2; r = bitmap[i1][j1].red; g = bitmap[i1][j1].green; b = bitmap[i1][j1].blue; } else if((i - 1) % 2 == 0) { int i1 = width / 4 + (i - 1) / 2; int j1 = height / 4 + (j - 2) / 2; r = (bitmap[i1][j1].red + bitmap[i1][j1+1].red) / 2; g = (bitmap[i1][j1].green + bitmap[i1][j1+1].green) / 2; b = (bitmap[i1][j1].blue + bitmap[i1][j1+1].blue) / 2; } else if((j - 1) % 2 == 0) { int i1 = width / 4 + (i - 2) / 2; int j1 = height / 4 + (j - 1) / 2; r = (bitmap[i1][j1].red + bitmap[i1+1][j1].red) / 2; g = (bitmap[i1][j1].green + bitmap[i1+1][j1].green) / 2; b = (bitmap[i1][j1].blue + bitmap[i1+1][j1].blue) / 2; } else { int i1 = width / 4 + (i - 2) / 2; int j1 = height / 4 + (j - 2) / 2; r = (bitmap[i1][j1].red + bitmap[i1][j1+1].red + bitmap[i1+1][j1].red + bitmap[i1+1][j1+1].red) / 4; g = (bitmap[i1][j1].green + bitmap[i1][j1+1].green + bitmap[i1][j1+1].green + bitmap[i1+1][j1+1].green) / 4; b = (bitmap[i1][j1].blue + bitmap[i1][j1+1].blue + bitmap[i1][j1+1].blue + bitmap[i1+1][j1+1].blue) / 4; } filteredBitmap[i][j].red = r; filteredBitmap[i][j].green = g; filteredBitmap[i][j].blue = b; } } return filteredImage; }
c046d29d-ef89-4c30-9cbd-9bb087f6a383
6
@Override public void processEntity(Entity entity) { Spatial spatial = entity.getComponent(Spatial.class); Velocity velocity = entity.getComponent(Velocity.class); PlayerControlled playerControlled = entity.getComponent(PlayerControlled.class); // Poll the event handelr and check if the key required for moving up // has been pressed boolean moveUp = keyEventHandler.isKeyDown(playerControlled.listenUp); boolean moveDown = keyEventHandler.isKeyDown(playerControlled.listenDown); boolean moveLeft = keyEventHandler.isKeyDown(playerControlled.listenLeft); boolean moveRight = keyEventHandler.isKeyDown(playerControlled.listenRight); if (moveUp) { velocity.currentState = Velocity.VelocityState.Accelerate; } else if (moveDown) { velocity.currentState = Velocity.VelocityState.Reverse; } else { velocity.currentState = Velocity.VelocityState.Idle; } if (moveLeft) { spatial.incrementDegrees(-playerControlled.turningSpeed); } if (moveRight) { spatial.incrementDegrees(playerControlled.turningSpeed); } // If the mouse is down, iterate through all children and check if they // wish to fire a bullet. if (mouseEventHandler.leftClickDown) { // As this entity may be a parent entity, grab every single Shoot // component that either the parent or its child may have, and allow // it to shoot. List<Shoot> shootComponentList = new ArrayList<Shoot>(); ParentSystem.getAllChildrenTComponents(entity, Shoot.class, shootComponentList); for (Shoot shootComponent : shootComponentList) { shootComponent.shootRequired = true; } } }
6610a46e-d19b-4ed1-bc86-d395abded4c6
2
public void ajErrorHiddenNode() { double sumChildren = 0.0; for (int t = 0; t < getOutgoingLinksNumber(); t++) { // for all neurons on next layer sumChildren += this.getOutgoingLink(t).getOut_node().getMisalignment() * this.getOutgoingLink(t).getWeight(); } this.setMisalignment(this.getPotential() * (1 - this.getPotential()) * sumChildren); //для скрытых слоев - по невязке предыдущего слоя //Adjustment of synaptic weights on the layers double lErr = this.getMisalignment(); for (int t = 0; t < this.getIncomingLinksNumber(); t++) { double oldWeight = this.getIncomingLink(t).getWeight(); double out = this.getIncomingLink(t).getIn_node().getPotential(); double newWeight = oldWeight + NeatClass.p_training_coefficient * lErr * out; this.getIncomingLink(t).setWeight(newWeight); } }
30c0ca9f-c140-410e-b666-ba0ebc89d01c
1
public final EsperParser.for__return for_() throws RecognitionException { EsperParser.for__return retval = new EsperParser.for__return(); retval.start = input.LT(1); Object root_0 = null; Token FOR47=null; EsperParser.forgap_return forgap48 =null; EsperParser.statements_return statements49 =null; Object FOR47_tree=null; try { // C:\\Users\\Alex\\Dropbox\\EclipseWorkspace\\esper-compiler\\src\\compiler\\Esper.g:63:6: ( FOR ^ forgap statements ) // C:\\Users\\Alex\\Dropbox\\EclipseWorkspace\\esper-compiler\\src\\compiler\\Esper.g:63:8: FOR ^ forgap statements { root_0 = (Object)adaptor.nil(); FOR47=(Token)match(input,FOR,FOLLOW_FOR_in_for_631); FOR47_tree = (Object)adaptor.create(FOR47) ; root_0 = (Object)adaptor.becomeRoot(FOR47_tree, root_0); pushFollow(FOLLOW_forgap_in_for_634); forgap48=forgap(); state._fsp--; adaptor.addChild(root_0, forgap48.getTree()); pushFollow(FOLLOW_statements_in_for_636); statements49=statements(); state._fsp--; adaptor.addChild(root_0, statements49.getTree()); } retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; }
f6df519a-9cbc-403a-a093-f1f95527471e
2
public static void draw() { for(Model2D m : tiles.values()) { for(int x = 0; x<tilePos.get(m.textureNames[0]).size(); x++) { m.drawAt((float) tilePos.get(m.textureNames[0]).get(x).getX(), (float) tilePos.get(m.textureNames[0]).get(x).getY()); } } }
c4ca7c03-07f1-40f6-b9f2-76af03f5f754
2
protected void initialize() { String out = "addSequential(new "; double left = Robot.driveTrain.getLeftDistance(); double right = Robot.driveTrain.getRightDistance(); double turn = Robot.driveTrain.getGyroAngle(); if ((left < 0) != (right < 0)){ out += "GyroTurn("; out += turn; } else { out += "EncoderDrive("; out += (right < 0) ? "-" : ""; out += (Math.min(Math.abs(left), Math.abs(right))); } out += ", " + _speed + "));"; System.out.println(out); System.out.println("addSequential(new DoNothing()," + _waitTime + ");"); Robot.driveTrain.clearEncoder(); }
26875da1-7acf-4567-abd4-3d6fc6b03530
7
public List<List<Integer>> subsetsWithDup(int[] num) { if(num == null) return null; Arrays.sort(num); List<List<Integer>> result = new ArrayList<List<Integer>>(); result.add(new ArrayList<Integer>()); Integer pre = (Integer)null; List<List<Integer>> preCopy = null; for (int i = 0; i < num.length; i++) { List<List<Integer>> copy = new ArrayList<List<Integer>>(); if(pre == null || pre != num[i]){ for(List<Integer> item: result) copy.add(new ArrayList<Integer>(item)); }else{ for(List<Integer> item: preCopy) copy.add(new ArrayList<Integer>(item)); } for (int k = 0; k < copy.size(); k++) { copy.get(k).add(num[i]); } pre = num[i]; preCopy = copy; result.addAll(copy); } return result; }
b3ca872c-1727-4e13-a3e5-27876564a0e0
1
public static void main(String[] args) throws IOException, ParserConfigurationException, SAXException { if (args.length != 2) { System.out.println("Usage: makedictionary [path-to-input-file] [path-to-pack-resource-folder]"); System.exit(1); } final File inputFile = new File(args[0]); final File resourcesFolder = new File(args[1]); buildDictionary(inputFile, resourcesFolder); }
90f32567-75ff-4cf1-bbf1-4227ec2e718d
5
private void readyForTermination() { addKeyListener(new KeyAdapter() { // listen for esc, q, end, ctrl-c on the canvas to // allow a convenient exit from the full screen configuration public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if ((keyCode == KeyEvent.VK_ESCAPE) || (keyCode == KeyEvent.VK_Q) || (keyCode == KeyEvent.VK_END) || ((keyCode == KeyEvent.VK_C) && e.isControlDown())) { running = false; } } }); } // end of readyForTermination()
352c23ba-7aa0-4cfb-a662-fa1813a5a21a
6
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); Action action = event.getAction(); if (action == Action.RIGHT_CLICK_BLOCK) { if ((player.getItemInHand().getType() == Material.GOLD_AXE) && (player.isOp())) { Location loc = event.getClickedBlock().getLocation(); rloc.put(player.getName(), loc); player.sendMessage(ChatColor.AQUA + "[WorldThredit] " + ChatColor.GREEN + "Location 2 Placed."); event.setCancelled(true); } } else if (action == Action.LEFT_CLICK_BLOCK) { if ((player.getItemInHand().getType() == Material.GOLD_AXE) && (player.isOp())) { Location loc = event.getClickedBlock().getLocation(); lloc.put(player.getName(), loc); player.sendMessage(ChatColor.AQUA + "[WorldThredit] " + ChatColor.GREEN + "Location 1 Placed."); event.setCancelled(true); } } }
e29f3fb9-4478-422f-b96f-f0305dcf382f
6
public static boolean copyFile(String source, File destination) { InputStream in = null; OutputStream out = null; try { destination.createNewFile(); in = FileUtils.class.getResourceAsStream(source); out = new FileOutputStream(destination); byte[] buffer = new byte[8192]; int bytesRead; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } return true; } catch (IOException e) { e.printStackTrace(); } finally { if (in != null) try { in.close(); } catch (IOException e) { e.printStackTrace(); } if (out != null) try { out.close(); } catch (IOException e) { e.printStackTrace(); } } return false; }
ef9ebbea-c855-4be1-ad6c-fdd7fd0ac025
6
public ImageIcon changeColor(BufferedImage image, Color toReplace, Color newColor, Color toReplace2, Color newColor2) { BufferedImage destImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = destImage.createGraphics(); g.drawImage(image, null, 0, 0); g.dispose(); for (int i = 0; i < destImage.getWidth(); i++) { for (int j = 0; j < destImage.getHeight(); j++) { Color c = new Color(image.getRGB(i,j), true); if (toReplace != null && compareColors(toReplace, c)) { destImage.setRGB(i, j, getRGB(newColor, c)); } if (toReplace2!= null && compareColors(toReplace2, c)) { destImage.setRGB(i, j, getRGB(newColor2, c)); } } } return new ImageIcon(destImage); }
8e458961-5a51-4786-8964-c773dab960e2
5
public Object nextEntity(char a) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break; } else { throw syntaxError("Missing ';' in XML entity: &" + sb); } } String s = sb.toString(); Object e = entity.get(s); return e != null ? e : a + s + ";"; }
a9636efa-6e1e-4b56-8b77-35bc485b4122
2
public ListNode partition(ListNode head, int x) { ListNode small = new ListNode(-1); // 添加辅助链表头 减少代码复杂度。 ListNode smallStep = small; ListNode big = new ListNode(-1); ListNode bigStep =big; while(head != null){ if(head.val < x){ smallStep.next = head; smallStep = smallStep.next; }else{ bigStep.next = head; bigStep = bigStep.next; } head = head.next; } bigStep.next = null; smallStep.next = big.next; return small.next; }
7389ebc7-7162-46d1-93a0-766a7de96868
0
@Test public void testMenu() throws Exception { view.getImportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent); assertEquals(propertyName, MainWindowController.IMPORT); view.getExportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent); assertEquals(propertyName, MainWindowController.EXPORT); }
5dc6c014-2eed-4553-8432-19229174df83
9
private void visitSymbol(Symbol _sym) { Symbol sym = _sym; if (sym.kind == VAR || sym.kind == MTH) { while (sym != null && sym.owner != owner) sym = proxies.lookup(proxyName(sym.name)).sym; if (sym != null && sym.owner == owner) { VarSymbol v = (VarSymbol)sym; if (v.getConstValue() == null) { addFreeVar(v); } } else { if (outerThisStack.head != null && outerThisStack.head != _sym) visitSymbol(outerThisStack.head); } } }
397381ed-488c-4459-9b35-7177e5fc4291
2
public Node getWord(String argString) { Node node = getNode(argString.toCharArray()); return node != null && node.isWord() ? node : null; }
c15c0972-97b2-4f08-bd8f-2bede04b2970
2
public Boolean markerIsTaken(int markerID, String hostName){ try { cs = con.prepareCall("{call returnMarkerOwner(?,?)}"); cs.setInt(1, markerID); cs.setString(2, hostName); ResultSet rs = cs.executeQuery(); if(rs.next()){ return true; } } catch (SQLException e) { e.printStackTrace(); } return false; }
1689c0f0-8cb4-467d-bb6f-6c5783a3fc49
1
private static void test3(){ Player p = new Player(16); System.out.println("Test 3"); System.out.println("This one adds some cards to a players hand and then shows the hand and the value."); for (int i = 10; i<15;i++) { Card c = new Card(i); p.addCardtoHand(c); } System.out.print(p.stringHand()); System.out.print(p.getHandCount()); }
8ad90675-62e4-4e3b-b212-f526b1a5b0d1
2
public static void main(String[] args) { String number; boolean valid = false; System.out.println("This is a binary to hexadecimal converter."); while(!valid){ System.out.print("Enter a binary or hexadecimal now: "); number = s.nextLine(); if(number.substring(0, 2).equalsIgnoreCase("Ox")){ valid = Hex2Bin(number); } else{ valid = Bin2Hex(number); } } System.out.println("Thanks for using this program."); }
c5736a12-bacc-4d1d-b857-5fe7f88f27ec
3
@Override public void run() { while(true) { try { Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 1000); if (!Agent.getConflictExists()) { Agent.setValue(agentId, agentType); Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 2000); } else Thread.sleep(10000); } catch (InterruptedException e) { System.out.println("Error Produit al Run del Thread del Agent: " + agentId); e.printStackTrace(); } } }
98737cff-c194-4aa4-a456-51a94d85c39f
2
void encodingError(String message, int value, int offset) throws java.lang.Exception { String uri; if (value >= 0) { message = message + " (byte value: 0x" + Integer.toHexString(value) + ')'; } if (externalEntity != null) { uri = externalEntity.getURL().toString(); } else { uri = baseURI; } handler.error(message, uri, -1, offset + currentByteCount); }
00347ab1-f868-40fa-af0f-e6d03fe87fce
8
public void getAtendimento(Atendimento atendimento) { try { txt_cliente.setText(atendimento.getCodcliente().getNomeFantasia()); if (atendimento.getDataFim() != null) { txt_dataFim.setText(Data.getDataByDate(atendimento.getDataFim(), "dd/MM/yyyy HH:mm")); } if (atendimento.getDataInicio() != null) { txt_dataInicio.setText(Data.getDataByDate(atendimento.getDataInicio(), "dd/MM/yyyy HH:mm")); } if (atendimento.getCodusuario() != null) { txt_usuario.setText(atendimento.getCodusuario().getUsuario()); } if (atendimento.getProblemaPendencia() != null) { txt_pendencia.setText(atendimento.getProblemaPendencia()); } if (atendimento.getProblemaInformado() != null) { txt_problemaInformado.setText(atendimento.getProblemaInformado()); } if (atendimento.getProblemaDetectado() != null) { txt_problemaDetectado.setText(atendimento.getProblemaDetectado()); } if (atendimento.getProblemaSolucao() != null) { txt_problemaSolucao.setText(atendimento.getProblemaSolucao()); } getPendencia(atendimento); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Erro ao Carregar informações do atendimento: " + atendimento.getCodatendimento()); } }
c4ec88f2-da1b-4695-8edf-1f4c017d54ed
8
public final void run() { int optionCount = this.options.size(); if (optionCount < 1) { System.out.println( "No options for you to choose from."); } else { int input = -1; ConsoleOption selected = null; do { System.out.println( "Please select one of the following option."); for (int i = 0; i < optionCount; i++) { System.out.println( "\t" + this.options.get(i).getPrompt(i + 1)); } try { input = RequestInput.requestInt(""); } catch (InputMismatchException e) { e.printStackTrace(); } } while (input < 0 || input > optionCount); if (input > 0) { selected = this.options.get(input - 1); } if (selected != null) { System.out.println("Running: " + selected.getPrompt()); try { selected.run(); } catch (Exception e) { e.printStackTrace(); } } else { System.out.println("No item selected, aborting"); } } }
6d7f9472-0b99-4b81-ac95-d73e257f62e6
5
int count(int n, int digit) { int res = 0; int max = 0; // max counts per digits int more = 1; // additional counts in current length int pre = 0; // from lower digits to higher digits, the passed 'n' while (n > 0) { int x = n % 10; res += x * max; if (x > digit) { res += more; } else if (x == digit) { res += pre + 1; } max = max * 10 + more; pre += more * x; more *= 10; n /= 10; } if (digit == 0) { // special case more /= 10; while (more > 0) { res -= more; more /= 10; } } return res; }
dfdf278c-87ca-422c-ac9a-ac21ac8bcddf
3
public boolean jsFunction_waitEndMoveGob(int gob, int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(JSBotUtils.isMoving(gob)) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
3d26929f-3a1a-4920-a0ec-2eae4d88a1c8
2
@Override public void tick() { super.tick(); Button oldSelected = selected; selected = buttons.get(pointer); if (oldSelected == null) { selected.hover(); } else if (!oldSelected.equals(selected)) { oldSelected.unHover(); selected.hover(); } buttons.forEach(Button::tick); }
f96b1a62-56d1-4c49-9918-d44768d61c25
5
@Override public void startListening() { if (this.state == ServerState.Running) return; try { this.server.bind(this.serverAddress); this.state = ServerState.Running; } catch (IOException ex) { ex.printStackTrace(); } this.serverRunner = new Thread(new Runnable() { @Override public void run() { while (state == ServerState.Running && !serverRunner.isInterrupted()) { try { Socket client = server.accept(); TcpClient tcpClient = new TcpClient(client); receiveClient(tcpClient); } catch (IOException ex) { ex.printStackTrace(); } } } }); this.serverRunner.start(); }
6b5e220e-7e71-4bbb-bcba-60ddfd5ae240
2
private String[][] readScore() { String tempg = null; try { File file = new File(SavePath.getHighScorePath()); if(file.exists()) { FileReader fileReader = new FileReader(file.getAbsoluteFile()); BufferedReader bufferedReader = new BufferedReader(fileReader); tempg=bufferedReader.readLine(); bufferedReader.close(); fileReader.close(); } } catch (IOException e) { e.printStackTrace(); } return createScoreList(tempg); }
e0e8fd01-9514-4aeb-9772-a606f3fa15e5
8
public final void import_stmt() throws RecognitionException { try { // Python.g:210:13: ( import_name | import_from ) int alt37=2; int LA37_0 = input.LA(1); if ( (LA37_0==86) ) { alt37=1; } else if ( (LA37_0==83) ) { alt37=2; } else { if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 37, 0, input); throw nvae; } switch (alt37) { case 1 : // Python.g:210:15: import_name { pushFollow(FOLLOW_import_name_in_import_stmt1421); import_name(); state._fsp--; if (state.failed) return; } break; case 2 : // Python.g:211:15: import_from { pushFollow(FOLLOW_import_from_in_import_stmt1437); import_from(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } }
6cfce4c7-2074-4f78-9ccc-4188cff1ebf1
4
public static int getWordCount(String str) { int length = 0; if (isEmpty(str) == true) { return length; } int i = 0; for (int len = str.length(); i < len; i++) { int ascii = Character.codePointAt(str, i); if ((ascii >= 0) && (ascii <= 255)) length++; else { length += 2; } } return length; }
93c1918b-0970-48e7-9eac-e4e9c913efbf
2
public PositionBox (boolean isEnemy, SelectListener selectListener, HoverListener hoverListener) { super (null); if (HOVER == null) { try { OPEN = ImageIO.read (new File (imagePath + "select_open.png")); OPEN_BG = ImageIO.read (new File (imagePath + "select_open.png")); LOCKED = ImageIO.read (new File (imagePath + "select_locked.png")); PICKING = ImageIO.read (new File (imagePath + "select_picking.png")); PICKING_BG = ImageIO.read (new File (imagePath + "select_picking_bg.png")); EPICKING = ImageIO.read (new File (imagePath + "select_picking_enemy.png")); EPICKING_BG = ImageIO.read (new File (imagePath + "select_picking_enemy_bg.png")); HOVER = new ImageIcon (imagePath + "select_hover.png"); } catch (IOException e) { e.printStackTrace(); } } this.isEnemy = isEnemy; addMouseListener (selectListener); championIcon = new JLabel (); championIcon.setBounds (60, 6, 62, 62); championIcon.addMouseListener (hoverListener); add (championIcon); championName = new JLabel(); championName.setBounds (0, 67, 210, 20); championName.setVerticalAlignment (SwingConstants.TOP); championName.setHorizontalAlignment (SwingConstants.CENTER); championName.setFont (new Font (Font.SANS_SERIF, Font.PLAIN, 11)); championName.setForeground (Color.WHITE); add (championName); setPreferredSize (new Dimension (210, 88)); setMaximumSize (new Dimension (420, 88)); }
7a5aa929-2682-41a2-893b-25b1157b93a1
5
public static int findClosingParenRecursively(String s, int startingParenLoc) { // check for valid parens location int returnVal = -1; if (errorCheck(s, startingParenLoc)) return -1; for (int i = startingParenLoc + 1; i < s.length(); i++) { if (s.charAt(i) == '(') { i = findClosingParenRecursively(s, i); if (i == -1) { // no ) was found, so propagate up the error flag. return -1; } returnVal = i; i = i + 1; // push i past the current ")" } else if (s.charAt(i) == ')') { return i; } } return returnVal; }
ebe674a1-0cab-482d-9faa-ecd837be96c5
9
public void checkOutDir( Directory dir, String path, OnDirCollision onDirCollision, OnFileCollision onFileCollision, Run run ) throws Exception { FileMetadata md = filesystem.getMetadata(path); if( md != null ) { switch( onDirCollision ) { case MERGE: break; // We'll make sure it's a directory in a bit. case ABORT: throw new CollisionException(path+" already exists"); } } if( md != null && md.getFsObjectType() != FSObjectType.DIRECTORY ) { throw new CollisionException(path+" is not a directory, but you're trying to overwrite it with one"); } if( run == Run.ACTUAL ) { filesystem.mkdir(path); } if( run == Run.DRY && md == null ) return; for( DirectoryEntry e : dir ) { checkOut( e.getUrn(), e.getLastModificationTime(), path+"/"+e.name, onDirCollision, onFileCollision, run ); } }
7dca1f93-188f-4032-9a51-cec3f51b6876
2
public static <T> T obtenirDeSession(HttpServletRequest requete, String nom, Class<T> classe) throws InvalidObjectException { Object obj = requete.getSession().getAttribute(nom); if (obj == null || obj.getClass().equals(classe)) { return (T)obj; } else { throw new InvalidObjectException(""); } }
84fb85c5-d06f-4cc7-a084-408e9443265f
2
public void handleEvent(Event event) { assert event != null && event.item != null; System.out.println("triggered TreeSelectionListener.handleEvent.Event = " + event.item); Editor editor = vermilionCascadeNotebook.getEditor(); VCNTreeItem item = editor.getTreeItem(); System.out.println("editor item = " + item); if (!item.isDisposed()) { item.setContent(editor.getText()); } String itemText = ((VCNTreeItem)event.item).getContent(); editor.removeVerifyListener(vermilionCascadeNotebook.getEditorVerifyListener()); editor.setText(itemText); editor.addVerifyListener(vermilionCascadeNotebook.getEditorVerifyListener()); editor.setTreeItem((VCNTreeItem)event.item); vermilionCascadeNotebook.getTreePopupMenu().setBoldSelection(((VCNTreeItem)event.item).isBold()); vermilionCascadeNotebook.setWrapEditor(((VCNTreeItem)event.item).isWrap()); vermilionCascadeNotebook.setTopLabel(((VCNTreeItem)event.item).getPath()); }
724069b6-68cd-4be5-a04d-4fe3e3c867fe
3
private void showTimeForm(TimeForm form){ int result = JOptionPane.showConfirmDialog(null, form, "Ny tävlande", JOptionPane.OK_CANCEL_OPTION, JOptionPane.NO_OPTION); if(result == JOptionPane.OK_OPTION){ if(form.isValidForm()){ Runner runner = getRunnerByStartNumber(form.getStartNumber()); if(runner != null){ runner.setTime(form.getTime()); }else{ JOptionPane.showMessageDialog(null, "Startnumret existerar inte!"); showTimeForm(form); } }else{ showTimeForm(form); } } }
fc6b9981-fc07-44a5-bd40-4b7f1239f1f6
8
@Override public void paint(Graphics2D g) { super.paint(g); Image image = new ImageIcon("resources/sprites/zombie1.png").getImage(); if (getFace() == 1) { image = new ImageIcon("resources/sprites/zombie1.png").getImage(); } if (getFace() == 2) { image = new ImageIcon("resources/sprites/zombie2.png").getImage(); } if (getFace() == 3) { image = new ImageIcon("resources/sprites/zombie3.png").getImage(); } if (getFace() == 4) { image = new ImageIcon("resources/sprites/zombie4.png").getImage(); } if (getFace() == 5) { image = new ImageIcon("resources/sprites/zombie5.png").getImage(); } if (getFace() == 6) { image = new ImageIcon("resources/sprites/zombie6.png").getImage(); } if (getFace() == 7) { image = new ImageIcon("resources/sprites/zombie7.png").getImage(); } if (getFace() == 8) { image = new ImageIcon("resources/sprites/zombie8.png").getImage(); } g.drawImage(image, getX(), getY(), getGame()); }
392c16e0-aa45-4af9-93af-4fd31a04242e
2
public void visit(Node node) { node.colorGrey(); Transition[] transitions = myAutomaton.getTransitionsFromState(node .getState()); for (int k = 0; k < transitions.length; k++) { Transition transition = transitions[k]; State toState = transition.getToState(); Node v = getNodeForState(toState); if (v.isWhite()) { visit(v); } } node.colorBlack(); }
56a3ec9a-8224-4df5-a1d0-8546cd37a2a1
7
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._exp_ == oldChild) { setExp((PExp) newChild); return; } for(ListIterator<PCase> i = this._case_.listIterator(); i.hasNext();) { if(i.next() == oldChild) { if(newChild != null) { i.set((PCase) newChild); newChild.parent(this); oldChild.parent(null); return; } i.remove(); oldChild.parent(null); return; } } for(ListIterator<PCommand> i = this._elseSwitch_.listIterator(); i.hasNext();) { if(i.next() == oldChild) { if(newChild != null) { i.set((PCommand) newChild); newChild.parent(this); oldChild.parent(null); return; } i.remove(); oldChild.parent(null); return; } } throw new RuntimeException("Not a child."); }
c1154754-c70c-44ac-8b57-f3ebb0d1608f
3
private Collection loadFromSpreadsheet(final InputStream excelFile) throws IOException { XSSFWorkbook workbook = new XSSFWorkbook(excelFile); data = new ArrayList(); Sheet sheet = workbook.getSheetAt(0); int numberOfColumns = countNonEmptyColumns(sheet); List rows = new ArrayList(); List rowData = new ArrayList(); for (Row row : sheet) { if (isEmpty(row)) { break; } else { rowData.clear(); for (int column = 0; column < numberOfColumns; column++) { Cell cell = row.getCell(column); rowData.add(objectFrom(workbook, cell)); } rows.add(rowData.toArray()); } } return rows; }
78f5c20a-dd7c-4c33-aa80-061b036300f2
0
public long getIdConnection() { return idConnection; }
97becbfa-ea36-4d09-acc1-9dc8f0920ea1
8
@Override public void move(Entity e) { if (Collided) { byte b = affected.getAmmoType(); switch (b) { case 0: case 1: case 2: Bullet.CoolDown = 1; Bullet.cost = 1; break; case 3: Bullet.CoolDown = 10; Bullet.cost = 1; break; case 4: Bullet.CoolDown = 0; Bullet.cost = 1; break; } EffectTimeleft--; if (EffectTimeleft < 0) { death((byte) 0); } else { Bullet.FireSound = null; } } else { TimeRemaining--; if (TimeRemaining == 0) { death((byte) 0); } } }
23e7aea6-ccc8-498c-a9f5-a83638f624cc
8
public void keyPressed (KeyEvent ke) { switch(ke.getKeyCode()) { case KeyEvent.VK_W: W_KEY = true; break; case KeyEvent.VK_UP: UP_KEY = true; break; case KeyEvent.VK_A: A_KEY = true; break; case KeyEvent.VK_LEFT: LEFT_KEY = true; break; case KeyEvent.VK_S: S_KEY = true; break; case KeyEvent.VK_DOWN: DOWN_KEY = true; break; case KeyEvent.VK_D: D_KEY = true; break; case KeyEvent.VK_RIGHT: RIGHT_KEY = true; break; default: break; } updateStates(); dataCon.setPhysicalStates(dataCon.getPlayerShip(), ACCEL, REVERSE, LEFT_TURN, RIGHT_TURN); }
f50cf777-b6cd-461f-afd7-f047e074ec7e
5
@Override public void interpretar(String input) { if (input.contentEquals("roque")) { roque(); } if (input.contentEquals("roqueMenor") || input.contentEquals("roquemenor")) { roqueMenor(); } if (input.contentEquals("roqueMaior") || input.contentEquals("roquemaior")) { roqueMaior(); } else { jogada(input); } this.next.interpretaProximo(input); }
a9213069-1808-4654-8fa3-377869486075
8
public static TokenType[] getTokens(Instruction i) { switch (i) { case SENSE: return (new TokenType[] {TokenType.SENSEDIRECTION,TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE,TokenType.SENSECONDITION}); case MARK: return (new TokenType[] {TokenType.MARKER,TokenType.NEXTSTATE}); case UNMARK: return (new TokenType[] {TokenType.MARKER,TokenType.NEXTSTATE}); case PICKUP: return (new TokenType[] {TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE}); case DROP: return (new TokenType[] {TokenType.NEXTSTATE}); case TURN: return (new TokenType[] {TokenType.LEFTRIGHT,TokenType.NEXTSTATE}); case MOVE: return (new TokenType[] {TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE}); case FLIP: return (new TokenType[] {TokenType.RANDINT,TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE}); default: // This block will never be reached return new TokenType[] {}; } }
42c3ddad-df86-4b00-8db5-858149ad4f79
6
private static int pref(String op) { int prf = 99; //if (op.equals("")) prf = 5; if (op.equals("*") || op.equals("+")) { prf = 5; } if (op.equals("-")) { prf = 4; } if (op.equals("|")) { prf = 3; } if (op.equals(")")) { prf = 2; } if (op.equals("(")) { prf = 1; } return prf; }
477066b9-62e4-4766-8209-2f716e43a383
6
public boolean save(final boolean save_photo_data) throws SDKException, APIException, SignInException{ final ArrayList<ArrayList> spreadSheet = new ArrayList<>(); final ArrayList<ArrayList> photoData = new ArrayList<>(); data.put(API_KEY_COMPUTER_ID, computer_id); data.put(API_HEAD_KEY_CREATE_USER, SYSTEM_USERNAME); if (contentList.isEmpty()) { return performOperation(SAVE_URI); } int i = 0; for (final BasicFile f: contentList) { final HashMap<String,String> hm = f.getHashMap(); final ArrayList<String> row = new ArrayList<>(); for (final String col: BasicFileMetadata.COLUMN_LIST) { row.add(hm.get(col)); } if (save_photo_data) { final PhotoMetadata pmd = new PhotoMetadata(f.getPath()); if (pmd.parseAble()) { final ArrayList photoRow = pmd.getDataAsSpreadSheetRow(); photoRow.add(0, i); photoData.add(photoRow); } } i++; spreadSheet.add(row); } data.put(API_KEY_ARCHIVE_DATA, spreadSheet); if (!photoData.isEmpty()) { data.put(API_KEY_PHOTO_DATA, photoData); } return performOperation(SAVE_URI); }
177342ac-99d0-471d-87cc-0884e61f4ed9
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); Connection con = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/kfaultdb","root","Cl1m8t3;"); ResultSet rsdoLogin = null; PreparedStatement psdoLogin = null; String email= request.getParameter("Susername"); String pass= request.getParameter("passwrd"); String message = "success"; String sqlOption= "SELECT * FROM author where email=? and pass=?"; psdoLogin = con.prepareStatement(sqlOption); psdoLogin.setString(1, email); psdoLogin.setString(2, pass); rsdoLogin=psdoLogin.executeQuery(); if(rsdoLogin.next()) { String userName=rsdoLogin.getString("email")+ ""+rsdoLogin.getString("pass"); String privilege = rsdoLogin.getString("privilege"); session.setAttribute("email", email); if(privilege.equals("Reporter")) { System.out.println("You have logged in with reporter privileges"); response.sendRedirect("/Faulty/Faults"); session.setAttribute("privilege", privilege); } if(privilege.equals("Admin")) { System.out.println("Log in employee window"); session.setAttribute("privilege", privilege); response.sendRedirect("Error.jsp"); } if(privilege.equals("Developer")) { System.out.println("Log in employee window"); session.setAttribute("privilege", privilege); response.sendRedirect("Error.jsp"); } } else { message = "No user"; response.sendRedirect("Index.jsp?error="+message); } } catch(Exception e) { e.printStackTrace(); } try{ if(con!=null) { con.close(); } } catch(Exception e) { e.printStackTrace(); } }
b8255fd7-3afb-4222-8622-a55efc4e306d
6
public static void ensureCauseChainIsSet(Throwable thr) { if (INIT_CAUSE_METHOD == null) { return; } // Loop either until null or encountering exceptions that use this method. while (thr != null && !(thr instanceof LocatedRuntimeException) && !(thr instanceof LocatedException)) { Throwable parent = thr.getCause(); if (parent != null) { try { INIT_CAUSE_METHOD.invoke(thr, new Object[]{ parent }); } catch (Exception e) { // can happen if parent already set on exception } } thr = parent; } }
0d74d106-322d-42c9-897d-7190b861fc12
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } UserMap other = (UserMap) obj; if (map == null) { if (other.map != null) { return false; } } else if (!map.equals(other.map)) { return false; } if (user == null) { if (other.user != null) { return false; } } else if (!user.equals(other.user)) { return false; } return true; }
3288a508-3d8e-4f71-a0fe-3a19a917b179
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Marker other = (Marker) obj; if (color != other.color) { return false; } if (id != other.id) { return false; } return true; }
63419660-27ee-4e25-832b-eb58b5ccdb8e
1
public Rank getPrimaryRank() { return (ranks.size() == 0 ? Rank.Null : ranks.get(0)); }
237e53ef-cadb-4c59-9593-764f8ec1e0e8
9
public static boolean addArtistByEntireName(boolean manually, String compName) { ArrayList<String> nameList = new ArrayList<String>(); String[] spl = compName.split(","); String[] names = spl[0].split("\\s"); String name = names[0]; if(spl.length == 1 && names.length > 1) { return false; } if(spl.length == 1 && names.length == 1) { return addArtist(manually, name, name); } String fullFirstName = ""; String fullLastName = name; String[] moreNames = spl[1].split("\\s"); for(int i = 1; i < names.length; i++) { String n = names[i]; if(n.length() > 0) { nameList.add(n); fullLastName += " " + n; } } for(int i = 0; i < moreNames.length; i++) { String mn = moreNames[i]; if(mn.length() > 0) { nameList.add(mn); fullFirstName += mn; if(i > 0) { fullFirstName += " "; } } } String fullName = fullFirstName + fullLastName; String[] nlArray = nameList.toArray(new String[nameList.size()]); return addArtist(manually, fullName, name, nlArray); }
8a6dc968-b4d7-4006-8744-e66847991421
7
private static final int getTotalGroupsSizeParallel(ArrayList<LinkedDimGroup> groups, int sType, boolean countSpanning) { int size = sType == LayoutUtil.MAX ? LayoutUtil.INF : 0; for (int i = 0, iSz = groups.size(); i < iSz; i++) { LinkedDimGroup group = groups.get(i); if (countSpanning || group.span == 1) { int grpSize = group.getMinPrefMax()[sType]; if (grpSize >= LayoutUtil.INF) return LayoutUtil.INF; if (sType == LayoutUtil.MAX ? grpSize < size : grpSize > size) size = grpSize; } } return constrainSize(size); }
ef2366d0-9a96-448f-85a0-3d43e09567b3
4
private void resaveParamsShowCity(SessionRequestContent request) { String validCityStatus = request.getParameter(JSP_CITY_VALID_STATUS); if(validCityStatus != null) { request.setSessionAttribute(JSP_CITY_VALID_STATUS, validCityStatus); } String invalidCityStatus = request.getParameter(JSP_CITY_INVALID_STATUS); if(invalidCityStatus != null) { request.setSessionAttribute(JSP_CITY_INVALID_STATUS, invalidCityStatus); } String validHotelStatus = request.getParameter(JSP_HOTEL_VALID_STATUS); if(validHotelStatus != null) { request.setSessionAttribute(JSP_HOTEL_VALID_STATUS, validHotelStatus); } String invalidHotelStatus = request.getParameter(JSP_HOTEL_INVALID_STATUS); if(invalidHotelStatus != null) { request.setSessionAttribute(JSP_HOTEL_INVALID_STATUS, invalidHotelStatus); } }
745f53ab-de86-4819-8a81-dd9109e975d5
8
public boolean GetConfig(ConsoleCommandSender sender, String[] args) { if (args.length < 2) { sendMessage(sender, ChatColor.RED, "Specify setting"); return true; } String settingName = args[1]; ConfigManager cm = Citadel.getConfigManager(); if (settingName.equalsIgnoreCase("flashLength")) { sendMessage(sender, ChatColor.YELLOW, "flashLength == " + cm.getFlashLength()); } else if (settingName.equalsIgnoreCase("autoModeReset")) { sendMessage(sender, ChatColor.YELLOW, "autoModeReset == " + cm.getAutoModeReset()); } else if (settingName.equalsIgnoreCase("verboseLogging")) { sendMessage(sender, ChatColor.YELLOW, "verboseLogging == " + cm.getVerboseLogging()); } else if (settingName.equalsIgnoreCase("redstoneDistance")) { sendMessage(sender, ChatColor.YELLOW, "redstoneDistance == " + cm.getRedstoneDistance()); } else if (settingName.equalsIgnoreCase("groupsAllowed")) { sendMessage(sender, ChatColor.YELLOW, "groupsAllowed == " + cm.getGroupsAllowed()); } else if (settingName.equalsIgnoreCase("cacheMaxAge")) { sendMessage(sender, ChatColor.YELLOW, "cacheMaxAge == " + cm.getCacheMaxAge()); } else if (settingName.equalsIgnoreCase("cacheMaxChunks")) { sendMessage(sender, ChatColor.YELLOW, "cacheMaxChunks == " + cm.getCacheMaxChunks()); } else { sendMessage(sender, ChatColor.RED, "Unknown setting: " + settingName); } return true; }
47b968b4-7335-49eb-a23c-35b73e1728db
7
private boolean func_46116_a(EntityAITaskEntry par1EntityAITaskEntry) { Iterator var2 = this.tasksToDo.iterator(); while (var2.hasNext()) { EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next(); if (var3 != par1EntityAITaskEntry) { if (par1EntityAITaskEntry.priority >= var3.priority) { if (this.executingTasks.contains(var3) && !this.areTasksCompatible(par1EntityAITaskEntry, var3)) { return false; } } else if (this.executingTasks.contains(var3) && !var3.action.isContinuous()) { return false; } } } return true; }