edu.northwestern.at.wordhoard.model.grouping
Class GroupingOptions

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.grouping.GroupingOptions

public class GroupingOptions
extends java.lang.Object

A set of grouping options.


Field Summary
static int ASCENDING
          Ascending option.
static int DESCENDING
          Descending option.
static int NUM_ORDER_BY
          Number of order by options.
static int ORDER_ALPHABETICALLY
          Order alphapetically option.
static int ORDER_BY_COUNT
          Order by count (number of matches) option.
static int ORDER_BY_DATE
          Order by date option.
static int ORDER_BY_FREQUENCY
          Order by frequency option.
static int ORDER_BY_LOCATION
          Order by word tag option.
static java.lang.String[] ORDER_BY_NAMES
          Ordering option names.
static java.lang.String[] UP_DOWN_NAMES
          Ascending/descending option names.
 
Constructor Summary
GroupingOptions(java.lang.Class groupBy, int orderBy, int upDown)
          Creates a new set of grouping options.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
 java.lang.Class getGroupBy()
          Gets the grouping option.
 int getOrderBy()
          Gets the ordering option.
 int getUpDown()
          Gets the ascending/descending option.
 java.util.Map group(java.util.Collection results)
          Groups a collection of search results.
 void setGroupBy(java.lang.Class groupBy)
          Sets the grouping option.
 void setOrderBy(int orderBy)
          Sets the ordering option.
 void setUpDown(int upDown)
          Sets the ascending/descending option.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORDER_BY_FREQUENCY

public static final int ORDER_BY_FREQUENCY
Order by frequency option.

See Also:
Constant Field Values

ORDER_BY_COUNT

public static final int ORDER_BY_COUNT
Order by count (number of matches) option.

See Also:
Constant Field Values

ORDER_ALPHABETICALLY

public static final int ORDER_ALPHABETICALLY
Order alphapetically option.

See Also:
Constant Field Values

ORDER_BY_DATE

public static final int ORDER_BY_DATE
Order by date option.

See Also:
Constant Field Values

ORDER_BY_LOCATION

public static final int ORDER_BY_LOCATION
Order by word tag option.

See Also:
Constant Field Values

NUM_ORDER_BY

public static final int NUM_ORDER_BY
Number of order by options.

See Also:
Constant Field Values

ORDER_BY_NAMES

public static final java.lang.String[] ORDER_BY_NAMES
Ordering option names.


ASCENDING

public static final int ASCENDING
Ascending option.

See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
Descending option.

See Also:
Constant Field Values

UP_DOWN_NAMES

public static final java.lang.String[] UP_DOWN_NAMES
Ascending/descending option names.

Constructor Detail

GroupingOptions

public GroupingOptions(java.lang.Class groupBy,
                       int orderBy,
                       int upDown)
Creates a new set of grouping options.

Parameters:
groupBy - Grouping class.
orderBy - Ordering option.
upDown - Ascending/descending option.
Method Detail

getGroupBy

public java.lang.Class getGroupBy()
Gets the grouping option.

Returns:
Grouping class.

setGroupBy

public void setGroupBy(java.lang.Class groupBy)
Sets the grouping option.

Parameters:
groupBy - Grouping class.

getOrderBy

public int getOrderBy()
Gets the ordering option.

Returns:
Ordering option.

setOrderBy

public void setOrderBy(int orderBy)
Sets the ordering option.

Parameters:
orderBy - Ordering option.

getUpDown

public int getUpDown()
Gets the ascending/descending option.

Returns:
Ascending/descending option.

setUpDown

public void setUpDown(int upDown)
Sets the ascending/descending option.

Parameters:
upDown - Ascending/descending option.

group

public java.util.Map group(java.util.Collection results)
Groups a collection of search results.

The groupBy class must not be null.

If the orderBy option is ORDER_BY_FREQUENCY, the groupBy class must implement the CanGetRelFreq interface.

If the orderBy option is ORDER_BY_LOCATION, the groupBy class must be WorkPart.class.

If the orderBy option is ORDER_BY_DATE, the groupBy class must be Work.class, PubYearRange.class, or PubDecade.class.

Parameters:
results - Collection of search results.
Returns:
An ordered map from grouping objects to array lists of search results.

equals

public boolean equals(java.lang.Object obj)
Returns true if some other object is equal to this one.

The two sets of grouping options are equal if all three of their component options are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The other object.
Returns:
True if this object equals the other object.