T
- The metadata type.S
- The partition tree type.public abstract class PartitionTree<T,S extends PartitionTree<T,S>> extends RenderableObject
KDTree
,
ConjugationTree
Modifier and Type | Field and Description |
---|---|
private java.util.List<T> |
data
The data stored in this cell.
|
private boolean |
marked
Whether this partition tree is marked or not, used for animation.
|
Constructor and Description |
---|
PartitionTree() |
Modifier and Type | Method and Description |
---|---|
void |
addData(T obj)
Adds an object to store at this tree node.
|
abstract java.util.List<S> |
getChildren()
Gets the child nodes of this tree node.
|
java.util.List<T> |
getData()
Gets the data stored at this tree node.
|
int |
getDepth()
Gets the depth of this cell in the partition tree.
|
int |
getHeight()
Gets the height of the partition tree this
cell is a part of.
|
abstract S |
getParent()
Gets the parent tree node of this node.
|
abstract S |
getSelf()
Gets 'this' partition tree.
|
abstract java.awt.Shape |
getShape()
Gets the shape defining the boundary of this tree cell.
|
abstract boolean |
isLeafCell()
Checks if this tree node is a leaf cell.
|
void |
render(java.awt.Graphics2D g)
Renders this object.
|
void |
setMarked(boolean marked)
Sets whether this partition tree is marked or not.
|
java.util.stream.Stream<S> |
streamCells()
Streams all the cells (both leaf and internal) in this tree.
|
java.util.stream.Stream<S> |
streamLeafCells()
Streams all the leaf cells in this tree.
|
getAnimation, hasAnimation, renderOrAnimate, runAnimation, setAnimation
private java.util.List<T> data
private boolean marked
public void setMarked(boolean marked)
marked
- True to mark this tree.public void addData(T obj)
obj
- The object to store.public java.util.List<T> getData()
public int getHeight()
public int getDepth()
public java.util.stream.Stream<S> streamLeafCells()
public java.util.stream.Stream<S> streamCells()
public abstract boolean isLeafCell()
public abstract java.util.List<S> getChildren()
public abstract S getParent()
null
if this is node
is the root node of the tree.public abstract java.awt.Shape getShape()
public abstract S getSelf()
public void render(java.awt.Graphics2D g)
RenderableObject
render
in class RenderableObject
g
- The graphics context to use.