|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vinculumtech.platform.util.context.ContextTree
The ContextTree class takes a set of unique keys and returns a context sensitive value.
The ContextTree can be used in three ways. As a static "map", relating a set of unique keys to a single value.
As a cummunlative map, relating a set of unique keys to a factory object which is passed a value returned by its
parent, and a value associated with the context key, and returns a new value. Or as a combination of both.
Constructor Summary | |
ContextTree()
|
|
ContextTree(java.lang.Object rootValue)
Creates a ContextTree that |
Method Summary | |
ContextNode |
addChildNode(java.lang.String contextElement)
Add new branch for key, returns same values as parent. |
ContextNode |
addChildNode(java.lang.String contextElement,
Function valueFunction)
Add new branch for key, result value is a result of the given Function. This method accepts either a NullaryFunction, UnaryFunction, BinaryFunction, or a TernaryFunction. |
ContextNode |
addChildNode(java.lang.String contextElement,
java.lang.Object value)
Add new branch for key, always return given value. |
java.lang.Object |
getCummulativeValueFor(java.util.Map contextMap)
Returns the factory created value for the given contextMap. |
java.lang.Object |
getValueFor(java.util.Collection context)
Returns the static value for the given contextMap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ContextTree()
public ContextTree(java.lang.Object rootValue)
rootValue
- Method Detail |
public ContextNode addChildNode(java.lang.String contextElement, java.lang.Object value)
contextElement
- value
-
public ContextNode addChildNode(java.lang.String contextElement, Function valueFunction)
contextElement
- valueFunction
-
public ContextNode addChildNode(java.lang.String contextElement)
contextElement
-
public java.lang.Object getCummulativeValueFor(java.util.Map contextMap)
contextMap
-
public java.lang.Object getValueFor(java.util.Collection context)
context
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |