Class CachedTreeNode<T>
- java.lang.Object
-
- org.eclipse.emf.ecp.common.spi.cachetree.CachedTreeNode<T>
-
- Type Parameters:
T
- the type of the value stored by this node
- Direct Known Subclasses:
EMFStoreDirtyDecoratorCachedTree.CachedDirtyStateTreeNode
,ValidationService.CachedSeverityTreeNode
public abstract class CachedTreeNode<T> extends java.lang.Object
A node within anAbstractCachedTree
.- Since:
- 1.5
- Author:
- emueller, Tobias Verhoeven
-
-
Constructor Summary
Constructors Constructor Description CachedTreeNode(T initialValue)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.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.java.lang.Object
getParent()
void
putIntoCache(java.lang.Object key, T value)
Puts a value into the cache and updates its value.void
removeFromCache(java.lang.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(java.lang.Object parent)
protected abstract void
update()
Recomputes the cached value of this node.java.util.Collection<T>
values()
Returns the cached values that are stored in the children nodes.
-
-
-
Constructor Detail
-
CachedTreeNode
public CachedTreeNode(T initialValue)
Constructor.- Parameters:
initialValue
- the initial value
-
-
Method Detail
-
update
protected abstract void update()
Recomputes the cached value of this node.
-
putIntoCache
public void putIntoCache(java.lang.Object key, T value)
Puts a value into the cache and updates its value.- Parameters:
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 aupdate()
call
-
removeFromCache
public void removeFromCache(java.lang.Object key)
Removes a (child) object from the cache and updates its value.- Parameters:
key
- the object to be removed
-
getOwnValue
public T getOwnValue()
Returns the value of this node.- Returns:
- the value stored within this node
-
setOwnValue
public void setOwnValue(T newValue)
Sets the value of this node.- Parameters:
newValue
- the new value to be associated with this node
-
values
public java.util.Collection<T> values()
Returns the cached values that are stored in the children nodes.- Returns:
- a set of values stored in the children nodes of this node
-
getChildValue
public T getChildValue()
Returns the most severe cached value of all children.- Returns:
- the childValue
-
setChildValue
protected void setChildValue(T childValue)
Sets the the most severe cached value of all children.- Parameters:
childValue
- the childValue to set
-
getDisplayValue
public abstract T getDisplayValue()
Returns the value that this node should represent. This value is also passed to parents in case of changes to the tree.- Returns:
- the display value
-
getParent
public java.lang.Object getParent()
- Returns:
- the parent object, this is not the parent tree node.
-
setParent
public void setParent(java.lang.Object parent)
- Parameters:
parent
- the parent to set, this is not the parent tree node.
-
getCache
protected final java.util.Map<java.lang.Object,T> getCache()
Returns the internal representation of the child value cache.- Returns:
- the cache
- Since:
- 1.9
-
-