org.eclipse.emf.ecp.common.cachetree
Class CachedTreeNode<T>

java.lang.Object
  extended by org.eclipse.emf.ecp.common.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 Object

A node within an AbstractCachedTree.

Author:
emueller, Tobias Verhoeven

Constructor Summary
CachedTreeNode(T initialValue)
          Constructor.
 
Method Summary
 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.
 void setOwnValue(T newValue)
          Sets the value of this node.
 void setParent(Object parent)
           
 Collection<T> values()
          Returns the cached values that are stored in the children nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedTreeNode

public CachedTreeNode(T initialValue)
Constructor.

Parameters:
initialValue - the initial value
Method Detail

putIntoCache

public void putIntoCache(Object key,
                         T value)
Puts a value into the cache and updates its value.

Parameters:
key - the (child) object that contains the given value
value - an additional value that will be considered for the computation of the actual value that results to a update() call

removeFromCache

public void removeFromCache(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 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

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 Object getParent()
Returns:
the parent object, this is not the parent tree node.

setParent

public void setParent(Object parent)
Parameters:
parent - the parent to set, this is not the parent tree node.


Copyright © 2014. All Rights Reserved.