コード例 #1
0
  public void reset() {
    for (String name : robotDialogMap.keySet()) {
      RobotDialog dialog = robotDialogMap.get(name);

      if (!dialog.isVisible()) {
        robotDialogMap.remove(name);
        dialog.detach();
        dialog.dispose();
      }
    }
  }
コード例 #2
0
  public void trim(List<IRobotSnapshot> robots) {

    // new ArrayList in order to prevent ConcurrentModificationException
    for (String name : new ArrayList<String>(robotDialogMap.keySet())) {
      boolean found = false;

      for (IRobotSnapshot robot : robots) {
        if (robot.getName().equals(name)) {
          found = true;
          break;
        }
      }
      if (!found) {
        RobotDialog dialog = robotDialogMap.get(name);

        robotDialogMap.remove(name);
        dialog.dispose();
        dialog.detach();
      }
    }
  }
コード例 #3
0
  public void purge(List<IRobotSnapshot> robots) {

    // new ArrayList in order to prevent ConcurrentModificationException
    for (String name : new ArrayList<String>(robotDialogMap.keySet())) {
      boolean found = false;
      boolean dead = false;
      for (IRobotSnapshot robot : robots) {
        if (robot.getName().equals(name)) {
          found = true;
          if (robot.getState().isDead()) {
            dead = true;
          }
          break;
        }
      }
      if (!found || dead) {
        RobotDialog dialog = robotDialogMap.get(name);
        System.out.println("purging " + name);
        robotDialogMap.remove(name);
        dialog.dispose();
        dialog.detach();
      }
    }
  }