Ejemplo n.º 1
0
 public void undo() {
   if (undos.size() > 0) {
     Shape s = undos.get(undos.size() - 1);
     undos.remove(s);
     undos.add(s);
     shapes.remove(s);
     this.repaint();
     cpt--;
     notifyObservers();
   }
 }
Ejemplo n.º 2
0
  private ProgressIndicatorEx removeFromMaps(@NotNull InlineProgressIndicator progress) {
    final ProgressIndicatorEx original = myInline2Original.get(progress);

    myInline2Original.remove(progress);

    myOriginal2Inlines.remove(original, progress);
    if (myOriginal2Inlines.get(original) == null) {
      final int originalIndex = myOriginals.indexOf(original);
      myOriginals.remove(originalIndex);
      myInfos.remove(originalIndex);
    }

    return original;
  }
Ejemplo n.º 3
0
 /**
  * removes a user from the user list
  *
  * @param un the name of the user to be removed
  */
 public void userDel(String un) {
   users.remove(users.indexOf(un));
   if (ignores.contains(un)) {
     ignores.remove(ignores.indexOf(un));
   }
   if (afks.contains(un)) {
     afks.remove(afks.indexOf(un));
   }
   if (admins.contains(un)) {
     admins.remove(admins.indexOf(un));
   }
   updateList();
   serverMessage(un + " has left " + server.channel);
   privates.serverMessage(un, un + " has left");
 }
Ejemplo n.º 4
0
 public void checkStarCollision() {
   for (Star s : starList) {
     if (s.getOnScreen()) { // if the star is on the screen we need to check if player collides
       if (s.checkCollision(
           s.getPics().get(s.getCounter()),
           player1)) { // if the player collides with the star we remove it then change the
         // velosity to the distance that the star provides
         sRemove.add(s); // remove star once you collide with it
         player1.setVelo(s.getDist()); // changes the velocity
         player1.setInvi(true); // sets the player invisble for a few seconds
         score += s.getPoints(); // points increase by the star type
         if (musicOn) {
           starSound.play(); // playthe star sound
         }
       }
     } else {
       sRemove.add(s); // remove the star if its not on the screen
     }
   }
   for (Star s : sRemove) {
     poofList.add(new Poof(s.getX(), s.getY(), s.getNum() + 3)); // make the poof effect
     starList.remove(s);
   }
   sRemove = new ArrayList<Star>();
 }
Ejemplo n.º 5
0
 public void checkEnemyCollision() {
   for (Enemy e : enemyList) {
     if (e.getOnScreen()) { // can be removed later on
       // goes through all the enemies and checks if they collide
       if (e.checkCollision(e.getPics().get(e.getCounter()), player1)) {
         if (player1.getInvi() == false) {
           // If the player is not invisble then you get spiked.
           if (player1.getVelocity() > 0) { // if the player hits it from the bottom
             player1.setSpikeVelo();
             loseCoins();
           } else {
             player1.setVelo(
                 50); // if the player is on top instead the player bounces off the enemy
             if (musicOn) {
               bounce.play();
             }
           }
         }
         eRemove.add(e); // once we hit, we remove the enemy
       }
     } else {
       eRemove.add(e); // if the enemy goes of the screen, we remove
     }
   }
   for (Enemy e : eRemove) {
     poofList.add(new Poof(e.getX(), e.getY(), 1)); // removes all the enemies
     enemyList.remove(e);
   }
   eRemove = new ArrayList<Enemy>();
 }
