T
- the actual value type that is stored by the treepublic abstract class AbstractCachedTree<T> extends Object
Constructor and Description |
---|
AbstractCachedTree(IExcludedObjectsCallback callback)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the cache.
|
protected abstract CachedTreeNode<T> |
createdCachedTreeNode(T value)
Creates a cached tree node.
|
T |
getCachedValue(Object eObject)
Returns the cached value stored for the given
EObject . |
abstract T |
getDefaultValue()
Returns the default value for a cached node.
The root value will be initialized with this value, too |
protected Map<Object,CachedTreeNode<T>> |
getNodes()
Gets the Nodes of the cached tree containing necessary information.
|
T |
getRootValue()
Returns the root value of this tree.
Note that the root is purely notional. |
void |
remove(org.eclipse.emf.ecore.EObject eObject)
Removes the cache entry that contains the given
EObject . |
Set<org.eclipse.emf.ecore.EObject> |
update(org.eclipse.emf.ecore.EObject eObject,
T value)
Updates the cached entry for the given
EObject with the given value.If the cached entry does not yet exist, it will be created. |
protected void |
updateNodeObject(Object object)
Helper method which gets called when an update on the specified object is performed.
|
protected void |
updateParentNode(Object parent,
Object object,
T value)
Updates the passed parent nodes cached value.
|
public AbstractCachedTree(IExcludedObjectsCallback callback)
callback
- the IExcludedObjectsCallback
to use when checking when to stopprotected Map<Object,CachedTreeNode<T>> getNodes()
public abstract T getDefaultValue()
protected abstract CachedTreeNode<T> createdCachedTreeNode(T value)
value
- the value stored by the cached tree nodepublic Set<org.eclipse.emf.ecore.EObject> update(org.eclipse.emf.ecore.EObject eObject, T value)
EObject
with the given value.eObject
- the EObject
value
- the value associated with the EObject
protected void updateNodeObject(Object object)
object
- The upject for which an update on the tree is performedpublic T getRootValue()
public T getCachedValue(Object eObject)
EObject
.eObject
- the EObject
whose cached value should be foundEObject
, if found, otherwise
the default value which is returned via getDefaultValue()
public void remove(org.eclipse.emf.ecore.EObject eObject)
EObject
.eObject
- the EObject
that needs to be removed from the cached treeprotected void updateParentNode(Object parent, Object object, T value)
parent
- the parent object to be updatedobject
- the object for which the cached value should be changed.value
- the the cached value for the objectpublic void clear()
Copyright © 2019. All rights reserved.