コード例 #1
0
 public void init(java.util.List<Pair<String, TextWithImports>> data) {
   myData.clear();
   for (Iterator<Pair<String, TextWithImports>> it = data.iterator(); it.hasNext(); ) {
     final Pair<String, TextWithImports> pair = it.next();
     myData.add(new Row(pair.getFirst(), pair.getSecond()));
   }
 }
コード例 #2
0
ファイル: Cheat.java プロジェクト: LuisEduardoER/baffleship
  // takes the most recently enetered keystroke
  // return true if the player has just completed the cheat
  // return false otherwise
  public boolean nextKey(int k) {
    if (cheatCode.get(keys.size()) == k) {
      keys.add(k);
      if (keys.size() == cheatCode.size()) {
        keys.clear();
        return true;
      } else return false;
    }

    // else the player has messed up and has to start over

    keys.clear();
    if (cheatCode.get(0) == k)
      keys.add(k); // if the incorrect keystroke is the start of the sequence we'll use it
    return false;
  }
コード例 #3
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void animationPause(int pauseTime) {
   if ((pauseTime < 1) || (pauseTime > 1000)) {
     pauseTime = 100;
   }
   try {
     Thread.sleep(pauseTime);
     synchronized (animPoints) {
       animPoints.clear();
     }
     synchronized (animLines) {
       animLines.clear();
     }
     synchronized (animOvals) {
       animOvals.clear();
     }
     synchronized (animRectangles) {
       animRectangles.clear();
     }
   } catch (InterruptedException e) {
   }
 }
コード例 #4
0
 public synchronized void actionPerformed(ActionEvent e) {
   java.util.List<JComponent> componentsToRemove = null;
   java.util.List<Part> partsToRemove = null;
   for (JComponent component : animationStateMap.keySet()) {
     component.repaint();
     if (partsToRemove != null) {
       partsToRemove.clear();
     }
     Map<Part, AnimationState> map = animationStateMap.get(component);
     if (!component.isShowing() || map == null || map.size() == 0) {
       if (componentsToRemove == null) {
         componentsToRemove = new ArrayList<JComponent>();
       }
       componentsToRemove.add(component);
       continue;
     }
     for (Part part : map.keySet()) {
       if (map.get(part).isDone()) {
         if (partsToRemove == null) {
           partsToRemove = new ArrayList<Part>();
         }
         partsToRemove.add(part);
       }
     }
     if (partsToRemove != null) {
       if (partsToRemove.size() == map.size()) {
         // animation is done for the component
         if (componentsToRemove == null) {
           componentsToRemove = new ArrayList<JComponent>();
         }
         componentsToRemove.add(component);
       } else {
         for (Part part : partsToRemove) {
           map.remove(part);
         }
       }
     }
   }
   if (componentsToRemove != null) {
     for (JComponent component : componentsToRemove) {
       animationStateMap.remove(component);
     }
   }
   if (animationStateMap.size() == 0) {
     timer.stop();
   }
 }
コード例 #5
0
 public void clear() {
   myData.clear();
   fireTableDataChanged();
 }