org.ujoframework.core
Class UjoComparator

java.lang.Object
  extended by org.ujoframework.core.UjoComparator
All Implemented Interfaces:
java.util.Comparator<Ujo>

public class UjoComparator
extends java.lang.Object
implements java.util.Comparator<Ujo>

A generic comparator for the Ujo objects. A direction is the sorting is controlled by attribute UjoProperty.isAscending() .

Author:
Pavel Ponec
See Also:
UjoProperty.isAscending(), UjoProperty.descending()

Constructor Summary
UjoComparator(UjoProperty... properties)
          Creates a new instance of UjoComparator
 
Method Summary
 int compare(Ujo u1, Ujo u2)
          Compare two Ujo objects.
 boolean equals(Ujo u1, Ujo u2)
          An equals test
static UjoComparator newInstance(UjoProperty... properties)
          Create new comparator
 java.lang.String toString()
          A String reprezentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

UjoComparator

public UjoComparator(UjoProperty... properties)
Creates a new instance of UjoComparator

Parameters:
properties - sorting criteria are ordered by importance to down. A direction of the sorting is used by a method UjoProperty#isAscending().
See Also:
UjoProperty.isAscending(), UjoProperty.descending()
Method Detail

compare

public int compare(Ujo u1,
                   Ujo u2)
Compare two Ujo objects.

Specified by:
compare in interface java.util.Comparator<Ujo>
Parameters:
u1 - Ujo Object 1
u2 - Ujo Object 2
Returns:
Result of comparation

toString

public java.lang.String toString()
A String reprezentation.

Overrides:
toString in class java.lang.Object

equals

public final boolean equals(Ujo u1,
                            Ujo u2)
An equals test


newInstance

public static UjoComparator newInstance(UjoProperty... properties)
Create new comparator



Copyright © 2010. All Rights Reserved.