org.deegree.coverage.rangeset
Class SingleValue<T extends Comparable<T>>
java.lang.Object
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 $
value
public final T extends Comparable<T> value
- the value
type
public final ValueType type
- the type
SingleValue
public SingleValue(ValueType type,
T value)
- Parameters:
type
- describing the type of the value.value
- the actual value
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:
- boolean -- code = (f ? 0 : 1)
- byte, char, short, int -- code = (int)f
- long -- code = (int)(f ^ (f >>>32))
- float -- code = Float.floatToIntBits(f);
- double -- long l = Double.doubleToLongBits(f); code = (int)(l ^ (l >>> 32))
- all Objects, (where equals( ) calls equals( ) for this field) -- code = f.hashCode( )
- Array -- Apply above rules to each element
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.