inonit.domain.game.card
Class Card.Order

java.lang.Object
  |
  +--inonit.domain.game.card.Card.Order
All Implemented Interfaces:
Sort.Order
Enclosing class:
Card

public abstract static class Card.Order
extends java.lang.Object
implements Sort.Order

A logical ordering of a set of Cards.


Constructor Summary
protected Card.Order()
          Constructor used by subclasses.
 
Method Summary
protected abstract  Sort.Action compare(Card one, Card two)
          Should return the correct Sort.Action to take when comparing Cards.
 Sort.Action compare(java.lang.Object first, java.lang.Object second)
          Implements the Sort.Order.compare method by invoking this object's compare(Card,Card) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Card.Order

protected Card.Order()
Constructor used by subclasses.
Method Detail

compare

public final Sort.Action compare(java.lang.Object first,
                                 java.lang.Object second)
Implements the Sort.Order.compare method by invoking this object's compare(Card,Card) method.
Specified by:
compare in interface Sort.Order
Following copied from interface: inonit.domain.game.card.Sort.Order
Parameters:
first - an object in the array being sorted.
second - another object in the array being sorted.
Returns:
An action to take when sorting the given objects. If first should come before second in the array, LEAVE should be returned. If second should come before first, SWAP should be returned. If this Order considers the two objects equal, EQUAL should be returned. Must not return null.

compare

protected abstract Sort.Action compare(Card one,
                                       Card two)
Should return the correct Sort.Action to take when comparing Cards.
Parameters:
one - A Card to compare.
two - Another Card to compare.
Returns:
An action to take when comparing the two Cards. See compare(Card,Card) for details.