com.binaryfantasy.murq.content
Class ContentComparator

java.lang.Object
  extended by com.binaryfantasy.murq.content.ContentComparator
All Implemented Interfaces:
Comparator<IContent>

public class ContentComparator
extends Object
implements Comparator<IContent>

Provides a properties based comparator for IContent objects.

Author:
Bill Weiss

Constructor Summary
ContentComparator(String property)
          Construct a comparator that compares based on the single property.
ContentComparator(String[] properties)
          Construct a comparator that compares based on the properties, with the 0 index having the highest priority and so on.
ContentComparator(String[] properties, boolean desc)
          Construct a comparator that compares based on the properties, with the 0 index having the highest priority and so on.
ContentComparator(String property, boolean desc)
          Construct a comparator that compares based on the single property.
 
Method Summary
 int compare(IContent content1, IContent content2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ContentComparator

public ContentComparator(String property)
Construct a comparator that compares based on the single property.

Parameters:
property - name of the property to use for comparison.

ContentComparator

public ContentComparator(String[] properties)
Construct a comparator that compares based on the properties, with the 0 index having the highest priority and so on.

Parameters:
properties - names of the properties to use for comparison.

ContentComparator

public ContentComparator(String property,
                         boolean desc)
Construct a comparator that compares based on the single property.

Parameters:
property - name of the property to use for comparison.
desc - true causes comparisons to be performed in reverse.

ContentComparator

public ContentComparator(String[] properties,
                         boolean desc)
Construct a comparator that compares based on the properties, with the 0 index having the highest priority and so on.

Parameters:
properties - names of the properties to use for comparison.
desc - true causes comparisons to be performed in reverse.
Method Detail

compare

public int compare(IContent content1,
                   IContent content2)
Specified by:
compare in interface Comparator<IContent>


Copyright (c) 2000-2006, BinaryFantasy.com