com.raritantechnologies.utils.comparators
Class CompositeComparator

java.lang.Object
  extended bycom.raritantechnologies.utils.comparators.CompositeComparator
All Implemented Interfaces:
java.util.Comparator, IComparator, IConfigurable

public class CompositeComparator
extends java.lang.Object
implements IComparator

Comparator that contains a set of child Comparators - with any/all/exclude logic.

XML Configuration Template:
  <Comparator class="com.raritantechnologies.utils.comparators.CompositeComparator" >

     <!-- Comparators that will cause this comparator to return false -->
     <ExcludeComparators >
        <Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >

        </Comparator>

        <Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >

        </Comparator>

        <!-- etc... -->

     </ExcludeComparators>

     <!-- Comparators that will cause this comparator to return true -->
     <IncludeComparators
           matchIfAll="true|false(default)" >

        <Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >

        </Comparator>

        <Comparator class="[ com.raritantechnologies.utils.comparators.IComparator ]" >

        </Comparator>

        <!-- etc... -->

     </IncludeComparators>

  </Comparator>
 

Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
static boolean MATCH_IF_ALL
           
static boolean MATCH_IF_ANY
           
 
Fields inherited from interface com.raritantechnologies.utils.comparators.IComparator
TEMPLATE
 
Constructor Summary
CompositeComparator()
           
CompositeComparator(boolean matchIfAll)
           
 
Method Summary
 void addExcludeComparator(IComparator excludeComparator)
           
 void addIncludeComparator(IComparator includeComparator)
           
 int compare(java.lang.Object ob1, java.lang.Object ob2)
           
 boolean equals(java.lang.Object object)
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MATCH_IF_ALL

public static final boolean MATCH_IF_ALL
See Also:
Constant Field Values

MATCH_IF_ANY

public static final boolean MATCH_IF_ANY
See Also:
Constant Field Values
Constructor Detail

CompositeComparator

public CompositeComparator()

CompositeComparator

public CompositeComparator(boolean matchIfAll)
Method Detail

addIncludeComparator

public void addIncludeComparator(IComparator includeComparator)

addExcludeComparator

public void addExcludeComparator(IComparator excludeComparator)

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface java.util.Comparator

compare

public int compare(java.lang.Object ob1,
                   java.lang.Object ob2)
Specified by:
compare in interface java.util.Comparator

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)