T
- the type of the value stored by this nodepublic abstract class CachedTreeNode<T> extends Object
AbstractCachedTree
.Constructor and Description |
---|
CachedTreeNode(T initialValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Map<Object,T> |
getCache()
Returns the internal representation of the child value cache.
|
T |
getChildValue()
Returns the most severe cached value of all children.
|
abstract T |
getDisplayValue()
Returns the value that this node should represent.
|
T |
getOwnValue()
Returns the value of this node.
|
Object |
getParent() |
void |
putIntoCache(Object key,
T value)
Puts a value into the cache and updates its value.
|
void |
removeFromCache(Object key)
Removes a (child) object from the cache and updates its value.
|
protected void |
setChildValue(T childValue)
Sets the the most severe cached value of all children.
|
void |
setOwnValue(T newValue)
Sets the value of this node.
|
void |
setParent(Object parent) |
protected abstract void |
update()
Recomputes the cached value of this node.
|
Collection<T> |
values()
Returns the cached values that are stored in the children nodes.
|
public CachedTreeNode(T initialValue)
initialValue
- the initial valueprotected abstract void update()
public void putIntoCache(Object key, T value)
key
- the (child) object that contains the given valuevalue
- an additional value that will be considered for the computation of the
actual value that results to a update()
callpublic void removeFromCache(Object key)
key
- the object to be removedpublic T getOwnValue()
public void setOwnValue(T newValue)
newValue
- the new value to be associated with this nodepublic Collection<T> values()
public T getChildValue()
protected void setChildValue(T childValue)
childValue
- the childValue to setpublic abstract T getDisplayValue()
public Object getParent()
public void setParent(Object parent)
parent
- the parent to set, this is not the parent tree node.Copyright © 2018. All rights reserved.