Beispiel #1
0
 protected int addLeaf(final Octant octant) {
   int id;
   if (!garbageQueue.isEmpty()) {
     id = garbageQueue.firstInt();
     garbageQueue.remove(id);
   } else {
     id = length++;
     ensureArraySize(id);
   }
   leaves[id] = octant;
   leavesCount++;
   octant.leafId = id;
   return id;
 }
  protected int addView(final GraphViewImpl view) {
    checkNonNullViewObject(view);

    int id;
    if (!garbageQueue.isEmpty()) {
      id = garbageQueue.firstInt();
      garbageQueue.remove(id);
    } else {
      id = length++;
      ensureArraySize(id);
    }
    views[id] = view;
    view.storeId = id;
    return id;
  }
Beispiel #3
0
 protected void removeLeaf(final Octant octant) {
   int id = octant.leafId;
   leaves[id] = null;
   leavesCount--;
   garbageQueue.add(id);
   octant.leafId = NULL_ID;
 }
Beispiel #4
0
 public void clear() {
   for (int i = 0; i < length; i++) {
     Octant leaf = leaves[i];
     if (leaf != null) {
       leaf.clear();
     }
   }
   leaves = new Octant[0];
   leavesCount = 0;
   length = 0;
   garbageQueue.clear();
   selectedLeaves.clear();
   visibleLeaves = 0;
 }
  protected void removeView(final GraphViewImpl view) {
    checkViewExist(view);

    int id = view.storeId;
    views[id] = null;
    garbageQueue.add(id);
    view.storeId = NULL_VIEW;

    view.destroyAllObservers();

    // Check if not visible view
    if (visibleView == view) {
      visibleView = graphStore.mainGraphView;
    }
  }
 public int size() {
   return length - garbageQueue.size();
 }