Ejemplo n.º 1
1
  @Override
  public void update(GameContainer container, int delta) throws SlickException {
    Projectile proj;
    playerNextPos = inputHandler.playerInput(player, container.getInput(), delta, sound);
    entity.update(delta, sound);
    if (!isBlocked(playerNextPos, player.getWidth(), player.getHeight())) {
      player.setCoord(playerNextPos);
    }

    player.logic();

    for (int i = 0; i < projectiles.size(); i++) {
      proj = projectiles.get(i);
      proj.update(delta);
      if (isBlocked(proj.pos, proj.getWidth(), proj.getHeight())) {
        projectiles.remove(i);
        sound.playSound(collisionSound);
      } else if (proj.collidesWith(entity) && proj.getOwner() == player) {
        proj.damage(entity);
        projectiles.remove(i);
      } else if (proj.collidesWith(player) && proj.getOwner() == entity) {
        proj.damage(player);
        projectiles.remove(i);
      }
    }
  }
Ejemplo n.º 2
1
 public static void checkTCPConnections() {
   for (int i = 0; i < playerConnections.size(); i++) {
     // Create ByteBuffer
     ByteBuffer b = ByteBuffer.allocate(65536);
     b.clear();
     // Read from Player Connection, if error, remove connection
     try {
       int bytesRead = playerConnections.get(i).read(b);
       if (bytesRead == 0) continue;
       if (bytesRead == -1) {
         // Removes player from connections if disconnected.
         playerConnections.remove(i);
         --i;
         continue;
       }
       if (b.array().length > 0) {
         // Trims info to the bytes which are actually read.
         byte[] info = new byte[bytesRead];
         for (int x = 0; x < bytesRead; x++) {
           info[x] = b.array()[x];
         }
         playerConnections.get(i).addData(info);
       }
     } catch (IOException e) {
       playerConnections.remove(i);
       --i;
       continue;
     }
   }
 }
Ejemplo n.º 3
1
 public boolean isCircuit() {
   boolean result = true;
   ArrayList<Line> _segs = new ArrayList<>(getSegments());
   Line currLine = new Line(_segs.get(0).start, _segs.get(0).end);
   _segs.remove(0);
   Point startPoint = new Point(currLine.start);
   Point frontPoint = new Point(currLine.end);
   while (_segs.size() > 1) {
     int indexNextLine = searchSegment(_segs, frontPoint);
     currLine = new Line(_segs.get(indexNextLine).start, _segs.get(indexNextLine).end);
     if (currLine.start.equals(startPoint) || currLine.end.equals(startPoint)) {
       return false;
     }
     if (currLine.start.equals(frontPoint)) {
       frontPoint = new Point(currLine.end);
     } else {
       frontPoint = new Point(currLine.start);
     }
     _segs.remove(indexNextLine);
   }
   if (!_segs.get(0).start.equals(startPoint) && !_segs.get(0).end.equals(startPoint)) {
     result = false;
   }
   return result;
 }
Ejemplo n.º 4
0
 public static void printEdges(TreeNode root) {
   printleft(root);
   output.remove(output.size() - 1);
   printLeaves(root);
   printRight(root.right, output.size() - 1);
   output.remove(output.size() - 1);
 }
Ejemplo n.º 5
0
 public void addRecentFile(File file) {
   if (!recentFiles.contains(file)) {
     if (recentFiles.size() == 8) recentFiles.remove(0);
   } else recentFiles.remove(file);
   recentFiles.add(file);
   if (obs != null) obs.updateRecentFiles((File[]) recentFiles.toArray(new File[0]));
 }
Ejemplo n.º 6
0
  /**
   * Remove the tab from the list. If the tab is the current tab shown, the last created tab will be
   * shown.
   *
   * @param t The tab to be removed.
   */
  boolean removeTab(Tab t) {
    if (t == null) {
      return false;
    }

    // Grab the current tab before modifying the list.
    Tab current = getCurrentTab();

    // Remove t from our list of tabs.
    mTabs.remove(t);

    // Put the tab in the background only if it is the current one.
    if (current == t) {
      t.putInBackground();
      mCurrentTab = -1;
    } else {
      // If a tab that is earlier in the list gets removed, the current
      // index no longer points to the correct tab.
      mCurrentTab = getTabPosition(current);
    }

    // destroy the tab
    t.destroy();
    // clear it's references to parent and children
    t.removeFromTree();

    // Remove it from the queue of viewed tabs.
    mTabQueue.remove(t);
    return true;
  }
