org.simantics.databoard.util
Class DataValueUtil

java.lang.Object
  extended by org.simantics.databoard.util.DataValueUtil

public class DataValueUtil
extends java.lang.Object

DataValue handling utilities

Author:
Toni Kalajainen

Constructor Summary
DataValueUtil()
           
 
Method Summary
static int compare(Binding b1, java.lang.Object o1, Binding b2, java.lang.Object o2)
          Compares its two data values for order.
static java.util.Comparator<java.lang.Object> createComparator(Binding b1, Binding b2)
           
static boolean equals(Binding b1, java.lang.Object o1, Binding b2, java.lang.Object o2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataValueUtil

public DataValueUtil()
Method Detail

compare

public static int compare(Binding b1,
                          java.lang.Object o1,
                          Binding b2,
                          java.lang.Object o2)
                   throws BindingException
Compares its two data values for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.

DataTypes of b1 and b2 are not equal then data types are compared. The comparison function is defined at http://dev.simantics.org/index.php/Org.simantics.datatype_Manual#CompareTo_and_Equals

Parameters:
b1 - Binding of o1
o1 - the first object to be compared.
b2 - Binding of o2
o2 - the second object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Throws:
BindingException - if object cannot be handled by a binding

equals

public static boolean equals(Binding b1,
                             java.lang.Object o1,
                             Binding b2,
                             java.lang.Object o2)
                      throws BindingException
Throws:
BindingException

createComparator

public static java.util.Comparator<java.lang.Object> createComparator(Binding b1,
                                                                      Binding b2)