text
stringlengths
14
410k
label
int32
0
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE> already resisting poison.")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?L("An anti-venom field appears around <T-NAME>."):L("^S<S-NAME> chant(s) for an anti-venom field of protection around <T-NAMESELF>.^?")); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); beneficialAffect(mob,target,asLevel,0); } } else beneficialWordsFizzle(mob,target,L("<S-NAME> chant(s) for an anti-venom field, but fail(s).")); return success; }
8
public String getFamilienaam() { return familienaam; }
0
public ArrayList<String> gameInventory(){ ArrayList<String> gameInv = new ArrayList<String>(); String space =" "; for(Player p: allLivingPlayers()){ gameInv.add(("* " + p.playerTag + " *").concat(space.substring(p.playerTag.length() + 4))); for(Card c: p.inventory){ gameInv.add(c.name.concat(space.substring(c.name.length()))); } gameInv.add(space); } gameInv.add("* Dark Discard * "); for(Card c: darkDiscard){ if(c.equipment){ gameInv.add(c.name.concat(space.substring(c.name.length()))); } } gameInv.add(space); gameInv.add("* Light Discard * "); for(Card c: lightDiscard){ if(c.equipment){ gameInv.add(c.name.concat(space.substring(c.name.length()))); } } gameInv.add(space); gameInv.add("* Spectral Discard * "); for(Card c: spectralDiscard){ if(c.equipment){ gameInv.add(c.name.concat(space.substring(c.name.length()))); } } gameInv.add(space); while(gameInv.size() < 87){ gameInv.add(space); } return gameInv; }
9
@Override protected int onReadPacketHeader( ByteBuffer in ) { if (in.remaining() < HEADER_SIZE) { return ON_READ_REWIND; } int magicNumber = in.getInt(); if (magicNumber != protocol.getMagicNumber()) { return ON_READ_CLOSE; } long packetTime = in.getLong(); long receivedTime = in.getLong(); int packetSize = in.getInt(); if (in.remaining() < packetSize) { return ON_READ_REWIND; } pingTime = System.nanoTime() - receivedTime; lastReceivedPacketSize = packetSize; lastReceivedPacketTime = packetTime; return packetSize; }
3
public int resistedCounter(Type primary, Type secondary) { int counter = 0; if (resistantTypes == null || resistantTypes.length ==0) { return 0; } for (int i = 0; i < resistantTypes.length; i++) { if (resistantTypes[i].equalsTo(primary.showType()) || resistantTypes[i].equalsTo(secondary.showType())) { counter++; } } return counter; }
5
private static void update(double time) { if (Input.getKeyDown(Keyboard.KEY_ESCAPE)) { switch (getGameState()) { case DEAD: break; case LOADING: break; case MAIN_MENU: break; case PAUSED: setGameState(GameState.PLAYING); break; case PLAYING: setGameState(GameState.PAUSED); break; } } if (getGameState() == GameState.PLAYING) { world.update(time); } userInterface.update(time); }
7
@Override public void doAction(Player player, Grid grid) throws InvalidActionException { if (player.getRemainingTurns() <= 0) throw new InvalidActionException("The player has no turns left!"); Position currentPos = player.getPosition(); Position newPos = new Position(currentPos.getxCoordinate() + 1, currentPos.getyCoordinate() + 1); if (!canMoveToPosition(player, grid, newPos) || !canMoveDiagonal(grid, newPos)) throw new InvalidActionException("The player can't move to the desired position!"); player.setPosition(newPos); player.getLightTrail().addPosition(currentPos); player.decrementTurn(); }
3
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(affected==null) return false; if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; MOB diseaser=invoker; if(diseaser==null) diseaser=mob; if((!mob.amDead())&&((--diseaseTick)<=0)) { diseaseTick=DISEASE_DELAY(); mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,DISEASE_AFFECT()); final int damage=CMLib.dice().roll(1,6,0); if(damage>1) { CMLib.combat().postDamage(diseaser,mob,this,damage,CMMsg.MASK_ALWAYS|CMMsg.TYP_DISEASE,-1,null); } if((--conTickDown)<=0) { conTickDown=60; conDown++; } return true; } lastHP=mob.curState().getHitPoints(); return true; }
8
public String toShowData(String rs) { String[] arr = rs.split(DMSHandler.SEPCHAR); int len = arr.length; String show = ""; --len; for (int i = 0; i <= len; i++) { if (this.dimensions.get(i).equals(ADFormat.CITYNAME)) { show += this.getCity(arr[i]); } else if (this.dimensions.get(i).equals(ADFormat.ADSPACETYPE)) { show += this.getAdSpaceType(arr[i]); } else if (this.dimensions.get(i).equals(ADFormat.NETWORKMANNERID)) { show += this.getNetType(arr[i]); } else if (this.dimensions.get(i).equals(ADFormat.ISPID)) { show += this.getIspType(arr[i]); } else if (this.dimensions.get(i).equals(ADFormat.CLIENT)) { show += this.getClientType(arr[i]); } else if (this.dimensions.get(i).equals(ADFormat.DEVICETYPE)) { show += this.getDeviceType(arr[i]); } if (i != len) { show += DMSHandler.SEPCHAR; } } return show; }
8
private void insertSQLiteData() { if (m_sqlTable == null) { return; } SQLiteTestData data = new SQLiteTestData(); data.id = 0; data.name = "SAM"; data.time = System.currentTimeMillis(); SQLiteTestData data1 = new SQLiteTestData(); data1.id = 1; data1.name = "JAMES"; data1.time = System.currentTimeMillis(); SQLiteTestData data2 = new SQLiteTestData(); data2.id = 2; data2.name = "NIC"; data2.time = System.currentTimeMillis(); if (!m_sqlTable.insert(data, SQLiteTestData.class, true)) { log("insertSQLiteData Failed!"); return; } if (!m_sqlTable.insert(data1, SQLiteTestData.class, true)) { log("insertSQLiteData Failed!"); return; } if (!m_sqlTable.insert(data2, SQLiteTestData.class, true)) { log("insertSQLiteData Failed!"); return; } log("insertSQLiteData Passed"); }
4
@Override public int[] makeMove(final char[][] field) { int[] move = new int[2]; String cellCode = input.next(); if (cellCode.equals("back")) { move[0] = Player.CODE_TAKE_STEP_BACK; } else if (cellCode.equals("exit")) { move[0] = Player.CODE_EXIT; } else if (cellCode.length() < 2) { move[0] = Player.CODE_INVALID_CELL_CODE; } else { move[0] = (int)cellCode.charAt(0) - (int)('A'); move[1] = (int)cellCode.charAt(1) - (int)('0'); } return move; }
3
public static void main(String[] args) { for (Tester test : tests) { test.runTest(); } }
1
void init() throws IOException { if(!initialized) { char c1 = (char) super.read(); char c2 = (char) super.read(); char c3 = (char) super.read(); int v = super.read(); if(c1 != 'S' || c2 != 'N' || c3 != 'Z') { throw new FormatViolationException("Illegal prefix in SNZ stream"); } if(v != 1) { throw new FormatViolationException("Illegal SNZ version: " + v + " (only 1 is supported)", 1); } blockSize = 1 << super.read(); } initialized = true; }
5
@Override public void setPage(HelpViewer viewer) { if(isDirectory){ String header = "<html><body><ul>"; String footer = "</ul></body></html>"; StringBuffer content = new StringBuffer(); File[] children = base.listFiles(); if((children != null)&&(children.length>0)){ for(int i=0;i<children.length;++i){ content.append("<li>"+children[i].getName()+"</li>"); } } viewer.set(header+content.toString()+footer); }else{ FileReader stream; try { stream = new FileReader(base); char[] buffer = new char[10240]; StringBuffer fileBuffer = new StringBuffer(); int read = 0; while((read = stream.read(buffer)) >0){ fileBuffer.append(buffer, 0, read); } String file = fileBuffer.toString(); Pattern lt = Pattern.compile("<"); Matcher match = lt.matcher(file); file = match.replaceAll("&lt;"); Pattern gt = Pattern.compile(">"); match = gt.matcher(file); file = match.replaceAll("&gt;"); Pattern amp = Pattern.compile("&"); match = amp.matcher(file); file = match.replaceAll("&amp;"); viewer.set("<html><body><pre>"+file+"</pre></body></html>"); } catch (FileNotFoundException e) { ResourceBundle bundle =ResourceBundle.getBundle("Translations"); viewer.set(String.format(bundle.getString("html.body.error.help.file.s.not.found.body.html1"),base.getAbsolutePath())); e.printStackTrace(); } catch (IOException e) { ResourceBundle bundle =ResourceBundle.getBundle("Translations"); viewer.set(String.format(bundle.getString("html.body.error.help.file.s.had.an.io.error.body.html1"),base.getAbsolutePath())); e.printStackTrace(); } } }
7
public int getIntCode(String key) { if (key == "up") return up; else if (key == "right") return right; else if (key == "left") return left; else if (key == "down") return down; else if (key == "jump") return jump; else return 0; }
5
private static File syncAssets(File assetDir, String indexName) throws JsonSyntaxException, JsonIOException, IOException { Logger.logInfo("Syncing Assets:"); final File objects = new File(assetDir, "objects"); AssetIndex index = JsonFactory.loadAssetIndex(new File(assetDir, "indexes/{INDEX}.json".replace("{INDEX}", indexName))); if (!index.virtual) return assetDir; final File targetDir = new File(assetDir, "virtual/" + indexName); final ConcurrentSkipListSet<File> old = new ConcurrentSkipListSet(); old.addAll(FTBFileUtils.listFiles(targetDir)); Benchmark.reset("threading"); Parallel.TaskHandler th = new Parallel.ForEach(index.objects.entrySet()) .withFixedThreads(2*OSUtils.getNumCores()) //.configurePoolSize(2*2*OSUtils.getNumCores(), 10) .apply( new Parallel.F<Entry<String, Asset>, Void>() { public Void apply(Entry<String, Asset> e) { Asset asset = e.getValue(); File local = new File(targetDir, e.getKey()); File object = new File(objects, asset.hash.substring(0, 2) + "/" + asset.hash); old.remove(local); try { if (local.exists() && !DownloadUtils.fileSHA(local).equals(asset.hash)) { Logger.logInfo(" Changed: " + e.getKey()); FTBFileUtils.copyFile(object, local, true); } else if (!local.exists()) { Logger.logInfo(" Added: " + e.getKey()); FTBFileUtils.copyFile(object, local); } } catch (Exception ex) { Logger.logError("Asset checking failed: ", ex); } return null; } }); try { th.shutdown(); th.wait(60, TimeUnit.SECONDS); } catch (Exception ex) { Logger.logError("Asset checking failed: ", ex); } Benchmark.logBenchAs("threading", "parallel asset(virtual) check"); for (File f : old) { String name = f.getAbsolutePath().replace(targetDir.getAbsolutePath(), ""); Logger.logInfo(" Removed: " + name.substring(1)); f.delete(); } return targetDir; }
7
public void switchEtatBouttons(){ Carte carte1, carte2; int val; //Affiche ou efface le boutton Assurance carte1 = d.main.getCarteDansMain(0); if(carte1.getValeur() == 1 && choixAssurance == false && propAssurance == false){ boutonAssurance.setEnabled(true); propAssurance = true; } else{ boutonAssurance.setEnabled(false); } //Affiche ou efface le boutton Doubler carte1 = j.main.getCarteDansMain(0); carte2 = j.main.getCarteDansMain(1); val = carte1.getValeur() + carte2.getValeur(); if(val > 8 && val < 12 && propDoubler == false){ boutonDoubler.setEnabled(true); propDoubler = true; } else{ boutonDoubler.setEnabled(false); } //Affiche ou efface le boutton Partager if(carte1.getValeur() == carte2.getValeur()){ boutonPartager.setEnabled(true); } else{ boutonPartager.setEnabled(false); } }
7
@Override public void mouseReleased(MouseEvent e) { int x = e.getX(); int y = e.getY(); if (x >= this.x && y >= this.y && x <= this.x + this.width && y <= this.y + this.height) setState(ButtonState.HOVER); else setState(ButtonState.NORMAL); }
4
public boolean isEnabled() { return comp.isEnabled() && comp.getSelectedText()!=null; }
1
public void insertString(int i, String s, AttributeSet attributeset) throws BadLocationException { if (s == null || "".equals(s)) return; String s1 = getText(0, i); String s2 = getMatch(s1 + s); int j = (i + s.length()) - 1; if (isStrict && s2 == null) { s2 = getMatch(s1); j--; } else if (!isStrict && s2 == null) { super.insertString(i, s, attributeset); return; } super.remove(0, getLength()); super.insertString(0, s2, attributeset); setSelectionStart(j + 1); setSelectionEnd(getLength()); }
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DateTime other = (DateTime) obj; if (am != other.am) return false; if (day != other.day) return false; if (hour != other.hour) return false; if (minute != other.minute) return false; if (month != other.month) return false; if (year != other.year) return false; return true; }
9
private void Initialize() { //random int to use when setting the car random = new Random(); //this is also used to restart the game, but it does the same thing ResetPlayer(); //used for control speedAccelerating = 2; speedStopping = 1; //used for "crossing the finish line" topLandingSpeed = 2; //set the top speed TOP_SPEED = 6; }
0
private Class getPrimativeClass(Object obj) { if (obj instanceof XPath) return XPath.class; Class cl = obj.getClass(); if (cl == Double.class) { cl = double.class; } if (cl == Float.class) { cl = float.class; } else if (cl == Boolean.class) { cl = boolean.class; } else if (cl == Byte.class) { cl = byte.class; } else if (cl == Character.class) { cl = char.class; } else if (cl == Short.class) { cl = short.class; } else if (cl == Integer.class) { cl = int.class; } else if (cl == Long.class) { cl = long.class; } return cl; }
9
private Monopoly(Loader loader) { go = loader.getGo(); jail = loader.getJail(); playerHashMap = loader.getPlayerHashMap(); serverOperator = new ServerOperator(this, loader); actions = new HashMap<Integer, HashMap<String, ActionThread>>(); //The thread will set the next player as active and will then wait for him to finish his turn and sets the //next player active and waits ... //TODO Specify a timeout for a turn turnThread = new Thread(new Runnable() { @Override public void run() { Player previousPlayer = null; try { synchronized(turnThread) { while(!gameOver) { Iterator<Player> iterator = playerHashMap.values().iterator(); while(iterator.hasNext()) { try { currentPlayer = iterator.next(); currentPlayer.setTurnEnd(false); turnThread.wait(); //TODO possible replace with "Condition" previousPlayer = currentPlayer; } catch(ConcurrentModificationException e) { iterator = playerHashMap.values().iterator(); while(iterator.hasNext()) { if(iterator.next().equals(previousPlayer)) { break; } } } } } } } catch(InterruptedException e) { e.printStackTrace(); } } }); turnThread.setName("Turn thread"); }
6
public static boolean isDefined(String domain, String key) { if ( !config.containsKey(domain) ) return false; if ( !config.get(domain).containsKey(key) ) return false; return true; }
2
private void endFormals() { if (seenFormalParameter) { declaration.append('>'); seenFormalParameter = false; } }
1
public void draw1(Graphics2D g2){ g2.setStroke(new BasicStroke(10f)); // int n = 20; // if(n > particles.size()) n = particles.size(); for(int i = 0; i < particles.size(); i++){ int n = particles.size() - particles.get(i).age/50; for(int j = 1; j < n; j++){ int k = (j+i) % particles.size(); g2.setColor(new Color(randFloat,1-j/(float)n,j/(float)n, 1f)); g2.drawLine((int)particles.get(i).loc.x, (int)particles.get(i).loc.y, (int)particles.get(k).loc.x, (int)particles.get(k).loc.y); } } for(int i = 0; i < particles.size(); i++){ int k = (1+i) % particles.size(); g2.setColor(new Color(randFloat,1-1/10f,1/10f, 1f)); g2.drawLine((int)particles.get(i).loc.x, (int)particles.get(i).loc.y, (int)particles.get(k).loc.x, (int)particles.get(k).loc.y); } for(Particle p : particles) p.draw(g2); }
4
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { subExpressions[0].dumpExpression(writer, 550); writer.breakOp(); writer.print(" <=>"); if (allowsNaN) writer.print(greaterOnNaN ? "g" : "l"); writer.print(" "); subExpressions[1].dumpExpression(writer, 551); }
2
public void save() { JSONObject json = toJson(); try { File file = new File("rounds/" + System.currentTimeMillis() + ".json"); FileWriter fw = new FileWriter(file.getAbsolutePath()); fw.write(json.toString()); fw.close(); } catch (IOException ex) { Logger.getLogger(Profile.class.getName()).log(Level.SEVERE, null, ex); } }
1
@Override public void run() { while (!socket.isClosed()) { DatagramPacket p = new DatagramPacket(new byte[10], 10); try { socket.receive(p); } catch (IOException e) { continue; } Message m = new Message(p.getData()); if (m.getMessageType() == MessageType.CONFIRMED_REQUEST) { System.out.println("Received confirmed request: id=" + m.getMessageId() + ", value=" + m.getValue()); // Wait for a sec before sending response try { Thread.sleep(1000); } catch (InterruptedException e1) { // no op } Message response = new Message(MessageType.RESPONSE, m.getMessageId(), (byte) (m.getValue() + 1)); try { send(response, p.getAddress(), p.getPort()); } catch (IOException e) { e.printStackTrace(); } } else if (m.getMessageType() == MessageType.UNCONFIRMED_REQUEST) System.out.println("Received unconfirmed request: id=" + m.getMessageId() + ", value=" + m.getValue()); else if (m.getMessageType() == MessageType.RESPONSE) { System.out.println("Received response: id=" + m.getMessageId() + ", value=" + m.getValue()); synchronized (waitingRoom) { WaitingRoomMember wrm = waitingRoom.get(m.getMessageId()); if (wrm == null) System.out.println("No waiter for response id: " + m.getMessageId()); else wrm.setResponse(m); } } } System.out.println("Message control ended: port=" + port); }
8
public boolean intersects(S2Loop b) { // a->Intersects(b) if and only if !a->Complement()->Contains(b). // This code is similar to Contains(), but is optimized for the case // where both loops enclose less than half of the sphere. if (!bound.intersects(b.getRectBound())) { return false; } // Normalize the arguments so that B has a smaller longitude span than A. // This makes intersection tests much more efficient in the case where // longitude pruning is used (see CheckEdgeCrossings). if (b.getRectBound().lng().getLength() > bound.lng().getLength()) { return b.intersects(this); } // Unless there are shared vertices, we need to check whether A contains a // vertex of B. Since shared vertices are rare, it is more efficient to do // this test up front as a quick acceptance test. if (contains(b.vertex(0)) && findVertex(b.vertex(0)) < 0) { return true; } // Now check whether there are any edge crossings, and also check the loop // relationship at any shared vertices. if (checkEdgeCrossings(b, new S2EdgeUtil.WedgeIntersects()) < 0) { return true; } // We know that A does not contain a vertex of B, and that there are no edge // crossings. Therefore the only way that A can intersect B is if B // entirely contains A. We can check this by testing whether B contains an // arbitrary non-shared vertex of A. Note that this check is cheap because // of the bounding box precondition and the fact that we normalized the // arguments so that A's longitude span is at least as long as B's. if (b.getRectBound().contains(bound)) { if (b.contains(vertex(0)) && b.findVertex(vertex(0)) < 0) { return true; } } return false; }
8
public String getLabel() { if (label == null) label = "flow_" + addr + "_" + (serialno++) + "_"; return label; }
1
private void blitToComponent(Graphics gScreen) { if (m_offscreen == null) return; do { int returnCode = m_offscreen.validate(getGraphicsConfiguration()); if (returnCode == VolatileImage.IMAGE_RESTORED) { // Contents need to be restored renderOffscreen(); // restore contents } else if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) { // old vImg doesn't work with new GraphicsConfig; re-create it renderOffscreen(); } gScreen.drawImage(m_offscreen, 0, 0, this); } while (m_offscreen.contentsLost()); }
4
@Override public Value evaluate(Value... arguments) throws Exception { // Check the number of argument if (arguments.length == 1) { // get Value Value value = arguments[0]; // If numerical if (value.getType().isNumeric()) { return new Value(new Double(Math.tan(value.getDouble()))); } if (value.getType() == ValueType.ARRAY) { Value[] vector = value.getValues(); Value result[] = new Value[vector.length]; for (int i = 0; i < vector.length; i++) { result[i] = evaluate(vector[i]); } return new Value(result); } // the type is incorrect throw new EvalException(this.name() + " function does not handle " + value.getType().toString() + " type"); } // number of argument is incorrect throw new EvalException(this.name() + " function only allows one numerical parameter"); }
4
public KeyState getMainState(){ return mainState; }
0
@Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); int oldSel = selectedObject; for (NSMBObject obj : objects) { Rectangle or = getRectFor(obj); if (or.contains(x, y)) { selected = obj; selectedObject = obj.ObjNum; } } if (oldSel != selectedObject) { for (ObjectChangeListener l : listeners) l.objectChanged(selectedObject); repaint(); } }
4
public static Stella_Object accessAbstractPropositionsIteratorSlotValue(AbstractPropositionsIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_SELECTION_PATTERN) { if (setvalueP) { self.selectionPattern = ((Cons)(value)); } else { value = self.selectionPattern; } } else if (slotname == Logic.SYM_LOGIC_PROPOSITION_CURSOR) { if (setvalueP) { self.propositionCursor = ((Iterator)(value)); } else { value = self.propositionCursor; } } else if (slotname == Logic.SYM_LOGIC_EQUIVALENTS_STACK) { if (setvalueP) { self.equivalentsStack = ((Cons)(value)); } else { value = self.equivalentsStack; } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); }
6
public static Sprite loadSprite(String url, int width, int height) { File file = new File("res\\" + url); Sprite sprite; try { sprite = new Sprite(ImageIO.read(new File("res\\" + url)), width, height); System.out.println("Loaded: " + file.getAbsolutePath()); } catch (IOException e) { sprite = Sprite.placeholder(width, height); System.out.println("Loading failed: " + file.getAbsolutePath()); } return sprite; }
1
public Music() { try { AudioInputStream audioIn = AudioSystem .getAudioInputStream(new File("music/theme.wav")); data = AudioSystem.getClip(); data.open(audioIn); data.loop(Clip.LOOP_CONTINUOUSLY); } catch(LineUnavailableException e) { e.printStackTrace(); } catch(UnsupportedAudioFileException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } }
3
public final void changeWait(int wait) throws ArtistBiographyException { if(wait < 100 || wait > 20000) throw new ArtistBiographyException("The wait vale is not correct"); ArtistBiography.wait= wait; }
2
public int hashCode() { int hash = 7; hash = 73 * hash + (this.groupRule != null ? this.groupRule.hashCode() : 0); hash = 73 * hash + (this.artifactRule != null ? this.artifactRule.hashCode() : 0); hash = 73 * hash + (this.typeRule != null ? this.typeRule.hashCode() : 0); hash = 73 * hash + (this.versionRule != null ? this.versionRule.hashCode() : 0); hash = 73 * hash + (this.classifierRule != null ? this.classifierRule.hashCode() : 0); hash = 73 * hash + (this.scopeRule != null ? this.scopeRule.hashCode() : 0); return hash; }
6
@EventHandler public void onPressurePlateStep(PlayerInteractEvent e) { if (HyperPVP.getSpectators().containsKey(e.getPlayer().getName()) || HyperPVP.isCycling() || !HyperPVP.hasMatchBeenAnnounced()) { if (e.getAction().equals(Action.PHYSICAL) && e.getClickedBlock().getType() == Material.STONE_PLATE) { e.setCancelled(true); } return; } if (!HyperPVP.getMap().getFeatures().contains("jumppreassureplate")) { return; } if (e.getAction().equals(Action.PHYSICAL) && e.getClickedBlock().getType() == Material.STONE_PLATE) { Player p = e.getPlayer(); double strength = 2.0; double up = 2.0; Vector v = p.getLocation().getDirection().multiply(strength).setY(up); p.setVelocity(v); p.playSound(p.getLocation(), Sound.ENDERDRAGON_WINGS, 10.0F, 2.0F); e.setCancelled(true); } }
8
public TurnOffCommand(Receiver receiver) { this.receiver = receiver; }
0
private void rehashTable() { if (keys == null) { if (check && keyCount != 0) Kit.codeBug(); if (check && occupiedCount != 0) Kit.codeBug(); int N = 1 << power; keys = new Object[N]; values = new int[2 * N]; } else { // Check if removing deleted entries would free enough space if (keyCount * 2 >= occupiedCount) { // Need to grow: less then half of deleted entries ++power; } int N = 1 << power; Object[] oldKeys = keys; int[] oldValues = values; int oldN = oldKeys.length; keys = new Object[N]; values = new int[2 * N]; int remaining = keyCount; occupiedCount = keyCount = 0; for (int i = 0; remaining != 0; ++i) { Object key = oldKeys[i]; if (key != null && key != DELETED) { int keyHash = oldValues[oldN + i]; int index = insertNewKey(key, keyHash); values[index] = oldValues[i]; --remaining; } } } }
9
public static String CatchTitle(int n) { InputStreamReader isReader= new InputStreamReader(MyMenu.class.getClassLoader().getResourceAsStream(path)); String title = null; try (BufferedReader reader = new BufferedReader(isReader)) { String line = reader.readLine(); // read the first line containing the description of the column while ((line = reader.readLine()) != null) { // Reading the file line by line String[] split = line.split(";"); int ID = Integer.parseInt(split[0]); if (n==ID){ // If we are on the line where the Menu is defined title = split[1]; // description = split[2]; } } } catch (IOException x) { System.err.format("IOException: %s%n", x); } return title; }
3
private boolean jj_2_71(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_71(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(70, xla); } }
1
public static double[] decode_exactly (String geohash){ double[] lat_interval = {-90.0 , 90.0}; double[] lon_interval = {-180.0, 180.0}; double lat_err = 90.0; double lon_err = 180.0; boolean is_even = true; int sz = geohash.length(); int bsz = bits.length; double latitude, longitude; for (int i = 0; i < sz; i++){ int cd = _decodemap.get(geohash.charAt(i)); for (int z = 0; z< bsz; z++){ int mask = bits[z]; if (is_even){ lon_err /= 2; if ((cd & mask) != 0){ lon_interval[0] = (lon_interval[0]+lon_interval[1])/2; } else { lon_interval[1] = (lon_interval[0]+lon_interval[1])/2; } } else { lat_err /=2; if ( (cd & mask) != 0){ lat_interval[0] = (lat_interval[0]+lat_interval[1])/2; } else { lat_interval[1] = (lat_interval[0]+lat_interval[1])/2; } } is_even = is_even ? false : true; } } latitude = (lat_interval[0] + lat_interval[1]) / 2; longitude = (lon_interval[0] + lon_interval[1]) / 2; return new double []{latitude, longitude, lat_err, lon_err}; }
6
private boolean r_postlude() { int among_var; int v_1; // repeat, line 56 replab0: while (true) { v_1 = cursor; lab1: do { // (, line 56 // [, line 58 bra = cursor; // substring, line 58 among_var = find_among(a_0, 3); if (among_var == 0) { break lab1; } // ], line 58 ket = cursor; switch (among_var) { case 0: break lab1; case 1: // (, line 59 // <-, line 59 slice_from("i"); break; case 2: // (, line 60 // <-, line 60 slice_from("u"); break; case 3: // (, line 61 // next, line 61 if (cursor >= limit) { break lab1; } cursor++; break; } continue replab0; } while (false); cursor = v_1; break replab0; } return true; }
8
PresenterFactory discover() { Iterable<PresenterFactory> discoveredFactories = PresenterFactory.discover(); List<PresenterFactory> factories = StreamSupport.stream(discoveredFactories.spliterator(), false). collect(Collectors.toList()); if (factories.isEmpty()) { return Injector::instantiatePresenter; } if (factories.size() == 1) { return factories.get(0); } else { factories.forEach(System.err::println); throw new IllegalStateException("More than one PresenterFactories discovered"); } }
2
private void btnReporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReporteActionPerformed final int totalFilas = this.table_ticket.getRowCount(); if (totalFilas > 0) { this.progress_bar.setVisible(true); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); new Thread(new Runnable() { @Override public void run() { try { //Fechas java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yyyy"); String desde = sdf.format(txt_fechadesde.getDate()); desde = desde.replace("/", "-"); String hasta = sdf.format(txt_fechahasta.getDate()); hasta = hasta.replace("/", "-"); String codigoLineaArea = comboLineasModel.getCodigoLinea(list_lineaerea.getSelectedIndex()); //String directorioFijo = "C:\\Users\\Alberto\\Desktop\\Proyectos\\oris-tkt\\src\\oris\\reports\\AnalisisVentas.jasper"; String directorio = System.getProperty("user.dir"); System.out.println("Cargando archivo desde: " + directorio+"\\cargador-reportes\\AnalisisVentas.jasper"); JasperReport jr = null; try { jr = (JasperReport) JRLoader.loadObjectFromFile(directorio+"\\cargador-reportes\\AnalisisVentas.jasper"); } catch (JRException jrex) { System.out.println("Falla al cargar el reporte: "+jrex.getMessage()); JOptionPane.showMessageDialog(null, "Falla al cargar el reporte, archivo en cargador-reporte no encontrado", "Error de carga", JOptionPane.ERROR_MESSAGE, null); } //Parametros Map parametro = new HashMap(); parametro.put("fecha_desde", desde); parametro.put("fecha_hasta", hasta); parametro.put("codigo", codigoLineaArea); System.out.println(parametro); Conexion con = new Conexion(); System.out.println("Conectandome...."); JasperPrint jp = JasperFillManager.fillReport(jr, parametro, con.getConnection()); System.out.println("Conectado."); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); jv.setTitle("Reporte"); con.closeConnection(); } catch (JRException ex) { System.out.println(ex.getMessage()); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { progress_bar.setVisible(false); setCursor(Cursor.getDefaultCursor()); } }); } }).start(); } else { JOptionPane.showMessageDialog(null, "Primero debe realizar una búsqueda"); } }//GEN-LAST:event_btnReporteActionPerformed
3
public String read(String fileName){ String data = ""; String line; try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); while((line=reader.readLine())!=null){ data+=line; } } catch (FileNotFoundException e) { this.plugin.logMessage("Unable to read from "+fileName+": "+e.getMessage()); } catch (IOException e) { this.plugin.logMessage("Error while reading "+fileName+": "+e.getMessage()); } return data; }
3
public void populateSongLists() { if(!playerLibrary.isEmpty()) { titlesList.setListData(playerLibrary.getAllTitles().toArray()); artistList.setListData(playerLibrary.getAllArtists().toArray()); } else { titlesList.setListData(defaultList); artistList.setListData(defaultList); } }
1
public static Vector<Place> getPlacesDisponiblesFromZone (String numS, String date, int zone) throws BDException { Vector<Place> res = new Vector<Place>(); String requete = "select norang, noplace, numZ from lesplaces where numz=" + zone + " MINUS select lestickets.norang, lestickets.noplace, numz from LesTickets, lesplaces where lestickets.noplace = lesplaces.noplace and lestickets.norang=lesplaces.norang and numS = "+numS+" and dateRep = to_date('"+date+"','dd/mm/yyyy hh24:mi') ORDER BY norang, noplace"; Statement stmt = null; ResultSet rs = null; Connection conn = null; try { conn = BDConnexion.getConnexion(); BDRequetesTest.testRepresentation(conn, numS, date); stmt = conn.createStatement(); rs = stmt.executeQuery(requete); while (rs.next()) { res.addElement(new Place(rs.getInt(1), rs.getInt(2), rs.getInt(3))); } } catch (SQLException e) { throw new BDException("Problème dans l'interrogation des places (Code Oracle : "+e.getErrorCode()+")"); } finally { BDConnexion.FermerTout(conn, stmt, rs); } return res; }
2
public GeocoderResponse parse(InputStream inputStream) throws IOException { YaGeocoderHandler handler = new YaGeocoderHandler(); try { parser.parse(inputStream, handler); } catch (Exception e) { throw new IOException("Failed to parse geocoder result: " + e.toString(), e); } return handler.getResult(); }
1
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(Form.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Form.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Form.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Form.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() { TextArea.setAutoscrolls(true); new Form().setVisible(true); } }); }
6
@Override public void onEnable () { if(getConfig().getConfigurationSection("playerFreqs") != null){ Map<String, Object> configmap = getConfig().getConfigurationSection("playerFreqs").getValues(false); for(Entry<String, Object> entry : configmap.entrySet()){ Double val = (Double)entry.getValue(); RadioPluginCommandExecuter.playerFreqs.put((String) entry.getKey(), val.floatValue()); } } if(getConfig().getConfigurationSection("eKey") != null){ Map<String, Object> eKeymap = getConfig().getConfigurationSection("eKey").getValues(false); for(Entry<String, Object> entry : eKeymap.entrySet()){ RadioPluginCommandExecuter.eKey.put((String) entry.getKey(), (String) entry.getValue()); } } if(getConfig().getConfigurationSection("tags") != null){ Map<String, Object> tagMap = getConfig().getConfigurationSection("tags").getValues(false); for(Entry<String, Object> entry : tagMap.entrySet()){ SendTag.tag.put((String) entry.getKey(), (String) entry.getValue()); } } if(getConfig().getConfigurationSection("volumes") != null){ Map<String, Object> volMap = getConfig().getConfigurationSection("volumes").getValues(false); for(Entry<String, Object> entry : volMap.entrySet()){ RadioVolume.volumes.put((String) entry.getKey(), (Integer) entry.getValue()); } } RadioPluginCommandExecuter executer = new RadioPluginCommandExecuter(this); new EssentialsUtils(this); SendTag tagsender = new SendTag(this); RadioVolume radvol = new RadioVolume(this); getCommand("getfreq").setExecutor(executer); getCommand("setfreq").setExecutor(executer); getCommand("radio").setExecutor(executer); getCommand("setekey").setExecutor(executer); getCommand("getekey").setExecutor(executer); getCommand("settag").setExecutor(tagsender); getCommand("gettag").setExecutor(tagsender); getCommand("setvol").setExecutor(radvol); getCommand("getvol").setExecutor(radvol); }
8
public void infinteLoop() { boolean quit = false; ui.hello(); do { UserChoice userChoice = ui.userChoiceMenu(); switch(userChoice) { case ADDCARD: addCard(); break; case MODIFYCARD: modifyCard(); break; case DELCARD: delCard(); break; case DISPLAYCARD: displayCard(); break; case DISPLAYPOKEDECK: displayPokedeck(); break; case FINDCARDSBYTYPE: findCardsByType(); break; case FINDCARDSBYCOLLECTION: findCardsByCollection(); break; case QUIT: quit = true; saveDeck(); break; default: quit = true; saveDeck(); } } while(!quit); ui.quit(); }
9
public void keyTyped(KeyEvent arg0) { if (arg0.getKeyChar() == 's') { panel_1.moveDown(); } if (arg0.getKeyChar() == 'w') { panel_1.moveUp(); } if (arg0.getKeyChar() == 'a') { panel_1.moveLeft(); } if (arg0.getKeyChar() == 'd') { panel_1.moveRight(); } }
4
private void parseData(String content, List<String>[] alldata) throws ExcelException { boolean flag = false; Matcher m = REG_AMT_WM_PT.matcher(content); if (m.find()) { String cur = m.group(1); if (Constants.QUOTEBILL_CUR_AUD.equals(cur)) { alldata[0].add(m.group(2)); flag = true; } else if (Constants.QUOTEBILL_CUR_USD.equals(cur)) { alldata[1].add(m.group(2)); flag = true; } } else { m = REG_AMT_SHIPMENT_PT.matcher(content); if (m.find()) { String cur = m.group(1); if (Constants.QUOTEBILL_CUR_AUD.equals(cur)) { alldata[2].add(m.group(2)); flag = true; } else if (Constants.QUOTEBILL_CUR_USD.equals(cur)) { alldata[3].add(m.group(2)); flag = true; } } } if (!flag) { throw new ExcelException(Constants.ERROR_DATA_QUOTE_EXCEL); } }
7
private void deleteMail(int n) { String response = ""; try { sTrace.debug("Try DELE " + n + " Command"); writeToServer("DELE " + n); response = readFromServer(); if (response.startsWith("-ERR")) { sTrace.error("Could not delete Mail " + n); } else if(response.startsWith("+OK")){ sTrace.debug("Deleted Mail " + n); }else{ sTrace.error("Unknown response on DELE Command: " + response); } } catch (IOException e) { error = true; sTrace.error("Socket Error during Pop3Client.getMail()\n" + e.getMessage()); } }
3
public void handleCommand(Message message) { if(!conn.conected()) return; String body = message.getBody(); if(body.startsWith(prefix)){ body = body.substring(prefix.length()); }else{ //(message.getBody().startsWith(connection.getNick()){ body = body.substring(conn.getNick().length()); if(body.matches("[:>]? .*")){ body = body.substring(1).trim(); }else{ return; } } String[] command = body.split(" +"); if(logger.isTraceEnabled()){logger.trace("Handling command: " + Arrays.toString(command));} String from = message.getFrom(); int priv = getPrivLevel(from); switch (command[0]) { case "commands": printCommands(); break; case "help": printHelp(command[1]); break; default: CommandWrapper cw = plugins.getPlugin(command[0]); if(cw == null) return; Command c = cw.command; if(c.getPrivLevel() <= priv){ c.handle(new eu.janinko.xmppmuc.Message(message,this), command); }else if(logger.isInfoEnabled()){ logger.info("User " + from + " (priv " + priv + ") tried to do '" + message.getBody() + "' (priv " + c.getPrivLevel() + ")"); } break; } }
9
public boolean isKeyDown(int keyCode) { if (keyCode > 0 && keyCode < 256) { return keys [keyCode]; } return false; }
2
public int getPrivs(Transaction trans, String username) throws SQLException, DatabaseException { trans=new JDBCTransaction(createConnection()); Connection connection = ((JDBCTransaction)trans).getConnection(); Statement stmt=connection.createStatement(); int x = 0; if(!validString(username)) throw new SQLException("Trying to use invalid characters at username(admin check):'"+username+"'"); String query = "select privs from users where username like '"+username+"';"; ResultSet result = stmt.executeQuery(query); if(result.next()) { String p = result.getString("privs"); if (p.equalsIgnoreCase("newbie")){x = 1;} else if (p.equalsIgnoreCase("regular")){x = 2;} else if (p.equalsIgnoreCase("champion")){x = 3;} else if (p.equalsIgnoreCase("moderator")){x = 4;} else if (p.equalsIgnoreCase("admin")){x = 5;} } else {} return x; }
7
public static List<Utterance> loadUtterances(String path) { List<Utterance> goldUtterances = new LinkedList<Utterance>(); Scanner input = null; try { System.out.println("Loading utterances from " + path + " ..."); input = new Scanner(new File(path)); goldUtterances = new LinkedList<Utterance>(); // Parse each line as an utterance String line; int lineNum = 0; while (input.hasNextLine()) { // Strip trailing whitespace line = input.nextLine().replaceAll("\\s+$", ""); lineNum++; if (line.length() == 0) { System.err.println("Empty line on input line " + lineNum); continue; } // Add the utterance to gold, returning an error if it could not be parsed try { goldUtterances.add(new Utterance(line, true, false)); } catch (StringIndexOutOfBoundsException e) { System.err.println("Could not parse input line " + lineNum); // Propagate the error as the file is bad throw new FileNotFoundException(); } } } catch (FileNotFoundException e) { return null; } finally { if (input != null) input.close(); } return goldUtterances; }
5
private Rectangle getRectangle(int x, int y, int w, int h, int location) { switch (location) { case SwingConstants.NORTH: return new Rectangle(x + w / 2 - dist / 2, y, dist, dist); case SwingConstants.SOUTH: return new Rectangle(x + w / 2 - dist / 2, y + h - dist, dist, dist); case SwingConstants.WEST: return new Rectangle(x, y + h / 2 - dist / 2, dist, dist); case SwingConstants.EAST: return new Rectangle(x + w - dist, y + h / 2 - dist / 2, dist, dist); case SwingConstants.NORTH_WEST: return new Rectangle(x, y, dist, dist); case SwingConstants.NORTH_EAST: return new Rectangle(x + w - dist, y, dist, dist); case SwingConstants.SOUTH_WEST: return new Rectangle(x, y + h - dist, dist, dist); case SwingConstants.SOUTH_EAST: return new Rectangle(x + w - dist, y + h - dist, dist, dist); } return null; }
8
public boolean healDebuffed(Player p){ int modifier = 0; if(!healReduxImmune(p)){ if(p.status.containsKey(Card.carrionfeast)){ modifier -= 1; } if(p.status.containsKey(Card.wounded)){ modifier -= 1; } if(hallowHarm(p)){ for(Player player: allPlayersInArea(locationArea(p.location))){ if(player.inventory.contains(Card.ravenousketoh)){ modifier -= 1; } } } } if(p.status.containsKey(Card.windwalk)){ modifier += 1; } if(p.status.containsKey(Card.hydrosphere) && hallowHelp(p)){ modifier += 1; } return (modifier < 0); }
9
public static void main(String[] args) { WordReader wordReader = new WordReader("dict.txt"); System.out.println(wordReader.getDictionary()); }
0
private static int getMetaFromString(String idMeta) { String data; if(idMeta.contains(":")) { String[] s = idMeta.split(":"); if(s.length < 2) { data = idMeta.replace(":", ""); } else { data = s[1]; } } else { data = "0"; } return Integer.valueOf(data); }
2
@Override public void deserialize(Buffer buf) { super.deserialize(buf); firstCharacterId = buf.readInt(); firstCharacterCurrentWeight = buf.readInt(); if (firstCharacterCurrentWeight < 0) throw new RuntimeException("Forbidden value on firstCharacterCurrentWeight = " + firstCharacterCurrentWeight + ", it doesn't respect the following condition : firstCharacterCurrentWeight < 0"); firstCharacterMaxWeight = buf.readInt(); if (firstCharacterMaxWeight < 0) throw new RuntimeException("Forbidden value on firstCharacterMaxWeight = " + firstCharacterMaxWeight + ", it doesn't respect the following condition : firstCharacterMaxWeight < 0"); secondCharacterId = buf.readInt(); secondCharacterCurrentWeight = buf.readInt(); if (secondCharacterCurrentWeight < 0) throw new RuntimeException("Forbidden value on secondCharacterCurrentWeight = " + secondCharacterCurrentWeight + ", it doesn't respect the following condition : secondCharacterCurrentWeight < 0"); secondCharacterMaxWeight = buf.readInt(); if (secondCharacterMaxWeight < 0) throw new RuntimeException("Forbidden value on secondCharacterMaxWeight = " + secondCharacterMaxWeight + ", it doesn't respect the following condition : secondCharacterMaxWeight < 0"); }
4
@EventHandler public void onEntityInteract(PlayerInteractEntityEvent event) { if (event.getRightClicked() instanceof StorageMinecart) { Player player = event.getPlayer(); String playerName = player.getName(); if (Configuration.data.contains(playerName) && (Configuration.config.getBoolean("Deny Storage.enabled"))) { if (!(player.isOp() || player.hasPermission("doody.storage"))) { event.setCancelled(true); if (Configuration.config.getBoolean("Deny Storage.messages")) { player.sendMessage(ChatColor.RED + "There's no need to store things while on Duty."); } Debug.check("<onEntityInteract> Success! " + playerName + " got denied storage interact."); } else { if (Configuration.config.getBoolean("Debug.enabled")) { if (player.isOp()) { Debug.normal("<onEntityInteract> Warning! " + playerName + " is OP -Allowing storage interact"); } else if (player.hasPermission("doody.storage")) { Debug.normal("<onEntityInteract> Warning! " + playerName + " has doody.storage -Allowing storage interact"); } else { //It should not have reached here Debug.severe("<onEntityInteract> Another plugin may be causing a conflict. DoOdy Debug cannot make sense."); } } } } } }
9
public void showLine (ListElement line) { ListElement e = TopLine; int h = Leading + Ascent; int totalh = getSize().height - Descent; if (Background == null) Background = getBackground(); int lines = 0; while (lines < PageSize && e != null) { if (e == line) return; h += Leading + Height; e = e.next(); lines++; } if (e == line && TopLine.next() != null) TopLine = TopLine.next(); else TopLine = line; }
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(Game.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Game.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Game.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Game.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 Game().setVisible(true); } }); }
6
public Object saveOps() { Stack state = new Stack(); int pos = currentLine.length(); while (currentBP.parentBP != null) { state.push(new Integer(currentBP.breakPenalty)); /* We don't want parentheses or unconventional line breaking */ currentBP.options = DONT_BREAK; currentBP.endPos = pos; currentBP = currentBP.parentBP; } return state; }
1
public String getRandCode() { return randCode; }
0
public static String getColorFromMagnitudeAndPhase(final double magnitude, final double phase) { if (magnitude <= 1D / Const.MAX_RGB) { return Const.BLACK; } final double mag = Math.min(1D, magnitude); final double pha = (phase < 0D) ? phase + Const.TAU : phase; final double p = (pha * 6D) / Const.TAU; final int range = Double.valueOf(Math.min(5, Math.max(0D, p))).intValue(); final double fraction = p - range; double r = 0D, g = 0D, b = 0D; switch(range) { case 0: r = 1D; g = fraction; b = 0D; break; //Red -> Yellow case 1: r = 1D - fraction; g = 1D; b = 0D; break; //Yellow -> Green case 2: r = 0D; g = 1D; b = fraction; break; //Green -> Cyan case 3: r = 0D; g = 1D - fraction; b = 1D; break; //Cyan -> Blue case 4: r = fraction; g = 0D; b = 1D; break; //Blue -> Magenta case 5: r = 1D; g = 0D; b = 1D - fraction; break; //Magenta -> Red default: throw new IllegalArgumentException("Out of range: " + range); } final int red = Double.valueOf(r * mag * Const.MAX_RGB).intValue(); final int green = Double.valueOf(g * mag * Const.MAX_RGB).intValue(); final int blue = Double.valueOf(b * mag * Const.MAX_RGB).intValue(); return "rgb(" + red + "," + green + "," + blue + ")"; }
8
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { isValueNumeric = false; } if (json.charAt(json.length() - 1) != '{') { json.append(','); } json.append(escapeJSON(key)); json.append(':'); if (isValueNumeric) { json.append(value); } else { json.append(escapeJSON(value)); } }
5
public void updateAll(){ update(); for (GameObject child: children){ child.updateAll(); } }
1
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof SiteBoundary)) { return false; } SiteBoundary other = (SiteBoundary) object; if ((this.featureID == null && other.featureID != null) || (this.featureID != null && !this.featureID.equals(other.featureID))) { return false; } return true; }
5
@SuppressWarnings("serial") ControlPanel(Model model, ModelControl mc, AnimationControl ac) { super(true); this.mControl = mc; this.aControl = ac; stateField.setText(State.STOP.getText()); model.addStateChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(Model.STATE)) { stateField.setText(evt.getNewValue().toString()); } } }); bPanel.add(playButton = new Button(new AbstractAction("Start") { public void actionPerformed(ActionEvent ae) { if (mControl != null) { if (this.getValue(NAME) == "Start") { this.putValue(Action.NAME, "Pause"); mControl.startButtonActionPerformed(ae); aControl.startAnimatorActionPerformed(ae); playButton.setIcon("src\\com\\amoneim\\Images\\pause.png", "src\\com\\amoneim\\Images\\r_pause.png"); } else if (this.getValue(NAME) == "Resume") { this.putValue(Action.NAME, "Pause"); mControl.resumeButtonActionPerformed(ae); aControl.resumeButtonActionPerformed(ae); playButton.setIcon("src\\com\\amoneim\\Images\\pause.png", "src\\com\\amoneim\\Images\\r_pause.png"); } else if (this.getValue(NAME) == "Pause") { this.putValue(Action.NAME, "Resume"); mControl.pauseButtonActionPerformed(ae); playButton.setIcon("src\\com\\amoneim\\Images\\play.png", "src\\com\\amoneim\\Images\\r_play.png"); } else { System.out.println("StartFAIL"); } } } }, "src\\com\\amoneim\\Images\\play.png", "src\\com\\amoneim\\Images\\r_play.png")); bPanel.add(stopButton = new Button(new AbstractAction("Stop") { public void actionPerformed(ActionEvent ae) { if (mControl != null) { mControl.stopButtonActionPerformed(ae); aControl.stopAnimatorActionPerformed(ae); playButton.getAction().putValue(Action.NAME, "Start"); playButton.setIcon("src\\com\\amoneim\\Images\\play.png", "src\\com\\amoneim\\Images\\r_play.png"); } else { System.out.println("StopFail"); } } }, "src\\com\\amoneim\\Images\\stop.png", "src\\com\\amoneim\\Images\\r_stop.png")); init(); }
6
public JSlider setSlider(JPanel panel, int orientation, int minimumValue, int maximumValue, int initValue, int majorTickSpacing, int minorTickSpacing) { JSlider slider = new JSlider(orientation, minimumValue, maximumValue, initValue); slider.setPaintTicks(true); slider.setMajorTickSpacing(majorTickSpacing); slider.setMinorTickSpacing(minorTickSpacing); slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider tempSlider = (JSlider) e.getSource(); if (tempSlider.equals(sliderTransX)) { transX = sliderTransX.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderTransY)) { transY = sliderTransY.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderRotateTheta)) { rotateTheta = sliderRotateTheta.getValue() * Math.PI / 180; canvas.repaint(); } else if (tempSlider.equals(sliderRotateX)) { rotateX = sliderRotateX.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderRotateY)) { rotateY = sliderRotateY.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderScaleX)) { if (sliderScaleX.getValue() != 0.0) { scaleX = sliderScaleX.getValue() / 100.0; canvas.repaint(); } } else if (tempSlider.equals(sliderScaleY)) { if (sliderScaleY.getValue() != 0.0) { scaleY = sliderScaleY.getValue() / 100.0; canvas.repaint(); } } } }); panel.add(slider); return slider; }
9
public <T extends Comparable<? super T>> int search(T[] array, T key) { if (array == null) throw new NullPointerException("argument array is null"); if (key == null) throw new NullPointerException("argument key is null"); // Make sure every element is not null. for (T elem: array) { if (elem == null) throw new NullPointerException("All elements must not be null"); } // Make sure the array is sorted. if (!Util.isSorted(array)) throw new IllegalArgumentException(getClass().getSimpleName() + " argument array is not sorted"); int lo = 0; int hi = array.length - 1; while (lo <= hi) { // Key is in a[lo..hi] or not present. int mid = lo + (hi - lo) / 2; if (key.compareTo(array[mid]) < 0) hi = mid - 1; else if (key.compareTo(array[mid]) > 0) lo = mid + 1; else return mid; } return -1; }
9
public View() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int screenWidth = (int) dim.getWidth() / 2; int screenHeight = (int) dim.getHeight() / 2; setLocation(screenWidth/2, screenHeight/2); container = this.getContentPane(); setSize(screenWidth, screenHeight); autorize=new JButton("Autorize"); send=new JButton("Send"); port=new JLabel("Port"); adress=new JLabel("Host"); name=new JLabel("Name"); port1=new JTextField(10); adress1=new JTextField(10); name1=new JTextField(10); message=new JTextField(10); JTextArea memo=new JTextArea(20,10); cardPane=new JPanel(); chatPane=new JPanel(); gamePane=new JPanel(); autorizePane =new JPanel(); //autorize Panel autorizePane.add(port); autorizePane.add(port1); autorizePane.add(adress); autorizePane.add(adress1); autorizePane.add(name); autorizePane.add(name1); autorizePane.add(autorize); //chat Panel chatPane.add(memo); chatPane.add(message); chatPane.add(send); //grouping group=new JPanel(); group.add(cardPane); group.add(chatPane); //container container.add(gamePane); container.add(group); container.add(autorizePane); //Layouts group.setLayout(new GridLayout(1,2)); //colors cardPane.setBackground(Color.LIGHT_GRAY); gamePane.setBackground(Color.ORANGE); }
0
private void preloadCountryHistory() { GenericObject hist; String tag; final GenericObject countries = EUGFileIO.load(resolver.resolveFilename("common/countries.txt"), settings); for (ObjectVariable def : countries.values) { tag = def.varname; hist = historyCache.get(tag); if (hist == null) { String histFile = resolver.getCountryHistoryFile(tag); if (histFile == null) { // System.err.println("Cannot find country history file for " + tag); continue; } hist = EUGFileIO.load(histFile, settings); if (hist == null) { System.err.println("Failed to load country history file for " + tag); } else { historyCache.put(tag, hist); } } } }
4
private static char[] getReplacementChars(char ch) { char[] replacement = null; if (ch == '"') { replacement = QUOT_CHARS; } else if (ch == '\\') { replacement = BS_CHARS; } else if (ch == '\n') { replacement = LF_CHARS; } else if (ch == '\r') { replacement = CR_CHARS; } else if (ch == '\t') { replacement = TAB_CHARS; } else if (ch == '\u2028') { replacement = UNICODE_2028_CHARS; } else if (ch == '\u2029') { replacement = UNICODE_2029_CHARS; } else if (ch >= CONTROL_CHARACTERS_START && ch <= CONTROL_CHARACTERS_END) { replacement = new char[]{'\\', 'u', '0', '0', '0', '0'}; replacement[4] = HEX_DIGITS[ch >> 4 & 0x000f]; replacement[5] = HEX_DIGITS[ch & 0x000f]; } return replacement; }
9
private void reduceHighestTrack(){ int[] highTrack=null; int position=0; //calcul the highest track while(highTrack==null){ if(model.getThrone()[position]==family.getPlayer()){ highTrack=model.getThrone(); }else if (model.getCourt()[position]==family.getPlayer()){ highTrack=model.getCourt(); }else if (model.getFiefdoms()[position]==family.getPlayer()){ highTrack=model.getFiefdoms(); } } //move the player two position below if(position<highTrack.length-1){ highTrack[position]=highTrack[position+1]; if(position<highTrack.length-2){ highTrack[position+1]=highTrack[position+2]; highTrack[position+2]=family.getPlayer(); }else highTrack[position+1]=family.getPlayer(); } }
6
public static void saveGame() { try { File save = new File(CFG.DIR, "saves/" + new SimpleDateFormat("'Spielstand' dd.MM.yyyy HH-mm-ss").format(new Date()) + ".save"); save.createNewFile(); JSONObject o = new JSONObject(); o.put("version", CFG.VERSION); o.put("created", Game.currentGame.worldCreated); o.put("width", Game.world.width); o.put("height", Game.world.height); o.put("tile", new BASE64Encoder().encode(Compressor.compressRow(Game.world.getData()))); o.put("resources", Game.currentGame.resources.getData()); o.put("researches", Game.currentGame.researches); o.put("wave", WaveManager.wave); o.put("time", WaveManager.nextWave); JSONArray entities = new JSONArray(); for (Entity e : Game.world.entities) { if ((e instanceof Forester) || (e instanceof Woodsman)) continue; // don't save them, because they get spawned by the house upgrades entities.put(e.getData()); } o.put("entities", entities); Compressor.compressFile(save, o.toString()); // Helper.setFileContent(new File(save.getPath() + ".debug"), o.toString()); Game.currentGame.state = 3; JOptionPane.showMessageDialog(Game.w, "Spielstand erfolgreich gespeichert.", "Speichern erfolgreich", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { e.printStackTrace(); } }
4
public void setHeightWidthStartPosition(String height,String width,String startPosDescriptor) { this.height=Integer.parseInt(height); this.width=Integer.parseInt(width); int p1=startPosDescriptor.indexOf(','); int p2=startPosDescriptor.indexOf(',',p1+1); VehicleState p=new VehicleState(Integer.parseInt(startPosDescriptor.substring(0,p1)), Integer.parseInt(startPosDescriptor.substring(p1+1,p2))); switch(startPosDescriptor.charAt(p2+1)) { case 'l': case 'L': p.setAngle(270); break; case 'r': case 'R': p.setAngle(90); break; case 'u': case 'U': p.setAngle(0); break; case 'd': case 'D': p.setAngle(180); break; default: throw new IllegalArgumentException("Landscape start position, incorrect value:"+startPosDescriptor.charAt(p2)); } this.startPos=p; }
8
@Test public void tenProcessos() { SoSimProcess[] processes = new SoSimProcess[]{ new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1), new SoSimProcess(PcbColor.GRAY,1)}; cobaia = new SoSimTestSimulation(); try{ for(SoSimProcess p : processes){ cobaia.createProcess(p); } }catch(PcbQueueFullException ex){ Assert.fail(); } for(int i = 0; i< 12; i++){ cobaia.incrementSimulationClock(); System.out.println(cobaia); } }
3
public static void main(String [] args) { //new MessageShower("Hello java!").showStars(); // MessageShower messageShower = new StarMessageShower("Hello hello Java!"); // messageShower.show(); StringListener stringListener = new StringListener(); showMessage(new NumberMessageShower("What is your name?", new InputNameListener())); showMessage(new DotMessageShower("What is your age?",new InputAgeNumberListener())); //showMessage(new DotMessageShower("Hello hello Java!cfhfchdh")); }
0
@Override public Geometry getGeometry() { if(geometry!=null){ return geometry; } render(); GeometryFactory gf = Helper.getGeometryFactory(); Geometry[] geometries = new Geometry[textPath.getNumberOfChars()]; LinkedList<Point> characterCentroids = new LinkedList<Point>(); for(int charnum=0; charnum<textPath.getNumberOfChars(); charnum++){ try { SVGRect textBox = textPath.getExtentOfChar(charnum); Coordinate[] labelCorners = new Coordinate[5]; labelCorners[0] = new Coordinate(textBox.getX(), textBox.getY()); labelCorners[1] = new Coordinate(textBox.getX() + textBox.getWidth(), textBox.getY()); labelCorners[2] = new Coordinate(textBox.getX() + textBox.getWidth(), textBox.getY() + textBox.getHeight()); labelCorners[3] = new Coordinate(textBox.getX(), textBox.getY() + textBox.getHeight()); labelCorners[4] = labelCorners[0]; geometries[charnum]=gf.createPolygon(gf.createLinearRing(labelCorners), null); characterCentroids.add(geometries[charnum].getCentroid()); } catch (DOMException e){ throw new FalloffException("Label longer than space available along line", e); } } // Fail for labels in tight bends if(characterCentroids.size()>2){ Point firstPoint = characterCentroids.getFirst(); Point secondPoint = characterCentroids.get(1); double lastAngle = (180*Math.atan((secondPoint.getY()-firstPoint.getY())/(secondPoint.getX()-firstPoint.getX())))/Math.PI; for(int pointIter=1; pointIter<characterCentroids.size()-1; pointIter++){ firstPoint = characterCentroids.get(pointIter); secondPoint = characterCentroids.get(pointIter+1); double currentAngle = (180*Math.atan((secondPoint.getY()-firstPoint.getY())/(secondPoint.getX()-firstPoint.getX())))/Math.PI; if(Math.abs(lastAngle-currentAngle)>80){ throw new TightBendException("Label occurred in tight bend."); } } } GeometryCollection gc = gf.createGeometryCollection(geometries); geometry = gc.convexHull(); return geometry; }
6
@Override public void writeTo(WordWriter out) throws IOException { int opword = opcode.getCode(); if(opcode.isBasic()) { opword |= (valueA.evaluate() << 4) | (valueB.evaluate() << 10); } else { opword |= (valueA.evaluate() << 10); } out.writeWord(opword); if(valueA.hasNextWord()) valueA.getData().writeTo(out); if(opcode.isBasic() && valueB.hasNextWord()) valueB.getData().writeTo(out); }
4
public void invert() { invertedBevoreMoves = 0; List<SchlangenGlied> glieder = new ArrayList<SchlangenGlied>(); addAllGlieder(glieder); while (glieder.size() > 1) { SchlangenGlied firstGlied = glieder.get(0); SchlangenGlied lastGlied = glieder.get(glieder.size() - 1); Point tmpLocation = firstGlied.getLocation(); firstGlied.setLocation(lastGlied.getLocation()); lastGlied.setLocation(tmpLocation); glieder.remove(firstGlied); glieder.remove(lastGlied); } }
1
public void paint(Graphics g) { g.drawString("MissileNum:" + Integer.toString(mls.size()), 50, 50); g.drawString("Tanks Num:" + Integer.toString(tkEnemys.size()), 50, 70); g.drawString("Bombs Num:" + Integer.toString(bombs.size()), 50, 90); tk.draw(g); for(int i=0; i<tkEnemys.size(); i++) { tkEnemys.get(i).draw(g); } for(int i=0; i<mls.size(); i++) { for(int j=0; j<tkEnemys.size(); j++) { mls.get(i).hitTank(tkEnemys.get(j)); } mls.get(i).draw(g); } // System.out.println(bombs.size()); for(int i=0; i<bombs.size(); i++) { bombs.get(i).draw(g); } }
4
private static Device getDevice (String portId) throws IOException { try { Device dev = HostFactory.getHost ().getDevice (portId); if (isFX2 (dev)) return dev; } catch (IllegalArgumentException e) { } System.err.println ("no such FX2 device: " + portId); return null; }
2
public Worker getAvailableByActivityAndStatus ( int activityId , String status ) { Connection con = null; PreparedStatement statement = null; ResultSet rs = null; Worker worker = null; try { con = ConnectionManager.getConnection(); String searchQuery = "SELECT workers.id, workers.status, workers.local_ip, workers.public_ip, workers.instance_id, workers.is_manager, workers.last_time_worked, workers.last_time_alive FROM workers, installations " + "WHERE workers.id = installations.workerId AND installations.activityId = ? " + "AND installations.status = 'installed'" + "AND workers.status = ?"; statement = con.prepareStatement(searchQuery); statement.setInt(1, activityId ); statement.setString(2, status ); rs = statement.executeQuery(); while (rs.next()) { worker = new Worker(); worker.setId( rs.getInt("id") ); worker.setStatus( rs.getString("status") ); worker.setLocalIp( rs.getString("local_ip") ); worker.setPublicIp( rs.getString("public_ip") ); worker.setInstanceId( rs.getString("instance_id") ); worker.setManager( rs.getBoolean("is_manager") ); worker.setLastTimeWorked( rs.getTimestamp("last_time_worked")); worker.setLastTimeAlive( rs.getTimestamp("last_time_alive")); } } catch (SQLException e) { e.printStackTrace(); error = e.toString(); } finally { if (rs != null) { try { rs.close(); } catch (Exception e) { System.err.println(e); } rs = null; } if (statement != null) { try { statement.close(); } catch (Exception e) { System.err.println(e); } statement = null; } if (con != null) { try { con.close(); } catch (Exception e) { System.err.println(e); } con = null; } } return worker; }
8
@Before public void setUp() throws IOException { outputStream = new ByteArrayOutputStream(); world4x4 = worldFactory.createWorld(cells4x4); StringBuilder expected = new StringBuilder(""); for (int i = 0; i < world4x4.getWidth(); i++) { for (int j = 0; j < world4x4.getHeight(); j++) { expected.append(cells4x4[i][j] == Cell.LIVING ? LIVING_CELL : DEAD_CELL); } if (i + 1 != cells4x4.length) { expected.append(LINE_SEPARATOR); } } world4x4String = expected.toString(); worldFile = folder.newFile("worldFile"); }
4
@SuppressWarnings("unchecked") private JPanel createPlaySelectPanel() { JPanel productionNamePanel = new JPanel(); double size[][] = { { TableLayout.PREFERRED, 20, TableLayout.PREFERRED }, { 30, 30 } }; TableLayout layout = new TableLayout(size); productionNamePanel.setLayout(layout); productionNamePanel.add(new JLabel("Bitte wählen Sie ein Stück aus:"), "0,0"); playSelect = new JComboBox<TheaterPlay>(); playSelect.setRenderer(new PlayComboRederer()); for (TheaterPlay play : ShowGoDAO.getShowGo().getPlays()) { playSelect.addItem(play); } for (Production production : ShowGoDAO.getShowGo().getProductions()) { playSelect.addItem(production.getPlay()); } final JButton usePlayAction = new JButton("Stück und Ensemble verwenden"); usePlayAction.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (playSelect.getSelectedItem() != null) { TheaterPlay copy = null; try { copy = ParseUtil.copyPlay((TheaterPlay) playSelect.getSelectedItem()); } catch (JAXBException e1) { log.error("", e1); } catch (IOException e1) { log.error("", e1); } if (copy == null) { JOptionPane.showMessageDialog(mainWindow, "Es ist ein Problem beim Kopieren des Stücks aufgtreten. Für weitere Informationen s. das Logfile", "Fehler", JOptionPane.ERROR_MESSAGE); return; } model.setPlay(copy); usePlayAction.setEnabled(false); playSelect.setEnabled(false); ensembleSelect.setEnabled(false); Ensemble selectedEnsemble = (Ensemble) ensembleSelect.getSelectedItem(); CastingGenerator.generateCasting(selectedEnsemble, copy); castSelectionPanel = new CastSelectionPanel(mainWindow, copy.getRoles(), selectedEnsemble.getMembers(), "Besetzung der Darstellerrollen", false); editPlayPanel = new EditTheaterPlayPanel(mainWindow, copy); editPlayPanel.getRoleDisplay().addRoleDeleteEventListener(castSelectionPanel); editPlayPanel.addRoleDeleteListener(castSelectionPanel); nonActorSelection = createNonActorPersonAssignment(); JPanel submitPanel = createSubmitPanel(); add(castSelectionPanel, "1,4"); add(nonActorSelection, "1,5"); add(editPlayPanel, "1,6"); add(submitPanel, "1,7"); revalidate(); repaint(); } } }); productionNamePanel.add(playSelect, "0,1,f,c"); productionNamePanel.add(usePlayAction, "2,1,c,c"); return productionNamePanel; }
6
public BoardGameItem(Board board, Controller controller) { super(); for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { CaseItem b = new CaseItem(board.getCase(i,j)); board.getCase(i,j).addObserver(b); b.addActionListener(controller); cases.add(b); b.setPreferredSize(new Dimension(ViewConstante.CASE_HEIGHT, ViewConstante.CASE_HEIGHT)); board.getCase(i, j).addObserver(b); } } for(Pion p: board.getAvailablePions()) { PionItem b=new PionItem(p); p.addObserver(b); b.addActionListener(controller); b.addMouseListener(controller); pions.add(b); b.setPreferredSize(new Dimension(60, 60)); } setLayout(new BorderLayout()); grille=new BoardItem(); for(CaseItem b : cases) grille.add(b); add(grille,BorderLayout.CENTER); list=new PositionPionItem(); for(PionItem b : pions) list.add(b); add(list,BorderLayout.SOUTH); enableCase(false); this.setVisible(true); }
5
public void searchPacientebyProntuario() { facesContext = FacesContext.getCurrentInstance(); requestContext = RequestContext.getCurrentInstance(); try { listProntuario = genericDAO.searchObject(Prontuario.class,"prontuario",null, null, new String[]{"cliente", "unidade", "pront_numeracao"}, new Object[]{clienteSelecionado, prontuario.getUnidade(), prontuario.getPront_numeracao()}); if (listProntuario.isEmpty()) { facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Alerta!", "Esse paciente não tem nenhum prontuario cadastrado")); } else if (listProntuario.size() == 1) { prontuario = listProntuario.get(0); clienteSelecionado = prontuario.getCliente(); requestContext.execute("PF('dialogPaciente').show();"); } else { listCliente = new ArrayList<>(); for (Prontuario newProntuario : listProntuario) { listCliente.add(newProntuario.getCliente()); } requestContext.execute("PF('dialogTable').show();"); } } catch (Exception ex) { Logger.getLogger(BuscarPacienteMB.class.getName()).log(Level.SEVERE, null, ex); } }
4
public int getDPadY() { int povValue = joystick.getPOV(); if (povValue == 0 || povValue == 45 || povValue == 315){ return 1; } else if (povValue == 90 || povValue == 270 || povValue == -1){ return 0; } else { return -1; } }
6