Ejemplo n.º 7
0
  /**
   * Methode utile pour la classe Pion. modifie le fetdeplacementPossible selon la presence d'une
   * piece adverse en diagonale par rapport a la direction d'avancee du pion
   *
   * @param caseActuelle :case du pion
   * @param res : le getdeplacement de la piece
   */
  private void filtrerpresenceAdversaireDiagonale(Case caseActuelle, ArrayList<Case> casePossible) {

    for (int i = 0; i < casePossible.size(); i++) {

      Case c = casePossible.get(i);
      Case caseEchiquier = chercherCase(c.getPosition());

      if (caseEchiquier.getPosition().getLargeur() == caseActuelle.getPosition().getLargeur() + 1
          || caseEchiquier.getPosition().getLargeur()
              == caseActuelle.getPosition().getLargeur() - 1) {
        if (caseEchiquier.estVide()) {
          casePossible.remove(c);
          i--;
        } else if (caseEchiquier.getPiece().getCamp().equals(caseActuelle.getPiece().getCamp())) {
          casePossible.remove(c);
          i--;
        }

      } else {
        if (!caseEchiquier.estVide()) {
          casePossible.remove(c);
          i--;
        }
      }
    }
  }
 public void removeKeyFrameByIndex(int i) {
   if ((i >= 0) && (i < keyFrameTimes.size())) {
     keyFrameTimes.remove(i);
     keyFrameCamPos.remove(i);
     keyFrameFixPos.remove(i);
   }
 }
Ejemplo n.º 9
0
  @Override
  void removeNodeData(SetLiveState s) {
    if (refCount <= 0) {
      // either not in sharedGroup or last instance in sharedGroup
      // remove this node from parentTransformLink's childTransformLink
      if (parentTransformLink != null) {
        ArrayList<NodeRetained> obj;
        if (parentTransformLink instanceof TransformGroupRetained) {
          obj = ((TransformGroupRetained) parentTransformLink).childTransformLinks;
        } else {
          obj = ((SharedGroupRetained) parentTransformLink).childTransformLinks;
        }
        synchronized (obj) {
          obj.remove(this);
        }
      }

      // remove this node from parentSwitchLink's childSwitchLink
      if (parentSwitchLink != null) {
        for (int i = 0; i < parentSwitchLink.childrenSwitchLinks.size(); i++) {
          ArrayList<NodeRetained> switchLinks = parentSwitchLink.childrenSwitchLinks.get(i);
          if (switchLinks.contains(this)) {
            switchLinks.remove(this);
            break;
          }
        }
      }
    }
    super.removeNodeData(s);
  }
  public void addItem() {
    int pick = (int) (Math.random() * openSpaces.size());
    // System.out.println("openspaces is size " + openSpaces.size());
    Location l = openSpaces.get(pick);
    int choose = (int) (Math.random() * 3);
    // System.out.println(choose);
    switch (choose) {
      case 0:
        Apple a = new Apple();
        world.add(l, a);
        openSpaces.remove(l);

        break;
      case 1:
        GrimyFood f = new GrimyFood();
        world.add(l, f);
        openSpaces.remove(l);

        break;
      case 2:
        OranBerry o = new OranBerry();

        world.add(l, o);
        openSpaces.remove(l);

        break;
    }
  }
Ejemplo n.º 11
0
  @Override
  public RetVal execute(ArrayList<String> arg, String pName) {
    Log.debug("CommandEdit.execute");
    RetVal r = new RetVal();

    arg.remove(0); // Remove 'edit' from the arguments list.

    if (arg.isEmpty()) {
      Log.debug("arg is empty.");
      r.addAll(getFullHelp());
      return r;
    }

    switch (arg.get(0)) {
      case "help":
        r.addAll(getFullHelp());
        r.tru();
        return r;
      case "entrance":
        arg.remove(0);
        return subEntrance(arg, pName);
      default:
        r.addAll(getFullHelp());
        r.Err("Couldn't find command '" + arg.get(0) + "'!");
        return r;
    }
  }
