|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
java.util.LinkedList<IBlock>
org.specrunner.context.core.ContextImpl
public class ContextImpl
Default context implementation.
| Field Summary | |
|---|---|
protected IChannel |
channel
The context channel. |
protected IRunner |
runner
The runner. |
protected Deque<ISource> |
sources
Queue of sources. |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Fields inherited from interface org.specrunner.context.IContext |
|---|
UPACCESS |
| Constructor Summary | |
|---|---|
ContextImpl(ISource source,
IRunner runner)
Creates a context from a source and a runner. |
|
| Method Summary | |
|---|---|
void |
addMetadata()
Add metadata from block context. |
void |
clearGlobal(String global)
Removes a variable name from global context. |
void |
clearLocal(String local)
Removes a variable name from local context. |
void |
clearScoped(String scope,
String local)
Removes a scoped variable. |
void |
clearStrict(String name)
Clear the context peek mapping from name. |
protected Object |
findName(int start,
String name)
Find an object by name. |
protected IBlock |
findNode(int start,
Class<? extends nu.xom.Node> type)
Find a node type. |
protected IBlock |
findPlugin(int start,
Class<? extends IPlugin> type)
Find a plugin by type. |
IBlock |
getByElement(Class<? extends nu.xom.Node> type)
Search a block by element type. |
Object |
getByName(String name)
Search a value by its name, from the most restricted block to the outermost (i.e. the root XML element). |
IBlock |
getByPlugin(Class<? extends IPlugin> type)
Search a block by plugin type. |
ISource |
getCurrentSource()
Get current source. |
Map<String,Object> |
getMap()
Mapping of elements related to the block. |
nu.xom.Node |
getNode()
Returns the specification node object related to the block. |
Map<String,Object> |
getObjects()
A map of all objects in context. |
IBlock |
getParentByElement(Class<? extends nu.xom.Node> type)
Strict parent search by element type. |
Object |
getParentByName(String name)
A strict parent search a value by its name, from the most restricted block to the outermost (i.e. the root XML element). |
IBlock |
getParentByPlugin(Class<? extends IPlugin> type)
Strict parent search by plugin type. |
IPlugin |
getPlugin()
The plugin related to the block. |
IRunner |
getRunner()
The runner related to the context. |
Deque<ISource> |
getSources()
Queue of sources. |
boolean |
hasChildren()
Indicates if the block node has children. |
boolean |
hasMap()
Indicates if block has a mapping or not. |
boolean |
hasNode()
Indicates if block has been created form a specification or not. |
boolean |
hasPlugin()
Indicates if block has a plugin or not. |
boolean |
isChanged()
Indicates if a given block has changed. |
boolean |
isValid()
A valid block has node ( hasNode) or plugin (
hasPlugin). |
IBlock |
newBlock(nu.xom.Node node,
IPlugin plugin)
Creates a new block. |
IBlock |
newBlock(nu.xom.Node node,
IPlugin plugin,
Map<String,Object> map)
Create a new block. |
void |
saveGlobal(String global,
Object obj)
Saves a variable with the given name to the global context (outermost block). |
void |
saveLocal(String local,
Object obj)
Saves a variable with the given name to the local context. |
void |
saveScoped(String scope,
String local,
Object obj)
Saves a variable to the given scope. |
void |
saveStrict(String local,
Object obj)
Save the value to the current context peek, no matter what type of node it is. |
void |
setChanged(boolean changed)
Sets the changed status. |
void |
setMap(Map<String,Object> map)
Sets the block mapping of object. |
void |
setNode(nu.xom.Node node)
Change block node. |
void |
setPlugin(IPlugin plugin)
Sets the block plugin. |
void |
setRunner(IRunner runner)
Sets the runner. |
void |
setSources(Deque<ISource> sources)
Sets the sources. |
| Methods inherited from class java.util.LinkedList |
|---|
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray |
| Methods inherited from class java.util.AbstractSequentialList |
|---|
iterator |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, isEmpty, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Deque |
|---|
add, addFirst, addLast, contains, descendingIterator, element, getFirst, getLast, iterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, size |
| Methods inherited from interface java.util.Collection |
|---|
addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList |
| Field Detail |
|---|
protected Deque<ISource> sources
protected IChannel channel
protected IRunner runner
| Constructor Detail |
|---|
public ContextImpl(ISource source,
IRunner runner)
throws ContextException
source - The source.runner - The runner.
ContextException - On creation errors.| Method Detail |
|---|
public Deque<ISource> getSources()
IContext
getSources in interface IContextpublic ISource getCurrentSource()
IContext
getCurrentSource in interface IContextpublic void setSources(Deque<ISource> sources)
sources - The sources.public IRunner getRunner()
IContext
getRunner in interface IContextpublic void setRunner(IRunner runner)
runner - The runner.
public void saveGlobal(String global,
Object obj)
IContext
saveGlobal in interface IContextglobal - The variable name.obj - The value.public void clearGlobal(String global)
IContext
clearGlobal in interface IContextglobal - The variable name.
public void saveLocal(String local,
Object obj)
IContext
saveLocal in interface IContextlocal - The variable name.obj - The value.public void clearLocal(String local)
IContext
clearLocal in interface IContextlocal - The variable name.
public void saveStrict(String local,
Object obj)
IContext
saveStrict in interface IContextlocal - The name.obj - The value.public void clearStrict(String name)
IContext
clearStrict in interface IContextname - The name.
public void saveScoped(String scope,
String local,
Object obj)
IContext
saveScoped in interface IContextscope - Indicates where to bind the value, i.e. when
saveScope("body","name","value") is used in a "span" tag, this
method searches for the "body" backward tag to add variable.local - The variable name.obj - The value.
public void clearScoped(String scope,
String local)
IContext
clearScoped in interface IContextscope - The scope to unbound.local - The variable name.public IBlock getByElement(Class<? extends nu.xom.Node> type)
IContext
getByElement in interface IContexttype - The type.
public IBlock getParentByElement(Class<? extends nu.xom.Node> type)
IContext
getParentByElement in interface IContexttype - The type.
protected IBlock findNode(int start,
Class<? extends nu.xom.Node> type)
start - The start index.type - The type.
public IBlock getByPlugin(Class<? extends IPlugin> type)
IContext
getByPlugin in interface IContexttype - The type.
public IBlock getParentByPlugin(Class<? extends IPlugin> type)
IContext
getParentByPlugin in interface IContexttype - The type.
protected IBlock findPlugin(int start,
Class<? extends IPlugin> type)
start - The start index.type - The type.
public Object getByName(String name)
IContext
getByName in interface IContextname - The name.
public Object getParentByName(String name)
IContext
getParentByName in interface IContextname - The name.
protected Object findName(int start,
String name)
start - The start index.name - The object name.
public Map<String,Object> getObjects()
IContext
getObjects in interface IContextpublic boolean isValid()
IBlockhasNode) or plugin (
hasPlugin). They cannot be both 'null'.
isValid in interface IBlockpublic boolean hasChildren()
IBlock
hasChildren in interface IBlockpublic boolean isChanged()
IBlock
isChanged in interface IBlockpublic void setChanged(boolean changed)
IBlock
setChanged in interface IBlockchanged - The new status.public boolean hasNode()
IBlock
hasNode in interface IBlockpublic nu.xom.Node getNode()
IBlock
getNode in interface IBlockpublic void setNode(nu.xom.Node node)
IBlock
setNode in interface IBlocknode - The new node.public boolean hasPlugin()
IBlock
hasPlugin in interface IBlockpublic IPlugin getPlugin()
IBlock
getPlugin in interface IBlockpublic void setPlugin(IPlugin plugin)
IBlock
setPlugin in interface IBlockplugin - The new plugin.public boolean hasMap()
IBlock
hasMap in interface IBlockpublic Map<String,Object> getMap()
IBlock
getMap in interface IBlockpublic void setMap(Map<String,Object> map)
IBlock
setMap in interface IBlockmap - The new mapping.
public IBlock newBlock(nu.xom.Node node,
IPlugin plugin)
IBlockFactory
newBlock in interface IBlockFactorynode - A node.plugin - A plugin.
public IBlock newBlock(nu.xom.Node node,
IPlugin plugin,
Map<String,Object> map)
IBlockFactory
newBlock in interface IBlockFactorynode - A node.plugin - A plugin.map - An object mapping.
public void addMetadata()
IContext
addMetadata in interface IContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||