org.specrunner.context.core
Class BlockImpl

java.lang.Object
  extended by org.specrunner.context.core.BlockImpl
All Implemented Interfaces:
IBlock

public class BlockImpl
extends Object
implements IBlock

Default block implementation.

Author:
Thiago Santos

Field Summary
protected  boolean changed
          Hold if changes have been made to the block.
protected  Map<String,Object> map
          The mapping of objects.
protected  nu.xom.Node node
          The block node.
protected  IPlugin plugin
          The plugin node.
 
Constructor Summary
BlockImpl(nu.xom.Node node, IPlugin plugin, Map<String,Object> map)
          Creates a block with node, plugin and mapping.
 
Method Summary
 Map<String,Object> getMap()
          Mapping of elements related to the block.
 nu.xom.Node getNode()
          Returns the specification node object related to the block.
 IPlugin getPlugin()
          The plugin related to the block.
 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).
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

changed

protected boolean changed
Hold if changes have been made to the block.


node

protected nu.xom.Node node
The block node.


plugin

protected IPlugin plugin
The plugin node.


map

protected Map<String,Object> map
The mapping of objects.

Constructor Detail

BlockImpl

public BlockImpl(nu.xom.Node node,
                 IPlugin plugin,
                 Map<String,Object> map)
Creates a block with node, plugin and mapping.

Parameters:
node - The node.
plugin - The plugin.
map - The mapping.
Method Detail

isValid

public boolean isValid()
Description copied from interface: IBlock
A valid block has node (hasNode) or plugin ( hasPlugin). They cannot be both 'null'.

Specified by:
isValid in interface IBlock
Returns:
true, if valid, false otherwise.

hasChildren

public boolean hasChildren()
Description copied from interface: IBlock
Indicates if the block node has children.

Specified by:
hasChildren in interface IBlock
Returns:
true, if is not terminal in the specification, false, otherwise.

isChanged

public boolean isChanged()
Description copied from interface: IBlock
Indicates if a given block has changed.

Specified by:
isChanged in interface IBlock
Returns:
true, if the content of block has changed, false, otherwise.

setChanged

public void setChanged(boolean changed)
Description copied from interface: IBlock
Sets the changed status.

Specified by:
setChanged in interface IBlock
Parameters:
changed - The new status.

hasNode

public boolean hasNode()
Description copied from interface: IBlock
Indicates if block has been created form a specification or not.

Specified by:
hasNode in interface IBlock
Returns:
True, if it has node attached to it, false, otherwise.

getNode

public nu.xom.Node getNode()
Description copied from interface: IBlock
Returns the specification node object related to the block.

Specified by:
getNode in interface IBlock
Returns:
The block node.

setNode

public void setNode(nu.xom.Node node)
Description copied from interface: IBlock
Change block node.

Specified by:
setNode in interface IBlock
Parameters:
node - The new node.

hasPlugin

public boolean hasPlugin()
Description copied from interface: IBlock
Indicates if block has a plugin or not.

Specified by:
hasPlugin in interface IBlock
Returns:
True, if it has a plugin attached to it, false, otherwise.

getPlugin

public IPlugin getPlugin()
Description copied from interface: IBlock
The plugin related to the block.

Specified by:
getPlugin in interface IBlock
Returns:
The block plugin.

setPlugin

public void setPlugin(IPlugin plugin)
Description copied from interface: IBlock
Sets the block plugin.

Specified by:
setPlugin in interface IBlock
Parameters:
plugin - The new plugin.

hasMap

public boolean hasMap()
Description copied from interface: IBlock
Indicates if block has a mapping or not.

Specified by:
hasMap in interface IBlock
Returns:
True, if it has a map attached to it, false, otherwise.

getMap

public Map<String,Object> getMap()
Description copied from interface: IBlock
Mapping of elements related to the block. This mapping is responsible for the storage of variables and elements that are expected to be shared between plugins.

Specified by:
getMap in interface IBlock
Returns:
An object mapping.

setMap

public void setMap(Map<String,Object> map)
Description copied from interface: IBlock
Sets the block mapping of object.

Specified by:
setMap in interface IBlock
Parameters:
map - The new mapping.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All rights reserved.