jbpm-form-modeler-common 6.1.0.Beta3

org.jbpm.formModeler.service.comparator
Class ComparatorUtils

java.lang.Object
  extended by org.jbpm.formModeler.service.comparator.ComparatorUtils

public class ComparatorUtils
extends Object

Helper class containing methods for the comparison between different types.


Constructor Summary
ComparatorUtils()
           
 
Method Summary
static int compare(Boolean o1, Boolean o2, int ordering)
          Compares two booleans.
static int compare(Collection o1, Collection o2, int ordering)
          Compares two collections.
static int compare(Comparable o1, Comparable o2, int ordering)
          Compares two comparable objects.
static int compare(Date o1, Date o2, int ordering)
          Compares two dates.
static int compare(Object obj, Collection col, int ordering)
          Compare an element with the collection elements.
static int compare(Object o1, Object o2, int ordering)
          Compares two objects.
static boolean equals(Collection o1, Collection o2)
          Check if tow collections contains exactly the same elements.
static void main(String[] args)
          Test compare methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparatorUtils

public ComparatorUtils()
Method Detail

compare

public static int compare(Comparable o1,
                          Comparable o2,
                          int ordering)
Compares two comparable objects.

Parameters:
ordering: - 1=ascending, -1=descending

compare

public static int compare(Date o1,
                          Date o2,
                          int ordering)
Compares two dates.

Parameters:
ordering: - 1=ascending, -1=descending

compare

public static int compare(Boolean o1,
                          Boolean o2,
                          int ordering)
Compares two booleans.

Parameters:
ordering: - 1=ascending, -1=descending

equals

public static boolean equals(Collection o1,
                             Collection o2)
Check if tow collections contains exactly the same elements. The order of elements within each collection is not relevant.


compare

public static int compare(Collection o1,
                          Collection o2,
                          int ordering)
Compares two collections. A collection is considered greater than other if it has one element greater than all other collection elements.

Parameters:
ordering: - 1=ascending, -1=descending

compare

public static int compare(Object obj,
                          Collection col,
                          int ordering)
Compare an element with the collection elements. The element is greater than the collection if it is greater than ALL of its elements. The element is smaller than the collection if it is smaller than ALL of its elements.

Parameters:
ordering: - 1=ascending, -1=descending

compare

public static int compare(Object o1,
                          Object o2,
                          int ordering)
Compares two objects. Only Object satisfying the following nterfaces can be compared: Comparable, Boolean and Collection.

Parameters:
ordering: - 1=ascending, -1=descending

main

public static void main(String[] args)
                 throws Exception
Test compare methods.

Throws:
Exception

jbpm-form-modeler-common 6.1.0.Beta3

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.