org.deegree.coverage.rangeset
Class SingleValue<T extends java.lang.Comparable<T>>
java.lang.Object
org.deegree.coverage.rangeset.SingleValue<T>
- Type Parameters:
T
- type of the value
public class SingleValue<T extends java.lang.Comparable<T>>
- extends java.lang.Object
The SingleValue
denotes a single typed value in a range set.
- Version:
- $Revision: 19041 $, $Date: 2009-08-11 17:04:57 +0200 (Di, 11 Aug 2009) $
- Author:
- Rutger Bezema, last edited by: $Author: rbezema $
Method Summary |
static SingleValue<?> |
createFromString(java.lang.String type,
java.lang.String value)
|
static SingleValue<?> |
createFromValue(java.lang.String type,
java.lang.Number value)
|
boolean |
equals(java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
value
public final T extends java.lang.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(java.lang.Object other)
- Overrides:
equals
in class java.lang.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 java.lang.Object
- Returns:
- (int) ( result >>> 32 ) ^ (int) result;
- See Also:
Object.hashCode()
createFromValue
public static SingleValue<?> createFromValue(java.lang.String type,
java.lang.Number value)
throws java.lang.NumberFormatException
- Parameters:
type
- value
-
- Returns:
- the typed SingleValue.
- Throws:
java.lang.NumberFormatException
createFromString
public static SingleValue<?> createFromString(java.lang.String type,
java.lang.String value)
throws java.lang.NumberFormatException
- Parameters:
type
- value
-
- Returns:
- the typed SingleValue.
- Throws:
java.lang.NumberFormatException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2011. All Rights Reserved.