org.reprap.geometry.polygons
Class treeList

java.lang.Object
  extended by org.reprap.geometry.polygons.treeList

 class treeList
extends java.lang.Object

tree - class to hold lists to build a containment tree (that is a representation of which polygon is inside which, like a Venn diagram).


Field Summary
private  boolean beingDestroyed
          Flag to prevent cyclic graphs going round forever
private  java.util.List<treeList> children
          The polygons inside this one
private  int index
          Index of this polygon in the list
private  treeList parent
          The polygon that contains this one
 
Constructor Summary
treeList(int i)
          Constructor builds from a polygon index
 
Method Summary
 void addChild(treeList t)
          Add a polygon as a child of this one
 RrCSG buildCSG(java.util.List<RrCSG> csgPols)
          Walk the tree building a CSG expression to represent all the polygons as one thing.
 void destroy()
          Destroy me and all that I point to
 treeList getChild(int i)
          Get the ith polygon child of this one
 treeList getParent()
          Get the parent
 int polygonIndex()
          get the index of the polygon
 void remove(treeList t)
          Remove every instance of polygon t from the list
 void setParents()
          Do a depth-first walk setting parents.
 int size()
          How long is the list (if any)
 java.lang.String toString()
          Printable form
 treeList walkFind(int target)
          Recursively walk the tree from here to find polygon target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

private int index
Index of this polygon in the list


children

private java.util.List<treeList> children
The polygons inside this one


parent

private treeList parent
The polygon that contains this one


beingDestroyed

private boolean beingDestroyed
Flag to prevent cyclic graphs going round forever

Constructor Detail

treeList

public treeList(int i)
Constructor builds from a polygon index

Parameters:
i -
Method Detail

destroy

public void destroy()
Destroy me and all that I point to


addChild

public void addChild(treeList t)
Add a polygon as a child of this one

Parameters:
t -

getChild

public treeList getChild(int i)
Get the ith polygon child of this one

Parameters:
i -
Returns:

getParent

public treeList getParent()
Get the parent

Returns:

size

public int size()
How long is the list (if any)

Returns:

toString

public java.lang.String toString()
Printable form

Overrides:
toString in class java.lang.Object

remove

public void remove(treeList t)
Remove every instance of polygon t from the list

Parameters:
t -

walkFind

public treeList walkFind(int target)
Recursively walk the tree from here to find polygon target.

Parameters:
node -
target -
Returns:

buildCSG

public RrCSG buildCSG(java.util.List<RrCSG> csgPols)
Walk the tree building a CSG expression to represent all the polygons as one thing.

Parameters:
csgPols -
Returns:

setParents

public void setParents()
Do a depth-first walk setting parents. Any node that appears in more than one list should have the deepest possible parent set as its parent, which is what we want.

Parameters:
node -

polygonIndex

public int polygonIndex()
get the index of the polygon

Returns: