com.google.visualization.datasource.datatable.value
Class NumberValue

java.lang.Object
  extended by com.google.visualization.datasource.datatable.value.Value
      extended by com.google.visualization.datasource.datatable.value.NumberValue
All Implemented Interfaces:
java.lang.Comparable<Value>

public class NumberValue
extends Value

A value of type number. Valid values are double-precision floating-point numbers (including integers) or NULL_VALUE.

Author:
Yoah B.D.

Constructor Summary
NumberValue(double value)
          Create a new number value.
 
Method Summary
 int compareTo(Value other)
          Compares this value to another value of the same type.
static NumberValue getNullValue()
          Static method to return the null value (same one for all calls).
 java.lang.Number getObjectToFormat()
          Uses an ibm.icu.text.UFormat instance to format Values.
 ValueType getType()
          Returns the type of this cell.
 double getValue()
          Returns the underlying value.
 int hashCode()
          Returns a hash code for this number value.
protected  java.lang.String innerToQueryString()
          Returns a string that, when parsed by the query parser, should return an identical value.
 boolean isNull()
          Tests whether this value is a logical null.
 java.lang.String toString()
          Returns the number as a String using default formatting.
 
Methods inherited from class com.google.visualization.datasource.datatable.value.Value
equals, getLocalizedComparator, getNullValueFromValueType, toQueryString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumberValue

public NumberValue(double value)
Create a new number value.

Parameters:
value - The underlying value.
Method Detail

getNullValue

public static NumberValue getNullValue()
Static method to return the null value (same one for all calls).

Returns:
Null value.

getType

public ValueType getType()
Description copied from class: Value
Returns the type of this cell.

Specified by:
getType in class Value
Returns:
The type of this cell.

getValue

public double getValue()
Returns the underlying value.

Returns:
The underlying value.

toString

public java.lang.String toString()
Returns the number as a String using default formatting.

Overrides:
toString in class java.lang.Object
Returns:
The number as a String using default formatting.

isNull

public boolean isNull()
Tests whether this value is a logical null.

Specified by:
isNull in class Value
Returns:
Indication of whether the value is null.

compareTo

public int compareTo(Value other)
Compares this value to another value of the same type.

Parameters:
other - Other value.
Returns:
0 if equal, negative if this is smaller, positive if larger.

hashCode

public int hashCode()
Returns a hash code for this number value.

Specified by:
hashCode in class Value
Returns:
A hash code for this number value.

getObjectToFormat

public java.lang.Number getObjectToFormat()
Description copied from class: Value
Uses an ibm.icu.text.UFormat instance to format Values. The following method returns an object representing this Value that a UFormat can format.

Specified by:
getObjectToFormat in class Value
Returns:
An object representing this value that can be formatted by a UFormat formatter, null for a NULL_VALUE.

innerToQueryString

protected java.lang.String innerToQueryString()
Returns a string that, when parsed by the query parser, should return an identical value. Assumes this value is not null.

Specified by:
innerToQueryString in class Value
Returns:
A string form of this value.


Copyright © 2009 Google. All Rights Reserved.