コード例 #1
0
ファイル: Drawing.java プロジェクト: zacharimoncef93/POOA
 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();
   }
 }
コード例 #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;
  }
コード例 #3
0
ファイル: LlamaChat.java プロジェクト: raulgq1/LlamaChat
 /**
  * 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");
 }
コード例 #4
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** Removes the specified listener so that it no longer receives events. */
 public void removeApplicationListener(ApplicationListener listener) {
   if (listener != null) {
     synchronized (applicationListeners) {
       applicationListeners.remove(listener);
     }
   }
 }
コード例 #5
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** Removes the specified listener so that it no longer receives events. */
 public void removePackageListener(PackageListener listener) {
   if (listener != null) {
     synchronized (packageListeners) {
       packageListeners.remove(listener);
     }
   }
 }
コード例 #6
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** Removes the specified listener so that it no longer receives events. */
 public void removeCompileListener(CompileListener listener) {
   if (listener != null) {
     synchronized (compileListeners) {
       compileListeners.remove(listener);
     }
   }
 }
コード例 #7
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** 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);
     }
   }
 }
コード例 #8
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>();
 }
コード例 #9
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>();
 }
コード例 #10
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();
      }
    }
コード例 #11
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** Removes the specified listener so that it no longer receives events. */
 public void removeExtensionEventListener(ExtensionEventListener listener) {
   if (listener != null) {
     synchronized (eventListeners) {
       eventListeners.remove(listener);
     }
   }
 }
コード例 #12
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);
   }
 }
コード例 #13
0
 public void bringToFront(Figure figure) {
   if (children.remove(figure)) {
     children.add(figure);
     needsSorting = true;
     fireAreaInvalidated(figure.getDrawingArea());
   }
 }
コード例 #14
0
ファイル: BlueJ.java プロジェクト: tordf/Greenfoot
 /** 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);
     }
   }
 }
コード例 #15
0
 public void sendToBack(Figure figure) {
   if (children.remove(figure)) {
     children.add(0, figure);
     needsSorting = true;
     fireAreaInvalidated(figure.getDrawingArea());
   }
 }
コード例 #16
0
 public Figure basicRemoveChild(int index) {
   Figure figure = children.get(index);
   children.remove(index);
   quadTree.remove(figure);
   figure.removeFigureListener(figureHandler);
   needsSorting = true;
   return figure;
 }
コード例 #17
0
ファイル: LlamaChat.java プロジェクト: raulgq1/LlamaChat
 /**
  * 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);
 }
コード例 #18
0
ファイル: Server.java プロジェクト: w4-pwr/studia
 public synchronized void removeClientData(ClientData cd) {
   try {
     clientList.remove(cd);
     clientList.trimToSize();
     sendList();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
コード例 #19
0
  public void finishedRun(RaceRun run) {
    synchronized (activeRuns) {
      activeRuns.remove(run);
      runsStartedOrCompletedCnt++;
    }

    synchronized (completedRuns) {
      completedRuns.add(run);
    }
  }
コード例 #20
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>();
 }
コード例 #21
0
ファイル: LoginBox.java プロジェクト: timburrow/ovj3
 /**
  * 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());
 }
コード例 #22
0
ファイル: Drawing.java プロジェクト: zacharimoncef93/POOA
 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();
   }
 }
コード例 #23
0
ファイル: TreeUtil.java プロジェクト: jexp/idea2
 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()]);
 }
コード例 #24
0
ファイル: Main.java プロジェクト: krohit/ShootingGallery
  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);
      }
    }
  }
コード例 #25
0
ファイル: StartChess.java プロジェクト: Vitvicky/java
  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();
    }
  }
コード例 #26
0
  // Removes a sound from the interface and sound list
  // keyCode - The keyboard key code associated with the sound
  public void deleteSound(int keyCode) {
    soundManager.deleteSound(keyCode);

    // Search the sound buttons for the button to remove
    for (int s = 0; s < soundList.size(); s++) {
      BoardButton button = soundList.get(s);
      if (button.getKeyCode() == keyCode) {
        // Remove the button from the interface
        remove(button.getButton());
        soundList.remove(s);

        // Update the GUI
        frame.setProjectModified();
        refreshSoundBoard();

        break;
      }
    }
  }
コード例 #27
0
 public void run() {
   System.out.println("ReminderServiceOld: Starting at " + new Date());
   while (!l.isEmpty()) {
     Date d = new Date();
     Item i = (Item) l.get(0);
     long interval = i.due.getTime() - d.getTime();
     if (interval > 0) {
       System.out.println("Sleeping until " + i.due);
       try {
         Thread.sleep(interval);
       } catch (InterruptedException e) {
         System.exit(1); // unexpected intr
       }
       message(i.due + ": " + i.message);
     } else message("MISSED " + i.message + " at " + i.due);
     l.remove(0);
   }
   System.exit(0);
 }
コード例 #28
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
  /**
   * 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);
    }
  }
コード例 #29
0
 public void checkSpikeCollision() { // checks the spike collision
   for (Spikes s : spikeList) {
     if (s.getOnScreen()) { // if the spike is on the screen
       if (s.checkCollision(s.getImage(), player1)) { // if the user collides with the spike
         if (player1.getInvi() == false) { // if player is not invisiblity
           player1.setSpikeVelo(); // set the spike velocity
           loseCoins();
           player1.setDown(true);
         }
         spRemove.add(s);
       }
     } else {
       spRemove.add(s); // remove the spike
     }
   }
   for (Spikes s : spRemove) {
     spikeList.remove(s);
   }
   spRemove = new ArrayList<Spikes>();
 }
コード例 #30
0
 public void checkJumperCollision() {
   // same as all the other collsions
   for (Jumper j : jumperList) {
     if (j.getOnScreen()) { //
       if (j.checkCollision(j.getImage(), player1)) {
         player1.setVelo(50);
         player1.setDown(false);
         if (musicOn) {
           bounce.play();
         }
       }
     } else {
       jRemove.add(j);
     }
   }
   for (Jumper j : jRemove) {
     jumperList.remove(j);
   }
   jRemove = new ArrayList<Jumper>();
 }