Ejemplo n.º 12
0
  // 这里是关键
  private void recycleMemory() {
    // 一屏显示多少行 这里就设置为多少。不设也行 主要是用户体验好 不会将用户看到的图片设为默认图片
    int showCount = 10;

    //
    for (int i = 0; i < viewList.size() - showCount; i++) {
      ImageView iv = (ImageView) viewList.get(i);
      /**
       * * 这里是关键! 将 imageview 设置一张默认的图片 , 用于解决当释放bitmap的时候 还有其他 控件对他保持引用 就不会发生trying to use a
       * recycled bitmap异常了
       */
      iv.setImageResource(R.drawable.default_cover);
      // 从list中去除
      viewList.remove(i);
    }

    //		viewList = new ArrayList();

    for (int i = 0; i < bitmapList.size() - 10; i++) {

      Bitmap bitmap = (Bitmap) bitmapList.get(i);
      // 这里就开始释放bitmap 所占的内存了
      if (!bitmap.isRecycled()) {
        bitmap.recycle();
        System.out.println("recycle ");
      }
      // 从list中去除
      bitmapList.remove(i);
    }

    //		bitmapList = new ArrayList();
  }
Ejemplo n.º 13
0
  /**
   * Gets the selected item from ListBox and pass it.
   *
   * @param selected Sorting ListBox id selected.
   */
  private void selectedList(int selected) {
    if (selected
        == 0) { // if "All Albums" is selected, then previous categories are removed, and don't add
      // it to selectedTags
      selectedTags.clear();
      selectedTags.add((Integer) 0); // 0 is the id for All Albums
    } else if (selected
        == 1) { // if "Recent Albums" is selected, then previous categories are removed, and don't
      // add it to selectedTags
      selectedTags.clear();
      selectedTags.add((Integer) 1); // 1 is the id for Recent Albums
    } else {
      if (selectedTags.contains(0)) { // if "All Albums" already in selected tags, then remove it
        selectedTags.remove((Integer) 0);
      }
      if (selectedTags.contains(1)) { // if "Recent Albums" already in selected tags, then remove it
        selectedTags.remove((Integer) 1);
      }

      if (selectedTags.contains(selected)) { // if already in selected tags, then remove it
        selectedTags.remove((Integer) selected);
      } else { // otherwise add it to selected tags
        selectedTags.add((Integer) selected);
      }
    }

    StringBuilder albumsToShow = new StringBuilder();
    for (Integer tag : selectedTags) albumsToShow.append(tag + ",");

    view.showAlbumsByTag(albumsToShow.toString());
  }
