org.deegree.coverage.rangeset
Class SingleValue<T extends Comparable<T>>

java.lang.Object
  extended by org.deegree.coverage.rangeset.SingleValue<T>
Type Parameters:
T - type of the value

public class SingleValue<T extends Comparable<T>>
extends Object

The SingleValue denotes a single typed value in a range set.

Version:
$Revision: 31644 $, $Date: 2011-08-24 22:27:43 +0200 (Wed, 24 Aug 2011) $
Author:
Rutger Bezema, last edited by: $Author: mschneider $

Field Summary
 ValueType type
          the type
 T value
          the value
 
Constructor Summary
SingleValue(ValueType type, T value)
           
 
Method Summary
static SingleValue<?> createFromString(String type, String value)
           
static SingleValue<?> createFromValue(String type, Number value)
           
 boolean equals(Object other)
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public final T extends Comparable<T> value
the value


type

public final ValueType type
the type

Constructor Detail

SingleValue

public SingleValue(ValueType type,
                   T value)
Parameters:
type - describing the type of the value.
value - the actual value
Method Detail

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Parameters:
other - to test against
Returns:
true if the given singlevalue matches this one, e.g. the value and types are equal.

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class Object
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

createFromValue

public static SingleValue<?> createFromValue(String type,
                                             Number value)
                                      throws NumberFormatException
Parameters:
type -
value -
Returns:
the typed SingleValue.
Throws:
NumberFormatException

createFromString

public static SingleValue<?> createFromString(String type,
                                              String value)
                                       throws NumberFormatException
Parameters:
type -
value -
Returns:
the typed SingleValue.
Throws:
NumberFormatException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.