Ejemplo n.º 6
0
    protected void writeAuditTrail(String strPath, String strUser, StringBuffer sbValues) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;
      ArrayList aListData = WUtil.strToAList(sbValues.toString(), false, "\n");
      StringBuffer sbData = sbValues;
      String strPnl = (this instanceof DisplayTemplate) ? "Data Template " : "Data Dir ";
      if (reader == null) {
        Messages.postDebug("Error opening file " + strPath);
        return;
      }

      try {
        while ((strLine = reader.readLine()) != null) {
          // if the line in the file is not in the arraylist,
          // then that line has been deleted
          if (!aListData.contains(strLine))
            WUserUtil.writeAuditTrail(new Date(), strUser, "Deleted " + strPnl + strLine);

          // remove the lines that are also in the file or those which
          // have been deleted.
          aListData.remove(strLine);
        }

        // Traverse through the remaining new lines in the arraylist,
        // and write it to the audit trail
        for (int i = 0; i < aListData.size(); i++) {
          strLine = (String) aListData.get(i);
          WUserUtil.writeAuditTrail(new Date(), strUser, "Added " + strPnl + strLine);
        }
        reader.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Ejemplo n.º 7
0
 // -------------------------------------------------------------------------------------------------------------------------------------------------------
 // Decorations
 public void newDecos() {
   int prob = (int) (Math.random() * 100); // randomly spawnst he decoration
   if (prob == 1) {
     if (decoList.size() < 1) {
       int prob2 = (int) (Math.random() * 2);
       if (prob2 == 1) { // right side or left side
         decoList.add(new Decorations(-700, (int) (backy * 0.1) % 23080, false));
       } else {
         decoList.add(new Decorations(-700, (int) (backy * 0.1) % 23080, true));
       }
     }
   }
   Boolean check = true;
   for (Decorations i : decoList) {
     if (i.getYTop() >= 2000) {
       check = false;
       break;
     }
   }
   if (check == false
       && decoList.size()
           > 0) { // theres only on in the lsit but for consitency we kept it as a list
     decoList.remove(0);
   }
 }
Ejemplo n.º 8
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeCompileListener(CompileListener listener) {
   if (listener != null) {
     synchronized (compileListeners) {
       compileListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 9
0
 /** Removes the specified class listener so no that it no longer receives class events. */
 public void removeClassListener(ClassListener listener) {
   if (listener != null) {
     synchronized (classListeners) {
       classListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 10
0
 public void bringToFront(Figure figure) {
   if (children.remove(figure)) {
     children.add(figure);
     needsSorting = true;
     fireAreaInvalidated(figure.getDrawingArea());
   }
 }
Ejemplo n.º 11
0
  public void updatePickups() {
    for (int i = 0; i < pickupList.size(); i++) {
      if (pickupList.get(i).pickedUp) pickupList.remove(i);
    } // end for

    while (pickupList.size() < startNumPickups) pickupList.add(new Pickup(frameWidth, frameHeight));
  } // end updatePickups
Ejemplo n.º 12
0
 public void sendToBack(Figure figure) {
   if (children.remove(figure)) {
     children.add(0, figure);
     needsSorting = true;
     fireAreaInvalidated(figure.getDrawingArea());
   }
 }
Ejemplo n.º 13
0
 /**
  * Remove a child Widget from this container.
  *
  * @param index the index of the Widget to remove
  */
 public void remove(int index) {
   Widget w = child.get(index).widget;
   getComponent().remove(w.getComponent());
   child.remove(index);
   removeAsParent(w);
   invalidateSize();
 }
Ejemplo n.º 14
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removePackageListener(PackageListener listener) {
   if (listener != null) {
     synchronized (packageListeners) {
       packageListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 15
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeApplicationListener(ApplicationListener listener) {
   if (listener != null) {
     synchronized (applicationListeners) {
       applicationListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 16
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeExtensionEventListener(ExtensionEventListener listener) {
   if (listener != null) {
     synchronized (eventListeners) {
       eventListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 17
0
  public void draw(node leaf, Graphics2D g, int px, int py) {
    int lvl = leaf.getLevel();
    double l = lvl;
    counts[lvl]++;

    double xfraq = counts[lvl] / (spacing[lvl] + 1);
    double yfraq = l / depth;
    int x = new Double(1600 * xfraq).intValue();
    int y = new Double(1200 * yfraq).intValue() + 10;

    if (leaf.getAttr() != null) {
      g.drawString(leaf.getAttr(), x - 20, y);
    }
    if (leaf.getCrit() != null) {
      g.drawString(leaf.getCrit(), x - 20, y + 10);
    }
    if (leaf.getResult() != null) {
      g.drawString(leaf.getResult(), x - 20, y + 10);
    }
    g.drawLine(x, y, px, py);
    // g.fillRect(x,y,20,20);
    ArrayList children = leaf.getChildren();
    while (!children.isEmpty()) {
      draw((node) children.remove(0), g, x, y);
    }
  }
Ejemplo n.º 18
0
 /** Removes the specified listener so no that it no longer receives events. */
 public void removeInvocationListener(InvocationListener listener) {
   if (listener != null) {
     synchronized (invocationListeners) {
       invocationListeners.remove(listener);
     }
   }
 }
Ejemplo n.º 19
0
 public Figure basicRemoveChild(int index) {
   Figure figure = children.get(index);
   children.remove(index);
   quadTree.remove(figure);
   figure.removeFigureListener(figureHandler);
   needsSorting = true;
   return figure;
 }
Ejemplo n.º 20
0
  public void recreateTree() {
    System.out.println("Recreating tree");
    ArrayList nodes = new ArrayList();
    String attr, crit, result;
    int level;
    node leaf;
    while (!list.isEmpty()) {
      if (((String) list.remove(0)).compareTo("Node") == 0) {
        leaf = new node();
        attr = (String) list.remove(0);
        // System.out.println("ATTR:"+attr);
        crit = (String) list.remove(0);
        try {
          level = (new Double(crit)).intValue();
          crit = null;
        } catch (Exception e) {
          // System.out.println("crit:"+crit);
          level = (new Double((String) list.remove(0))).intValue();
        }
        // System.out.println("lvl:"+level);
        if (level > depth) {
          depth = level;
        }
        if (((String) list.get(0)).compareTo("Node") != 0) {
          result = (String) list.remove(0);
          leaf.setResult(result);
        }
        leaf.setSplitCriteria(crit, 0);
        leaf.setLevel(level);
        leaf.setAttr(attr);

        if (attr.compareTo("_root") == 0) {
          root = leaf;
        } else {

          nodes.add(leaf);
        }
      }
    }
    depth++;
    levelCount(nodes);

    System.out.println("Linking " + nodes.size() + " tree nodes");
    trav(nodes, root);
  }
Ejemplo n.º 21
0
 public synchronized void removeClientData(ClientData cd) {
   try {
     clientList.remove(cd);
     clientList.trimToSize();
     sendList();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 22
0
 /**
  * changes the name of a user, updating list of admins, afks, ignoes, and master user list
  *
  * @param on old username
  * @param nn new username
  */
 public void rename(String on, String nn) {
   if (admins.contains(on)) {
     admins.remove(admins.indexOf(on));
     admins.add(nn);
   }
   if (afks.contains(on)) {
     afks.remove(afks.indexOf(on));
     afks.add(nn);
   }
   if (ignores.contains(on)) {
     ignores.remove(ignores.indexOf(on));
     ignores.add(nn);
   }
   users.remove(on);
   users.add(nn);
   updateList();
   serverMessage(on + " renamed to " + nn);
 }
Ejemplo n.º 23
0
 public void redo() {
   if (redos.size() > 0) {
     Shape s = redos.get(redos.size() - 1);
     redos.remove(s);
     redos.add(s);
     shapes.add(s);
     this.repaint();
     cpt++;
     notifyObservers();
   }
 }
Ejemplo n.º 24
0
 // -------------------------------------------------------------------------------------------------------------------------------------------------------
 // Poofs
 public void removePoof() { // once the poof animation is the poof is removed from the list
   for (Poof p : poofList) {
     if (p.isDone()) {
       pRemove.add(p);
     }
   }
   for (Poof p : pRemove) {
     poofList.remove(p);
   }
   pRemove = new ArrayList<Poof>();
 }
Ejemplo n.º 25
0
 /**
  * Gets the list of the vnmrj users(operators) for the current unix user logged in
  *
  * @return the list of vnmrj users
  */
 protected Object[] getOperators() {
   String strUser = System.getProperty("user.name");
   User user = LoginService.getDefault().getUser(strUser);
   ArrayList<String> aListOperators = user.getOperators();
   if (aListOperators == null || aListOperators.isEmpty())
     aListOperators = new ArrayList<String>();
   Collections.sort(aListOperators);
   if (aListOperators.contains(strUser)) aListOperators.remove(strUser);
   aListOperators.add(0, strUser);
   return (aListOperators.toArray());
 }
Ejemplo n.º 26
0
 public static TreePath[] selectMaximals(final TreePath[] paths) {
   if (paths == null) return new TreePath[0];
   final TreePath[] noDuplicates = removeDuplicates(paths);
   final ArrayList<TreePath> result = new ArrayList<TreePath>();
   for (final TreePath path : noDuplicates) {
     final ArrayList<TreePath> otherPaths = new ArrayList<TreePath>(Arrays.asList(noDuplicates));
     otherPaths.remove(path);
     if (!isDescendants(path, otherPaths.toArray(new TreePath[otherPaths.size()])))
       result.add(path);
   }
   return result.toArray(new TreePath[result.size()]);
 }
Ejemplo n.º 27
0
  public void mouseClicked(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();

    for (int i = 0; i < targets.size(); i++) {
      if (x > targets.get(i).getX()
          && x < targets.get(i).getX() + targets.get(i).getSize()
          && y > targets.get(i).getY()
          && y < targets.get(i).getY() + targets.get(i).getSize()) {
        targets.remove(i);
      }
    }
  }
Ejemplo n.º 28
0
 public void trav(ArrayList nodes, node cur) {
   node temp;
   while (!nodes.isEmpty()) {
     temp = (node) nodes.get(0);
     if (temp.getLevel() - 1 == cur.getLevel()) {
       nodes.remove(0);
       cur.addChild(temp);
       trav(nodes, temp);
     } else {
       return;
     }
   }
 }
Ejemplo n.º 29
0
  public void RegretChess() {
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++)
        if (cell[i][j].changed == true) {
          cell[i][j].ChangeBack();
        }
    turn = TakeTurn();
    try {
      stateList.remove(stateList.size() - 1);
      takenList.remove(takenList.size() - 1);

      char[][] states = stateList.get(stateList.size() - 1);
      boolean[][] takens = takenList.get(takenList.size() - 1);
      for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++) {
          cell[i][j].state = states[i][j];
          cell[i][j].taken = takens[i][j];
          cell[i][j].repaint();
        }

      for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
          if (cell[i][j].taken == false) {
            CheckPlace(cell[i][j]);
            if (canPut) {
              cell[i][j].ChangeBackground();
              canPut = false;
            }
          }

    } catch (ArrayIndexOutOfBoundsException e1) {
      JOptionPane.showMessageDialog(null, "无法悔棋");
    }
    if (stateList.size() == 0) {
      RememberState();
    }
  }
Ejemplo n.º 30
0
  /**
   * Add the given file name to the list of recent files in the given Properties object, trimming
   * the length of the list to 10. If the given name is already in the list, move it to the top.
   */
  public static void addRecentFile(Properties preferences, String newName) {

    // - if newName isn't already in the list, we add it to the top of the list.
    // - if it's already in the list, we move it to the top.
    ArrayList<String> list = MiscUtilities.parseRecentFiles(preferences);
    if (list.contains(newName)) {
      // move it to the top :
      list.remove(newName);
      list.add(0, newName);
    } else {
      list.add(0, newName);
    }
    // store to preferences :
    for (int i = 0; i < MAX_RECENT_FILES && i < list.size(); i++) {
      String key = KEY_RECENT_FILE + "." + Integer.toString(i + 1); // starts from 1
      String val = list.get(i);
      preferences.setProperty(key, val);
    }
  }