Ejemplo n.º 14
0
  @Override
  public void write() {
    ArrayList<String> players = new ArrayList<String>(props.stringPropertyNames());
    players.remove("join-string-format");
    players.remove("log-every-player");
    Collections.sort(
        players,
        new Comparator<String>() {
          public int compare(String s1, String s2) {
            return s1.toLowerCase().compareTo(s2.toLowerCase());
          }
        });

    if (scriptFile.exists()) scriptFile.delete();
    try {
      scriptFile.createNewFile();
      FileWriter writer = new FileWriter(scriptFile);
      writer.append("$${\n");
      for (int i = 0; i < players.size(); i++) {
        if (i > 0) writer.append("ELSE; ");
        writer.append("IF(JOINEDPLAYER = \"" + players.get(i) + "\");\n");
        writer.append("\tLOG(\"" + props.getProperty(players.get(i)) + "\");\n");
      }
      if (props.getProperty("log-every-player").equalsIgnoreCase("true"))
        writer.append("ELSE; \n\tLOG(\"" + props.getProperty("join-string-format") + "\");\n");
      for (int i = 0; i < players.size(); i++) {
        writer.append("ENDIF;\n");
      }
      writer.append("}$$");
      writer.close();
      showMacroCreatedMessage();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 15
0
 /**
  * Generates the Knight's moveset by looping clockwise. First take two steps in a certain
  * direction to create a baseLocation, and then go to the right and left of the baseLocation to
  * check for possible moves.
  */
 public ArrayList<Location> getValidMoveLocations() {
   Grid<Actor> gr = getGrid();
   if (gr == null) {
     return null;
   }
   ArrayList<Location> result = new ArrayList<Location>();
   Location possibleLocation1, possibleLocation2;
   for (int i = 0; i < Location.FULL_CIRCLE; i += Location.RIGHT) {
     Location baseLocation = getLocation();
     for (int counter = 0; counter < 2; counter++) {
       baseLocation = baseLocation.getAdjacentLocation(i);
     }
     possibleLocation1 = baseLocation.getAdjacentLocation(i + Location.LEFT);
     if (gr.isValid(possibleLocation1)) {
       result.add(possibleLocation1);
       if (gr.get(possibleLocation1) instanceof Piece
           && gr.get(possibleLocation1).getColor().equals(getColor())) {
         result.remove(possibleLocation1);
       }
     }
     possibleLocation2 = baseLocation.getAdjacentLocation(i + Location.RIGHT);
     if (gr.isValid(possibleLocation2)) {
       result.add(possibleLocation2);
       if (gr.get(possibleLocation2) instanceof Piece
           && gr.get(possibleLocation2).getColor().equals(getColor())) {
         result.remove(possibleLocation2);
       }
     }
   }
   return result;
 }
Ejemplo n.º 16
0
  private static void getTopDocuments(int num, HashMap<String, Float> scoremap, String filename)
      throws FileNotFoundException {
    PrintWriter out = new PrintWriter(filename);
    Iterator<String> itr = scoremap.keySet().iterator();
    ArrayList<String> urls = new ArrayList<String>();
    ArrayList<Float> scores = new ArrayList<Float>();

    while (itr.hasNext()) {
      String key = itr.next();
      if (scores.size() < num) {
        scores.add(scoremap.get(key));
        urls.add(key);
      } else {
        int index = scores.indexOf(Collections.min(scores));
        if (scores.get(index) < scoremap.get(key)) {
          scores.set(index, scoremap.get(key));
          urls.set(index, key);
        }
      }
    }

    while (scores.size() > 0) {
      int index = scores.indexOf(Collections.max(scores));
      out.println(urls.get(index) + "\t" + scores.get(index));
      urls.remove(index);
      scores.remove(index);
    }
    out.close();
  }
Ejemplo n.º 17
0
  /**
   * See if you're supposed to be firing projectiles, if so fire, then animate all projectiles
   *
   * @param gc
   * @throws SlickException
   */
  private void handleProjectiles(GameContainer gc, int delta) throws SlickException {
    // For each existing projectile
    ArrayList<Projectile> projList = player.getProjectileList();
    for (int i = 0; i < projList.size(); i++) {
      Projectile shot = projList.get(i);
      shot.update(delta);

      if (cHandler.collidingWithBlocks(shot.projShape)) { // if it hit anything remove the shot
        projList.remove(i);
      } else {
        // TODO: Implement better way of collision checking on enemies?
        OUTER:
        for (int j = 0; j < activeEnemyList.size(); j++) {
          Enemy enemy = activeEnemyList.get(j);
          if (enemy.getHitbox().intersects(shot.projShape)) {
            activeEnemyList.remove(j);
            if (shot.getPiercing() <= 1) {
              projList.remove(i);
              break OUTER;
            } else {
              shot.setPiercing(shot.getPiercing() - 1);
            }
          }
        }
      }
    }
  }
  public void addParticipant(Participant participant) {

    if (pma == null) {
      if (pendingParticipantsMessages == null)
        pendingParticipantsMessages = new LinkedList<Participant>();
      pendingParticipantsMessages.add(participant);
    } else {
      String[] oldValues = pma.getValues();
      // cma.clear();
      ArrayList<String> values = new ArrayList<String>(Arrays.asList(oldValues));
      if (participant.getType().equalsIgnoreCase(Type.unavailable.toString())) {
        values.remove(participant.getFullnick());
      } else {

        if (!values.contains(participant.getFullnick())) {
          if (values.size() == 200) {
            values.remove(0);
          }
          values.add(participant.getFullnick());
        }
      }

      String[] newValues = Arrays.copyOf(values.toArray(), values.size(), String[].class);

      pma = new ParticipantMessageAdapter(context, newValues);
      participantsView.setAdapter(pma);
      pma.notifyDataSetChanged();
    }
  }
Ejemplo n.º 19
0
  public int findCelebrity0(int n) {
    ArrayList<Integer> candidate = new ArrayList<>();
    for (int i = 0; i < n; ++i) {
      candidate.add(i);
    }

    while (candidate.size() > 1) {
      int len = candidate.size();
      int left = candidate.get(len - 2);
      int right = candidate.get(len - 1);
      if (knows(left, right)) {
        candidate.remove(len - 2);
      } else {
        candidate.remove(len - 1);
      }
    }

    int c = candidate.get(0);
    // BUG: verify in two direction of knows:
    for (int i = 0; i < n; ++i) {
      if (i != c && (knows(c, i) || !knows(i, c))) {
        c = -1;
        break;
      }
    }
    return c;
  }
  @Override
  public void actionPerformed(ActionEvent arg0) {
    dw.repaint();
    if (skyline != null && veyron != null && !paused) {
      carSet.add(new Point(skyline.x, skyline.y));
      carSet2.add(new Point(veyron.x, veyron.y));

      if (direction == UP) {
        skyline = new Point(skyline.x, skyline.y - 1);
        veyron = new Point(veyron.x, veyron.y - 1);
      }
      if (direction == DOWN) {
        skyline = new Point(skyline.x, skyline.y + 1);
        veyron = new Point(veyron.x, veyron.y + 1);
      }
      if (direction == LEFT) {
        skyline = new Point(skyline.x - 1, skyline.y);
        veyron = new Point(veyron.x - 1, veyron.y);
      }
      if (direction == RIGHT) {
        skyline = new Point(skyline.x + 1, skyline.y);
        veyron = new Point(veyron.x + 1, veyron.y);
      }
      if (carSet.size() > carLength) carSet.remove(0);
      if (carSet2.size() > carLength) carSet2.remove(0);
    }
  }
Ejemplo n.º 21
0
 protected String normalizePath(String rawPath) {
   // If this is an absolute path, trim the leading "/" and replace it later
   boolean isAbsolutePath = rawPath.startsWith("/");
   if (isAbsolutePath) {
     rawPath = rawPath.substring(1);
   }
   ArrayList<String> components = new ArrayList<String>(Arrays.asList(rawPath.split("/+")));
   for (int index = 0; index < components.size(); ++index) {
     if (components.get(index).equals("..")) {
       components.remove(index);
       if (index > 0) {
         components.remove(index - 1);
         --index;
       }
     }
   }
   StringBuilder normalizedPath = new StringBuilder();
   for (String component : components) {
     normalizedPath.append("/");
     normalizedPath.append(component);
   }
   if (isAbsolutePath) {
     return normalizedPath.toString();
   } else {
     return normalizedPath.toString().substring(1);
   }
 }
Ejemplo n.º 22
0
 // DELETION FIXED
 public void getISDra2FixedDel() {
   for (int i = 0; i < records.size(); i++) {
     Record cur = records.get(i);
     if (cur.regular) {
       if (cur.doesFirstMatch(674400, 674850, true, "EDGE:145:213")
           && cur.doesSecondMatch(676750, 677000, false, "EDGE:216:277")) {
         System.out.println(cur);
         records.remove(i);
         i--;
       } else if (cur.doesFirstMatch(1387250, 1387550, true, "EDGE:149:325")
           && cur.doesSecondMatch(1389450, 1389700, false, "EDGE:168:281")) {
         System.out.println(cur);
         records.remove(i);
         i--;
       } else if (cur.doesFirstMatch(1611150, 1611550, true, "EDGE:192:280")
           && cur.doesSecondMatch(1613400, 1613750, false, "EDGE:147:324")) {
         System.out.println(cur);
         records.remove(i);
         i--;
       } else if (cur.doesFirstMatch(1952800, 1953125, true, "EDGE:271:283")
           && cur.doesSecondMatch(1955000, 1955300, false, "EDGE:146:313")) {
         System.out.println(cur);
         records.remove(i);
         i--;
       } else if (cur.doesFirstMatch(2321000, 2321350, true, "EDGE:190:282")
           && cur.doesSecondMatch(2323250, 2323600, false, "EDGE:150:242")) {
         System.out.println(cur);
         records.remove(i);
         i--;
       }
     }
   }
   System.out.println();
 }
  /** view for all the fragments list view */
  public void removeProduct(int position) {

    filteredList.remove(position);
    commodityDetails.remove(position);
    Collections.sort(filteredList, convertStringToDateAndCompare);
    notifyDataSetChanged();
  }
Ejemplo n.º 24
0
 public String pairClusters2string(
     ArrayList<Record> pair1, ArrayList<Record> pair2, boolean left) {
   StringBuffer bf = new StringBuffer();
   for (int i = 0; i < pair1.size(); i++) {
     for (int j = 0; j < pair2.size(); j++) {
       if (pair1.get(i).isInsertionPair(pair2.get(j), left)) {
         bf.append(pair1.get(i) + "\n" + pair2.get(j) + "\n\n");
         pair1.remove(i);
         pair2.remove(j);
         i--;
         j--;
         break;
       }
     }
   }
   if ((pair1.size() + pair2.size()) > 0) {
     bf.append("***** UNPAIRED *****\n");
     for (int i = 0; i < pair1.size(); i++) {
       bf.append(pair1.get(i) + "\n");
     }
     for (int j = 0; j < pair2.size(); j++) {
       bf.append(pair2.get(j) + "\n");
     }
     bf.append("**** END OF UNPAIRED ****\n");
   }
   // bf.append("\n");
   return bf.toString();
 }
Ejemplo n.º 25
0
  /**
   * Remove an item from the screen.
   *
   * @param item the item to remove
   */
  public static void removeItem(MoveableItem item) {
    if (item instanceof Paint) paints.remove(item);
    else if (!(item instanceof Eraser)) brushes.remove(item);

    TouchClient.remove(item);
    notifyListeners(item, ITEM_REMOVED);
  }
Ejemplo n.º 26
0
 public void pairClusters(ArrayList<Record> pair1, ArrayList<Record> pair2, boolean left) {
   for (int i = 0; i < pair1.size(); i++) {
     for (int j = 0; j < pair2.size(); j++) {
       if (pair1.get(i).isInsertionPair(pair2.get(j), left)) {
         System.out.println(pair1.get(i) + "\n" + pair2.get(j) + "\n");
         pair1.remove(i);
         pair2.remove(j);
         i--;
         j--;
         break;
       }
     }
   }
   if ((pair1.size() + pair2.size()) > 0) {
     System.out.println("***** UNPAIRED *****");
     for (int i = 0; i < pair1.size(); i++) {
       System.out.println(pair1.get(i));
     }
     for (int j = 0; j < pair2.size(); j++) {
       System.out.println(pair2.get(j));
     }
     System.out.println("**** END OF UNPAIRED ****\n");
   }
   // System.out.println("\n");
 }
Ejemplo n.º 27
0
  public void update(float x, float y) {
    float actSlopeX, actSlopeY;

    if (x > prevX) actSlopeX = 10;
    else actSlopeX = -10;
    if (y > prevY) actSlopeY = 10;
    else actSlopeY = -10;
    // actSlopeX = x - prevX;
    // actSlopeY = y - prevY;
    xAcum += Math.abs(x - inX);
    yAcum += Math.abs(y - inY);
    n += 1;
    prevX = x;
    prevY = y;
    if (stable) {
      bufferX.add(actSlopeX);
      bufferY.add(actSlopeY);
      if (bufferX.size() >= sizeMax) {
        avSlope(x, y);
        bufferX.remove(0);
        bufferY.remove(0);
      }
    } else {
      stable = true;
    }
  }
Ejemplo n.º 28
0
 public Mapa(String w, String h, String s, String j) {
   WIDTH = Integer.parseInt(w);
   HEIGHT = Integer.parseInt(h);
   SCALE = Integer.parseInt(s);
   numGamers = Integer.parseInt(j);
   hacerJugadores();
   if (Integer.parseInt(j) != 4) {
     switch (Integer.parseInt(j)) {
       case 1:
         jugadores.remove(1);
         jugadores.remove(1);
         jugadores.remove(1);
         break;
       case 2:
         jugadores.remove(1);
         jugadores.remove(1);
         break;
       case 3:
         jugadores.remove(1);
         break;
       default:
         break;
     }
   }
   restriccion = lectura(Integer.parseInt(w), Integer.parseInt(h), Integer.parseInt(s));
 }
Ejemplo n.º 29
0
 /** Eliminate redundant modifier keys surrounding keystrokes or keystrings. */
 private void removeExtraModifiers() {
   setStatus("Removing extra modifiers");
   for (int i = 0; i < steps.size(); i++) {
     Step step = (Step) steps.get(i);
     if (isKey(step, ANY_KEY, PRESS)) {
       Event se = (Event) step;
       String cs = se.getAttribute(XMLConstants.TAG_KEYCODE);
       int code = AWT.getKeyCode(cs);
       boolean remove = false;
       boolean foundKeyStroke = false;
       if (AWT.isModifier(code)) {
         for (int j = i + 1; j < steps.size(); j++) {
           Step next = (Step) steps.get(j);
           if (isKey(next, cs, RELEASE)) {
             if (foundKeyStroke) {
               steps.remove(j);
               remove = true;
             }
             break;
           } else if (isKeyStroke(next, ANY_KEY) || isKeyString(next)) {
             foundKeyStroke = true;
             remove = true;
           } else if (!isKey(next, ANY_KEY, EITHER)) {
             break;
           }
         }
       }
       if (remove) {
         steps.remove(i--);
       }
     }
   }
 }
Ejemplo n.º 30
0
 /** Removes any warrant, not just NXWarrant */
 public void removeNXWarrant(Warrant w) {
   w.removePropertyChangeListener(this);
   _warList.remove(w);
   _warNX.remove(w);
   _manager.deregister(w);
   w.dispose();
 }