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; }
protected void removeLeaf(final Octant octant) { int id = octant.leafId; leaves[id] = null; leavesCount--; garbageQueue.add(id); octant.leafId = NULL_ID; }
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(); }