Пример #1
0
  public void cleanup() {
    for (int i = 0; i < children.size(); i++) {
      Fold child = (Fold) children.elementAt(i);
      child.cleanup();
    }

    shallowCleanup();
  }
Пример #2
0
  public void checkFolds() {
    Vector folds = new Vector(children);
    for (int i = 0; i < folds.size(); i++) {
      Fold fold = (Fold) folds.elementAt(i);

      if (!fold.isValid()) {
        fold.checkFolds();
        children.removeElement(fold);

        Vector fs = fold.getChildren();
        for (int j = 0; j < fs.size(); j++) {
          children.addElement(fs.elementAt(j));
        }
      }
    }
  }
Пример #3
0
  public void add(Fold fold) {
    for (int i = 0; i < children.size(); i++) {
      if (((Fold) children.elementAt(i)).contains(fold.getStart())) {
        ((Fold) children.elementAt(i)).add(fold);
        return;
      }
    }

    children.add(fold);
  }
Пример #4
0
  public void remove(int start, int end) {
    Vector temp = new Vector(children);
    for (int i = 0; i < temp.size(); i++) {
      Fold f = (Fold) temp.elementAt(i);

      if (f.contains(start) || f.contains(end)) {
        f.remove(start, end);
        children.removeElement(f);

        Vector childs = f.getChildren();
        for (int j = 0; j < childs.size(); j++) {
          children.addElement(childs.elementAt(j));
        }

        f.shallowCleanup();
      }
    }
  }