NaturalOrderProcessor
imlements a natural order sorting mechanism for rresult trees in DocHelper.
More...
Public Member Functions | |
ResultNode | operate (ResultNode doc) |
Performs an operation on a ResultNode tree and returns the resulting tree after the operation. | |
void | setParam (String paramName, Object value) throws IllegalParamterTypeException |
Add a parameter to the Configurable. | |
void | checkParams () throws InvalidValueException, MissingArgumentException, ResourceUnavailableException |
Checks that the parameters are correct for this type of Renderer. | |
void | init () throws InitializationException, ResourceUnavailableException |
Initialize the Renderer. | |
Protected Attributes | |
HashMap< String, Object > | params = new HashMap<String, Object>() |
The paramters that describe this Processor. | |
Static Protected Attributes | |
static final String | DIRECTION = "direction" |
The direction param name for the nautal order processor (asc-desc). | |
static final String | SORT_PARAM = "sortparam" |
Private Member Functions | |
void | orderTree (ResultNode doc) |
Classes | |
class | ParamResultNodeComparator |
NaturalOrderProcessor
imlements a natural order sorting mechanism for rresult trees in DocHelper.
It implements the Processor
interface in order to perform this task.
In order to perform its, task, and depending on the direction parameter, the class uses the java TreeMap that nativley implements a sorted tree using Natural order.
The result of executing this Processor on a ResultNode that represents the root of a tree will be to sort all of the leaf nodes in reference only with their sibilings. For this generic processor it is not of to sort leaf nodes with regards to leafs in other sections of the tree becuase this could imply chnaging the structure of the tree(shuffling nodes). In DocHelper the first levels of the tree have semantic meaning: Document --> ReecordSet --> Record. Assigning a match within one Record to another record in other to sort all matches looses information. (In what record a match was found.)
Definition at line 44 of file NaturalOrderParamProcessor.java.
ResultNode dochelper.NaturalOrderParamProcessor.operate | ( | ResultNode | doc | ) |
Performs an operation on a ResultNode tree and returns the resulting tree after the operation.
doc | The node that represent the root of the tree to process. |
Exception |
Implements dochelper.Processor.
Definition at line 59 of file NaturalOrderParamProcessor.java.
void dochelper.NaturalOrderParamProcessor.orderTree | ( | ResultNode | doc | ) | [private] |
Definition at line 69 of file NaturalOrderParamProcessor.java.
void dochelper.NaturalOrderParamProcessor.setParam | ( | String | paramName, | |
Object | value | |||
) | throws IllegalParamterTypeException |
Add a parameter to the Configurable.
This mechanism allows options to be set for the Configurable. Things like output path, input path, table names, file types, gob patterns, etc should be passed by setting the appropriate params for a Configurable object. DocHelper will guarantee the following execution flow for all Configurables setParam(), checkParams() and init(). It is the responsibility of this method to check correct types for params used.
paramName | String Name of the paramter to be stored | |
value | String value of the named param |
IllegalParamterTypeException |
Implements dochelper.Configurable.
Definition at line 84 of file NaturalOrderParamProcessor.java.
void dochelper.NaturalOrderParamProcessor.checkParams | ( | ) | throws InvalidValueException, MissingArgumentException, ResourceUnavailableException |
Checks that the parameters are correct for this type of Renderer.
Implementor should make sure that required parameters are validated and that any semantic and format rules are enforced. DocHelper guarantees that this method will be called before init() and execute();
This method will not return a boolean indicating success, rather, it will fire an Exception indicating error type
InvalidValueException | ||
MissingArgumentException | ||
ResourceUnavailableException |
Implements dochelper.Configurable.
Definition at line 89 of file NaturalOrderParamProcessor.java.
void dochelper.NaturalOrderParamProcessor.init | ( | ) | throws InitializationException, ResourceUnavailableException |
Initialize the Renderer.
The implementor should have this method initialize any connections, file checking, class loading etc, that are neccessary setting up properly for use by the execute method.
InitializationException | ||
ResourceUnavailableException |
Implements dochelper.Configurable.
Definition at line 101 of file NaturalOrderParamProcessor.java.
final String dochelper.NaturalOrderParamProcessor.DIRECTION = "direction" [static, protected] |
The direction param name for the nautal order processor (asc-desc).
Definition at line 50 of file NaturalOrderParamProcessor.java.
final String dochelper.NaturalOrderParamProcessor.SORT_PARAM = "sortparam" [static, protected] |
Definition at line 51 of file NaturalOrderParamProcessor.java.
HashMap<String, Object> dochelper.NaturalOrderParamProcessor.params = new HashMap<String, Object>() [protected] |
The paramters that describe this Processor.
Definition at line 56 of file NaturalOrderParamProcessor.java.