text
stringlengths
14
410k
label
int32
0
9
public void info(Object... objs) { if (LoggingLevel.INFO.value >= currentGlobalLoggingLevel.value) { logger.info(Helpers.concat(objs)); } }
1
@Override public void finishSpringing(MOB target) { if((!invoker().mayIFight(target))||(target.phyStats().weight()<5)) target.location().show(target,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> float(s) gently into the pit!")); else { target.location().show(target,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> hit(s) the p...
8
@Override public void run() { startTime = System.currentTimeMillis(); while(isMatch){ if(!isPaused){ invokeTricks(); spawnEnemies(); checkPoints(); moveAll(); fireMissiles(); fireEnemiesLasers(); collisionCheck(); cheatCheck(); set...
3
static int f(int i,int j){ if(i==j)return 0; if(mem[i][j]>0)return mem[i][j]; int min=MAX_VALUE-1000000; for(int k=(i+1)%N;k!=(j+1)%N;k=(k+1)%N){ int val1,val2; if(k-1>=i)val1=sums[k-1]-(i>0?sums[i-1]:0); else val1=sums[N-1]-sums[i-1]+(k>0?sums[k-1]:0); if(j>=k)val2=sums[j]-(k>0?sums[k-1]:0); els...
8
public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new FileReader(args[0])); BufferedWriter bw = new BufferedWriter(new FileWriter("corpus.txt")); String temp; StringBuffer sb = new StringBuffer(); while(...
4
public static int[] getChuk(int x,int z){ int[] res = new int[2]; res[0] = (int)(x / 16.0); res[1] = (int)(z / 16.0); return res; }
0
public boolean hasStance(String playerName, String targetName) { boolean stance = false; if (playerName.equalsIgnoreCase(targetName)) return true; String SQL = "SELECT *" + " FROM " + tblStances + " WHERE `player` LIKE ?" + " AND `target` LIKE ?"; // boolean found = false; try { Connection con = getS...
3
@Override public boolean equals(Object o ) { if(o == null) return false; if(!(o instanceof Bauteil)) return false; Bauteil b = (Bauteil)o; if(b.getNr() != this.getNr()) return false; if(!b.getName().equals(this.getName())) r...
5
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (hasFocus && table.isCellEditable(row, column)) return l; i...
3
@Override public void move (Fleet fleet) { Field playField = null; board.setQuality(fleet); Collections.sort(remainingFields); if (preferableFields.isEmpty() || statusChanged) { if (statusChanged) { statusChanged = false; preferableFields.clear(); } //System.out.println("random zet"); playF...
7
public String getGoogleMapsXMLQuery(GeoAdresse pAdresse) throws UnsupportedEncodingException { // http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true // Removes whitespace between a word character and . or , String pattern = "(\\s+)";...
7
private void asetaVKuva() { if (noppa == 2 || noppa == 3){ ImageIcon skelly = new ImageIcon(new ImageIcon(getClass().getResource("/skellyface.jpg")).getImage()); setIcon(skelly); } else if (noppa == 4 || noppa == 5){ ImageIcon orkki = new ImageIcon(new ImageIcon(getCl...
5
public SwingWorker getTask() { return task; }
0
public final synchronized double readDouble(){ this.inputType = true; String word=""; double dd=0.0D; if(!this.testFullLineT) this.enterLine(); word = nextWord(); if(!eof)dd = Double.parseDouble(word.trim()); ...
2
public Vec3D getSkyColor(Entity par1Entity, float par2) { float var3 = this.getCelestialAngle(par2); float var4 = MathHelper.cos(var3 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; if (var4 < 0.0F) { var4 = 0.0F; } if (var4 > 1.0F) { var4 = ...
6
private int countConfs(int numMutable, int numRes, /*boolean ligPresent,*/ int strandMut[][], int numRotForRes[], int numRotForResNonPruned[]){ int numTotalRotRed = 0; numConfsTotal = BigInteger.valueOf(1); numConfsAboveLevel = new BigInteger[numRes]; int curNumRot; //Store the number of rotamers f...
7
private boolean findNewCombinations(Combination combination) { boolean somethingChanged = false; Combination newCombination = null; for (int i = 0; i < combination.pitchers.size(); i++) { // ***** leerkippen if (combination.pitchers.get(i).isNotEmpty()) { newCombination = combination.clone(); newCo...
8
public void updateBookText(Player p, ItemStack item) { ItemStack i = item == null ? p.getItemInHand() : item; if(!i.getType().equals(Material.WRITTEN_BOOK)) return; if(!i.getItemMeta().hasDisplayName()) return; if(!i.getItemMeta().getDisplayName().equals(ConfigHandler.prayItemName)) return; if(!(i.getItem...
8
private static void chiSquareTestOnFile(Path path, HashFunction func) { Vector<Double> values = new Vector<Double>(); for (String w : new WordReader(path)) values.add((double) func.hashString(w) ); // Convert the Vector<Double> into an array of doubles int i = 0; double[] tab = new double[values.size()]; ...
3
private void loadPreviousFonts() { this.previousFonts = new ArrayList<Font>(); for (int i = this.startFrom; i <= this.endAt; i++) { this.previousFonts .add(this.document.getChildren().get(i).getFont()); } }
1
private void saveResults() throws ClusterException { ObjectFactory obf= new ObjectFactory(); ClusterDataType cdt= obf.createClusterDataType(); //set the creation date try { cdt.setXMLFileCreation(DateConverter.CurrentDateToXMLGregorianCalendar()); } catch (DateConverterException e) { throw new...
7
@Override public CuentaBancaria findByCodigo(String CodigoCuentaCliente) { Session session = sessionFactory.openSession(); session.beginTransaction(); Query query = session.createQuery("SELECT cuentaBancaria FROM CuentaBancaria cuentaBancaria WHERE cuentaBancaria.sucursalBancaria.codigoSucu...
2
public Direction getOpposite() { switch (this) { case BOTTOM: return TOP; case LEFT: return RIGHT; case RIGHT: return LEFT; case TOP: return BOTTOM; case CENTER: default: return null; } }
5
@Override public void modifyGenAbility(MOB mob, Ability me, int showFlag) throws IOException { if(mob.isMonster()) return; boolean ok=false; if((showFlag == -1) && (CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0)) showFlag=-999; while((mob.session()!=null)&&(!mob.session().isStopped())&&(!ok)) { int s...
9
public static boolean fileprocess(String downloadpath, String filepath, String []paras, String sn){ int errorcode=0;// print error code in the final output file; int errornum=17; // feature number String result=""; File downloadfile_r = new File(downloadpath+"\\emmc_test.txt"); File outputfile = new Fi...
6
private static boolean handleTrue(String string) { switch (string.toLowerCase()) { case "on": case "true": case "yes": case "enable": return true; } // Otherwise if something is wrong, just assume we need it return false; }
4
public boolean ColliderWithPodiumUp(){ if((x>=0 && x<=Podium.WIDTH - WIDTH/2) && (y<=GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp- HEIGHT/1.2 && y>= GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp- HEIGHT)){ return true; } if((x>=GameMain.GAME_WIDTH + WIDTH/2 - Podium.WI...
8
@Override public void insertNext(T i, T j) { if (j.getParent() != null) throw new PromiscuousItemException(j, i.getParent()); if ((j.getNext() != null) || (j.getPrev() != null)) throw new PromiscuousItemException(j); if (i == null) { // insert as head j.setPrev(null); j.setNext(_firstItem); j....
8
public ClueGame(String layout, String legend) { layoutFile = layout; legendFile = legend; try { board = new Board(layoutFile); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BadConfigFormatException e) { // TODO Auto-generated catch block e....
2
public void makeThreeSamplesRandomized() { samples.clear(); samples.add(new ArrayList<Integer>()); samples.add(new ArrayList<Integer>()); samples.add(new ArrayList<Integer>()); int countInitialSample = datas.size(); int countTrainingSample = (int) (countInitialSample * p...
4
@Override public void onTurnStarted(TurnStartedEvent e) { if(missile != null && !missile.isActive()) { missile = null; } }
2
private void configFindExtension(Method method) throws DaoGenerateException { MongoLimit mongoLimit = method.getAnnotation(MongoLimit.class); if (mongoLimit != null && mongoLimit.value() != -1) { limit = mongoLimit.value(); } MongoSkip mongoSkip = method.getAnnotation(MongoSkip.class); if (mongoSkip != nu...
6
private String replaceDate(final String log) { String formattedLog = new String(log); String regex = "(.*)(%d\\{)([^\\}]*)(\\})(.*)"; Date date = new Date(); while (formattedLog.matches(regex)) { String pattern = formattedLog.replaceFirst(regex, "$3"); SimpleDateFormat format = new SimpleDateFormat(patter...
1
@Override public void update(Observable o, Object arg) { if (presenter.getState().getStatus().equals("Rolling") && presenter.isPlayersTurn() && !timerStarted) { rollView.showModal(); rollView.startTimer(); timerStarted = true; } }
3
@EventHandler public void onSignDestroy(BlockBreakEvent e) { if(e.isCancelled()) return; Player p = e.getPlayer(); for(ServerSign rs : ServerSigns.getInstance().getSigns()) { if(rs.getSignLocation().getBlockX() == e.getBlock().getLocation().getBlockX()) { if(rs.getSignLocation().getBlockY() == e.getBlo...
9
@Override protected void setzeZustand(Graphics2D g) { if ((this.zMuster == 2) && (this.zFarbe.getTransparency() != 3)) { this.zFarbe = new Color(this.zFarbe.getRed(), this.zFarbe.getGreen(), this.zFarbe.getBlue(), 128); } else if ((this.zMuster != 2) && (this.zFarbe.getTransparency() !=...
6
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); Campaign camp = (Campaign) session.get("campa"); CampaignDevice campdev = new CampaignDevice(camp, getPlatform()); getMyDao().getDbsession().sa...
3
public static int guessAWTFontStyle(String name) { name = name.toLowerCase(); int decorations = 0; if (name.indexOf(AWT_STYLE_BOLD_ITAL) > 0 || name.indexOf(AWT_STYLE_DEMI_ITAL) > 0) { decorations |= java.awt.Font.BOLD | java.awt.Font.ITALIC; } else if (name.i...
7
public void saveProjectAs(LayeredPanelList panelListIn){ fc = new JFileChooser(strProjectsDir); fc.showSaveDialog(compParent); try{ if(fc.getSelectedFile() != null){ this.strCurrentProject = fc.getSelectedFile().toString(); FileOutputStream fos = new ...
2
public List<String> getBestViterbiPath() { Iterator<String> myIt=ViterbiEndpoint.keySet().iterator(); String myStr, bestStr=""; double bestVal=0; boolean entered=false; while (myIt.hasNext()) { myStr=myIt.next(); if (!entered || bestVal< ViterbiEndpoint.get(myStr)) {bestVal=ViterbiEndpoint.get(myS...
4
public boolean isSurroundClicked(int x, int y) { //first check the square is actually non-mine if (board[x][y].isMine()) return false; //the square must also have at least 1 adjacent mine for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { //position must exist, and we don't co...
7
private boolean delete(int i) { checkInvariants(); final E[] elements = this.elements; final int mask = elements.length - 1; final int h = head; final int t = tail; final int front = (i - h) & mask; final int back = (t - i) & mask; // Invariant: head <= i < tail mod circularity if (front >= ((t - h) & mask)...
4
public void addAbsenta(SituatieMaterieBaza sit, Node node) { TipAbsenta tip = null; Date data = null; NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node cNode = childNodes.item(i); if (cNode instanceof Element) { String content = cNode.getLastChild().ge...
8
private static Collection<Word> readWords(File file) throws IOException{ String ruWord = ""; String engWord = ""; String line; BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); Collection<Word> lWord = new ArrayList<Word>(); ...
4
protected void forkJavaVM(String[] args) throws MojoExecutionException { try { final Commandline commandLine = new Commandline(); commandLine.setExecutable(getJavaExecutable().getAbsolutePath()); commandLine.setWorkingDirectory(workingDirectory.getAbsolutePath());...
2
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
protected void awaitTermination() { try { this.completionLatch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
1
@Override public String toString() { StringBuilder sb = new StringBuilder(); // Top line sb.append('+'); for (int x = 0; x < width; ++x) { sb.append("-+"); } sb.append('\n'); // Other lines for (int y = 0; y < height; ++y) { sb.append('|'); // Row content for (int x = 0; x < width; ++x) ...
9
public boolean collectCourseInfo() { courseInfo.clear(); for (int i = 0; i < typeInfo.size(); i++) { int rowPoint = 0; while (true) { String line = ""; for (int j = 0; j < 5; j++) { String cell = null; if (couTable[i].getValueAt(rowPoint, j) == null || couTable[i].getValueAt(rowPoint,...
7
public void tick() { if (inputDelay > 0) inputDelay--; else if (input.attack.clicked || input.menu.clicked) { game.setMenu(new TitleMenu()); } }
3
@Override public V put(K key, V value) { V oldValue = null; int index = Math.abs(key.hashCode()) % SIZE; if(buckets[index] == null) { buckets[index] = new LinkedList<MapEntry<K, V>>(); } LinkedList<MapEntry<K, V>> bucket = buckets[index]; MapEntry<K, V> ...
5
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item I=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_UNWORNONLY); if(I==null) return false; if(((I.material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_VEGETATIO...
7
public static LvalExpression addTempLocalVar(String name, Type type) { LvalExpression lvalExp = vars.getVar(name); if (lvalExp == null) { Lvalue lvalue = new VarLvalue(new Variable(name, type), false); vars.add(lvalue, false); lvalExp = vars.getVar(name); // add only the bit variables Vector<Lvalue...
4
public static ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) { ArrayList<ArrayList<Integer>> resultLists = new ArrayList<ArrayList<Integer>>(); if (root == null) { return resultLists; } Stack<TreeNode> currentLevel = new Stack<TreeNode>(); currentLevel.push(root); while (!currentLevel.isEmpty())...
6
public ArrayList<RentTransaction> getAllRentTransaction(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<RentTransaction> rentTran...
9
private HashMap<String, Integer> NGramTiling(ArrayList<String> parsedSnippets) { HashMap<String, Integer> term_Freq_Map = new HashMap<String, Integer>(); String split[] = null; String complete = ""; //split into individual words for(String list_item: parsedSnippets){ complete = complete + " " + list_item...
8
public double square() throws TypeOverflowException { double p = perimeter(); p /= 2; double s = p; try { Iterator<Line> it = lineIterator(); while(it.hasNext()) { s *= p - it.next().distance(); } } catch (OverflowException e) { throw new TypeOverflowException(); } if (Double.isInfi...
4
public CommandHandler getCommandHandler() { return commands; }
0
public static void main(String[] args) { // TODO code application logic here long NOK = 2; for (int i = 3; i < 21; i++) { NOK = Evclid(NOK, i); } System.out.println(NOK); }
1
@Override public String toString() { return "LABEL " + label; }
0
public int popAt(int i) { if (stacks.size() == 0) return Integer.MIN_VALUE; if (stacks.get(i).isEmpty()) { stacks.remove(i); current--; return Integer.MAX_VALUE; } int elem = stacks.get(i).pop(); if (stacks.get(i).isEmpty()) { stacks.remove(i); current--; } return elem; }
3
public void setCHST(int nr, boolean value) { switch(nr){ case(1): if (value) CHST1.setBackground(Color.red); else CHST1.setBackground(Color.green); break; case(2): if (value) ...
6
@Id @Column(name = "name") public String getName() { return name; }
0
@Override public Clip getSoundClip(ActionResult actionResult) { if (moveClip == null) { moveClip = openClip(WavPlayer.SOUND_MOVE); } if (treasureClip == null) { treasureClip = openClip(WavPlayer.SOUND_TREASURE); } if (winClip == null) { ...
9
private void checkStatementMap() throws DataException { for (final Map.Entry<Statement, Statement> statementEntry: statementMap.entrySet()) { final Statement parameterStatement = statementEntry.getKey(); final Statement statement = statementEntry.getValue(); final Matcher matcher = expressionFactory.createMa...
9
private void contactServer(InetAddress server, Transition transition) { Socket socket = null; try { socket = new Socket(server, Statics.INTER_SERVER_COM_PORT); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); out.flush(); ObjectInputStream in = new ObjectInputStream(socket.getI...
6
protected void notifyReceivedHandlers(Message message, IMessageReceivedHandler caller) { if (receivedHandlers.size() > 0) for(IMessageReceivedHandler imrh: receivedHandlers) if (imrh != caller){ try{ imrh.onMessageReceived(message); } catch(Exception e){ } } }
4
@Override public String getToolTipText(MouseEvent e) { String tip = getSelectionCellsHandler().getToolTipText(e); if (tip == null) { Object cell = getCellAt(e.getX(), e.getY()); if (cell != null) { if (hitFoldingIcon(cell, e.getX(), e.getY())) { tip = mxResources.get("collapse...
5
private static void growSeedAdd(Cluster cluster, Map<String, ArrayList<String>> adjList, Set<String> seedsToProcess) { List<String> borderMembList = ClusterServices.getBordMemb(adjList, cluster); Queue<String> nodesToTryBorder = new LinkedList<>(); nodesToTryBorder.addAll(borderMembList); while (!nodesT...
6
public void remove(int i, int j) throws BadLocationException { int k = getSelectionStart(); if (k > 0) k--; String s = getMatch(getText(0, k)); if (!isStrict && s == null) { super.remove(i, j); } else { super.remove(0, getLength()); super.insertString(0, s, null); } try { setSel...
4
private void showMatchingBodyparts(UpgradeType type){ this.bodypartPanel.removeAll(); ArrayList<BodyPart> bodyparts = this.game.getUpgradeManager().getBodypartsByType(type); for(BodyPart b : bodyparts){ BodypartIconPanel bpip = new BodypartIconPanel(b); bpip.addMouseListener(this); if(b.isUsed()){ ...
2
public static final void populateConfigData (AnalyticsConfigData data) { data.setEncoding(System.getProperty("file.encoding")); String region = System.getProperty("user.region"); if (region == null) { region = System.getProperty("user.country"); } data.setUserLanguage...
7
public void validate(Property terminologyProperty) { if (this.type != null && !this.type.isEmpty()) { if (!this.type.equalsIgnoreCase(terminologyProperty.getType())) { logger.warn("Value type (" + this.type + ") does not match the one given in the terminology(" ...
9
private void toggleRemoveSelection(TreePath path){ Stack<TreePath> stack = new Stack<TreePath>(); TreePath parent = path.getParentPath(); while(parent!=null && !isPathSelected(parent)){ stack.push(parent); parent = parent.getParentPath(); } if(parent!=null...
7
public void setCam(int xCam, int yCam) { xCam /= distance; yCam /= distance; int xCamD = this.xCam - xCam; int yCamD = this.yCam - yCam; this.xCam = xCam; this.yCam = yCam; g.setComposite(AlphaComposite.Src); g.copyArea(0, 0, width, height, xCamD, yCamD); if (xCamD < 0) { if (xCamD < -width) x...
8
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { //Do nothing } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); states = temp.allActions(state, card, time); }...
3
private void volgendeOnderdeel() throws IOException { spel.volgendeOnderdeel(); huidigeOnderdeel = spel.getHuidigeOnderdeel(); if (huidigeOnderdeel != null) { middenvlak.removeAll(); ImagePanel plaatje = new ImagePanel(huidigeOnderdeel.getPlaatje()); plaatje.setBorder(new EtchedBorder(EtchedBorder.RAISE...
1
public WeaponList() { setTitle("Weapon List"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setBounds(100, 100, 325, 500); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLa...
2
public synchronized DataInputStream getChunkDataInputStream(int var1, int var2) { if(this.outOfBounds(var1, var2)) { this.debugln("READ", var1, var2, "out of bounds"); return null; } else { try { int var3 = this.getOffset(var1, var2); if(var3 == 0) { ...
7
public ArrayList<String> getBannedAltAccounts( String player ) throws SQLException { ArrayList<String> accounts = getAltAccounts( player ); boolean check = false; for ( String p : getAltAccounts( player ) ) { if ( isPlayerBanned( p ) ) { check = true; ...
3
private boolean noMoreTableCards() { /* * Stage 8 (6 Marks) */ // TODO: i suck at this game, so no chance to test if this methos works // or not. maybe some other day for (int i = 0; i < cards.length; i++) for (int j = 0; j < cards[i].length; j++) if (cards[i][j] != null && !cards[i][j].getHasBeenR...
4
private void fillInTaskOnAssetList(Asset asset) { listOfTasks.clear(); listTasksList.repaint(); ResultSet tasksOnAssetListResultSet = null; Statement statement; try { statement = connection.createStatement(); tasksOnAssetListResultSet = stat...
4
public void checkSign(String file, String encrypted_file) throws Exception { RandomAccessFile PGP_file = new RandomAccessFile(encrypted_file, "r"); int len = -1; byte[] arr = new byte[2]; while ((len = PGP_file.read(arr)) != -1 && (arr[0] & 0xff) != SP_TAG) { //System.out.pr...
5
public boolean isClicked() { return !wasDown && isDown; }
1
public int sincronizaTodo(){ try { // logger.info(" ======== ITEM ACTUALIZADO =========================== "); System.out.println(" =============== CLIENTES ========================================== "); logger.info(" ======================================================= "); ...
1
private String getBinaryFromCell(int row, int column) { String binary = ""; int newValue; for (int r = -1; r < 2; r++) { for (int c = -1; c < 2; c++) { newValue = cellsValue[row + r][column + c] < 0 ? 1 : 0; binary = binary + newValue; ...
3
@Override public boolean match(PathInput input) { if (input.end()) { return isOptional(); } else { if (input.isBind()) { bind(input, input.value()); } input.next(); return true; } }
2
public VertexSet getVertexSetNeighbourhood(VertexSet S){ VertexSet vertexSetNeighbourhood = new VertexSet(); VertexSet vertexSetTemp = null; Iterator<City> cityIterator = S.iterator(); while (cityIterator.hasNext()){ vertexSetTemp = getNeighbourhood(cityIterator.next())...
5
protected Element invokeWriteToXML(Element parent, Object o, String name) throws Exception { Method method; Class[] methodClasses; Object[] methodArgs; boolean array; Element node; boolean useDefault; node = null; met...
9
public void checkCollisions(){ // loop all pickables for (Iterator<Pickable> iterator = meds.iterator(); iterator.hasNext(); ) { Pickable p = iterator.next(); if(Character.getBounds().intersects(p.getBounds())){ // pickup med Sounds.pickPill.play(); iterator.remove(); timer = 10000; alpha =...
2
public Entity getEntityAt(int dir, int x, int y) { for(Entity e : entities) { if(e.x == x && e.y == y && ((e instanceof NPC) || (e instanceof Door))) return e; } for(Entity e : entities) { if(e.x == x && e.y == y && !(e instanceof Player)) return e; } return null; }
9
public U1A7_PowersView(SingleFrameApplication app) { super(app); initComponents(); // status bar initialization - message timeout, idle icon and busy animation, etc ResourceMap resourceMap = getResourceMap(); int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout...
7
@Override public void paintComponent(Graphics g) { if (point != null) { if (tool == Tool.COLORWHEEL && colorWheel != null) { if (icon) { g.drawImage(colorWheel, point.x - 10, point.y - 10, 20, 20, null); } else { g.drawImage(colorWheel, point.x - 100, point.y ...
7
public void pastCrowl2(){ DatastoreService datastore = DatastoreServiceFactory .getDatastoreService(); Entity past_string = null; try { Key key = KeyFactory.createKey("past_string", "onlyOne"); past_string = datastore.get(key); } catch (Throwable t) { } past_string.setProperty("text",new Text(new ...
2
static int kmpSearch(String pat, String text) { int n = text.length(); int m = pat.length(); int[] trans = new int[m + 1]; // オートマトンの遷移テーブルを作る trans[0] = -1; for (int i = 2; i <= m; i++) { char c = pat.charAt(i - 1); int fall = trans[i - 1]; w...
7
public static void runServer() throws IOException { ServerSocket chatServer = null; try { System.out.println("Waiting for clients on port: " + local_port); chatServer = new ServerSocket(local_port); } catch (IOException e) { System.err.println("Could not listen on port: " + local_port); Syste...
4
public void close() { boolean isUnderlyingConnectionClosed; try { isUnderlyingConnectionClosed = !conn.isConnected(); } catch (Exception e) { try { pool.invalidateObject(this); // XXX should be guarded to happen at most once } catch (IllegalSta...
9
public void SortPlayerPoints() { Collections.sort(playerVector, (Player p1, Player p2) -> { if (p1.getPosition().getPosID() == Position.PosID.GOALIE) { if (p2.getPosition().getPosID() == Position.PosID.GOALIE) { int shots = p1.getAssists() + p1.getGoals(); float perc1 = (shots == 0 ? 0 : (100 - (...
7
public void actionPerformed(ActionEvent arg0) { if(arg0.getSource() == cancel) { setVisible(false); clear(); } else if(arg0.getSource() == save) { if(parent == util.quest.sp) { if(loaded == null) { util.quest.slist.getSelectedValue().addAction(create()); util.quest.sp.delete.set...
6
protected boolean setTerrain(int cellId, TerrainTypes terrain) { if ((cellId >= 0) && (cellId < countCells())) { if (this.terrain[cellId] != terrain) { this.terrain[cellId] = terrain; return true; } } return false; }
3