net.groboclown.xml.xdstates.v1
Interface IAttributeModule

All Known Implementing Classes:
ACount, ADefault, AFireIfPropertyEquals, AEcho, ASetProperty, AIfPropertyEquals, AJoin, AEmpty, AGetProperty, ASetPropertyValue

public interface IAttributeModule

Attribute Modules are meant to perform one thing: generate the various state combinations that can be produced from the sub-tree's generated IItem list. If on a fire( String, IDataList ) call, it has passed through all of its combinations of the list, it should return false from hasAnotherState(). If another call to fire( String, IDataList ) is done, then the module needs to reset itself to restart its combinations.

Version:
Alpha 0.9.0 - JDK 1.0+
Author:
Matt Albrecht

Method Summary
 IAttributeModule copy()
          Copy the current module, and reset the new module's state as if fire( String, IDataList ) has never been called.
 IDataList fire(String value, IDataList list)
          Perform the specific permutation of the given data list.
 boolean hasAnotherState()
          The containing application will ensure that this will only be called after each fire( String, IDataList ) call.
 void registerValueModule(IValueModule module)
          Register the given value module with this module.
 boolean shouldFireTreeParse(String value, IDataList list)
          Determines if the tree at the node in the list should be fired.
 

Method Detail

registerValueModule

public void registerValueModule(IValueModule module)
Register the given value module with this module. The attribute module does not have to accept the module, and can throw an IllegalArgumentException if it is incorrect.

copy

public IAttributeModule copy()
Copy the current module, and reset the new module's state as if fire( String, IDataList ) has never been called.

hasAnotherState

public boolean hasAnotherState()
The containing application will ensure that this will only be called after each fire( String, IDataList ) call. The fire( String, IDataList ) call should store this result at the end of the fire( String, IDataList ) method.
Returns:
true if this attribute knows of another state to transform the inner data.
See Also:
fire( String, IDataList )

shouldFireTreeParse

public boolean shouldFireTreeParse(String value,
                                   IDataList list)
Determines if the tree at the node in the list should be fired. At the point this is called, the list contains no IItems. If any attribute returns false, then the tree and its sub-nodes are not fired. However, if all the attributes return true from this method, then the tree and its sub-nodes are fired.

This is useful for performing conditional branching on a tree to prevent the sub-nodes for executing any actions which may be undesired (such as property adjustments).


fire

public IDataList fire(String value,
                      IDataList list)
Perform the specific permutation of the given data list. The implementation must store the state of the next hasAnotherState() at the end of this method.
Returns:
the new list after the attribute performs its modifications.


Written under the LGPL