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

java.lang.Object
  |
  +--net.groboclown.xml.xdstates.v1.modules.AbstractVSort
All Implemented Interfaces:
IValueModule
Direct Known Subclasses:
VSortAscending

public abstract class AbstractVSort
extends Object
implements IValueModule

A generic value module that performs a sort using Comparators.

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

Field Summary
private static String[] values
           
 
Constructor Summary
AbstractVSort(String[] values)
           
 
Method Summary
 boolean checkValue(String value)
           
abstract  IValueModule copy()
           
protected abstract  Comparator createComparator()
          Create a Comparator for the sort.
 IDataList fire(String value, IDataList orig)
          Fire the module.
 boolean shouldFireTreeParse(String value, IDataList list)
          Used to determine the owning IAttributeModule's return value from the method with the same name.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

values

private static String[] values
Constructor Detail

AbstractVSort

public AbstractVSort(String[] values)
Method Detail

copy

public abstract IValueModule copy()
Specified by:
copy in interface IValueModule

createComparator

protected abstract Comparator createComparator()
Create a Comparator for the sort.

checkValue

public boolean checkValue(String value)
Specified by:
checkValue in interface IValueModule
Returns:
true if the given value is OK for firing in this module.

shouldFireTreeParse

public boolean shouldFireTreeParse(String value,
                                   IDataList list)
Used to determine the owning IAttributeModule's return value from the method with the same name.

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 IValueModule

fire

public IDataList fire(String value,
                      IDataList orig)
Fire the module.
Specified by:
fire in interface IValueModule
Returns:
the new list of data, or null if there is no change.


Written under the LGPL