net.groboclown.xml.xdstates.v1.modules
Class AIfPropertyEquals

java.lang.Object
  |
  +--net.groboclown.xml.xdstates.v1.modules.AIfPropertyEquals
All Implemented Interfaces:
IAttributeModule

public class AIfPropertyEquals
extends Object
implements IAttributeModule

This module returns the first element only if the given expression is true, and if not true then it returns the remaining elements (which may be empty). The attribute's format is "name:value", where the separator character is a colon (':'). If the value starts with the character '!', then the set is executed only if the property does not equal the given value. To specify that the property must not be set, use "prop:", and to specify that the property must be set to something, use "prop:!".

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

Constructor Summary
AIfPropertyEquals()
           
 
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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

AIfPropertyEquals

public AIfPropertyEquals()
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.
Specified by:
registerValueModule in interface IAttributeModule

copy

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

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.
Specified by:
hasAnotherState in interface IAttributeModule
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).

Specified by:
shouldFireTreeParse in interface IAttributeModule

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.
Specified by:
fire in interface IAttributeModule
Returns:
the new list after the attribute performs its modifications.


Written under the LGPL