com.crystaldecisions.reports.common.value
Class RangeValue

java.lang.Object
  extended by CrystalValue
      extended by com.crystaldecisions.reports.common.value.FormulaValue
          extended by com.crystaldecisions.reports.common.value.RangeValue

public final class RangeValue
extends FormulaValue

Provides methods for converting native Java types to a format understood by the Crystal Reports Formula Language. All Java user defined functions must return a FormulaValue object.


Method Summary
 FormulaValue coerceToCurrency()
           Internal use only.
 FormulaValue coerceToDate()
           Internal use only.
 FormulaValue coerceToDateTime()
           Internal use only.
 FormulaValue coerceToNumber()
           Internal use only.
 FormulaValue coerceToRange()
           Internal use only.
 FormulaValue coerceToString()
           Internal use only.
 FormulaValue coerceToTime()
           Internal use only.
 int compareTo(java.lang.Object obj, java.util.Comparator stringComparator)
           Internal use only.
 boolean equals(java.lang.Object obj, boolean caseInsensitive)
           Returns true if obj has the same class and values as this RangeValue object.
static RangeValue fromSingleValue(FormulaValue value)
           Returns a RangeValue object that represents the given FormulaValue object.
static RangeValue fromStartAndEndValues(FormulaValue startValue, FormulaValue endValue, boolean includeStart, boolean includeEnd)
           Returns a RangeValue object with the given startValue and endValue values.
 int getEncodedSize(ValueType type)
           
 int getEncodedSizeForArchive(ValueType type)
           
 FormulaValue getEndValue()
           Returns the end value.
 boolean getIncludeEnd()
           Checks if the end value is included in the range.
 boolean getIncludeStart()
           Checks if the start value is included in the range.
 FormulaValue getStartValue()
           Gets the start value.
 ValueType getValueType()
           Gets the ValueType of this RangeValue object.
 int hashCode(boolean caseInsensitive)
           Returns a hash code for this RangeValue object.
static RangeValue Load(ValueType type, ExtendedDataInput in)
           
static RangeValue LoadFromArchive(ValueType type, IInputArchive ar)
           
 void store(ValueType type, ExtendedDataOutput out)
           
 void storeToArchive(ValueType type, IOutputArchive ar)
           
 FormulaValue toSingleValue()
           Returns the single value if both endpoints are the same value, otherwise null.
 java.lang.String toString()
           Returns a String representation of this RangeValue object.
 
Methods inherited from class com.crystaldecisions.reports.common.value.FormulaValue
coerce, coerceToArray, coerceToArray, coerceToBoolean, coerceToBoolean, coerceToCurrency, coerceToDate, coerceToDateTime, coerceToNumber, coerceToRange, coerceToRangeArray, coerceToRangeArray, coerceToString, coerceToTime, getFormulaValueType, makeZeroValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

fromStartAndEndValues

public static RangeValue fromStartAndEndValues(FormulaValue startValue,
                                               FormulaValue endValue,
                                               boolean includeStart,
                                               boolean includeEnd)

Returns a RangeValue object with the given startValue and endValue values.

Parameters:
startValue - The start value for the range. If null, the start of the range is unbounded.
endValue - The end value for the range. If null, the end of the range is unbounded.
includeStart - set to true to include the startValue in the range
includeEnd - set to true, to include the endValue in the range
Returns:
a RangeValue object with the given startValue and endValue values
Throws:
java.lang.IllegalArgumentException - if the start and end values are not of the same class, or if the start or end value has a Range or Array ValueType, or if the start and end values are equal and are not both included
java.lang.NullPointerException - if both start and end values are null

fromSingleValue

public static RangeValue fromSingleValue(FormulaValue value)

Returns a RangeValue object that represents the given FormulaValue object.

Parameters:
value - the FormulaValue object to represent
Returns:
a RangeValue object with both endpoints included and set to the given value
Throws:
java.lang.IllegalArgumentException - if the value is a range or an array
java.lang.NullPointerException - if both the start and end values are null

store

public void store(ValueType type,
                  ExtendedDataOutput out)
           throws java.io.IOException
Throws:
java.io.IOException

storeToArchive

public void storeToArchive(ValueType type,
                           IOutputArchive ar)
                    throws ArchiveException
Throws:
ArchiveException

LoadFromArchive

public static RangeValue LoadFromArchive(ValueType type,
                                         IInputArchive ar)
                                  throws ArchiveException
Throws:
ArchiveException

Load

public static RangeValue Load(ValueType type,
                              ExtendedDataInput in)
                       throws java.io.IOException
Throws:
java.io.IOException

getEncodedSizeForArchive

public int getEncodedSizeForArchive(ValueType type)

getEncodedSize

public int getEncodedSize(ValueType type)

coerceToNumber

public FormulaValue coerceToNumber()

Internal use only.

Overrides:
coerceToNumber in class FormulaValue

coerceToCurrency

public FormulaValue coerceToCurrency()

Internal use only.

Overrides:
coerceToCurrency in class FormulaValue

coerceToDate

public FormulaValue coerceToDate()

Internal use only.

Overrides:
coerceToDate in class FormulaValue

coerceToTime

public FormulaValue coerceToTime()

Internal use only.

Overrides:
coerceToTime in class FormulaValue

coerceToDateTime

public FormulaValue coerceToDateTime()

Internal use only.

Overrides:
coerceToDateTime in class FormulaValue

coerceToString

public FormulaValue coerceToString()

Internal use only.

Overrides:
coerceToString in class FormulaValue

coerceToRange

public FormulaValue coerceToRange()

Internal use only.

Overrides:
coerceToRange in class FormulaValue

toSingleValue

public FormulaValue toSingleValue()

Returns the single value if both endpoints are the same value, otherwise null.

Returns:
the single value if both endpoints are the same value, otherwise null

getStartValue

public FormulaValue getStartValue()

Gets the start value.

Returns:
the start value

getEndValue

public FormulaValue getEndValue()

Returns the end value.

Returns:
the end value

getIncludeStart

public boolean getIncludeStart()

Checks if the start value is included in the range.

Returns:
true if the start value is included in the range, otherwise false

getIncludeEnd

public boolean getIncludeEnd()

Checks if the end value is included in the range.

Returns:
true if the end value is included in the range, otherwise false

getValueType

public ValueType getValueType()

Gets the ValueType of this RangeValue object.

Returns:
the ValueType of this RangeValue object

equals

public boolean equals(java.lang.Object obj,
                      boolean caseInsensitive)

Returns true if obj has the same class and values as this RangeValue object.

Parameters:
obj - the Object to compare this RangeValue object to
Returns:
true if obj has the same class and values as this RangeValue object, otherwise false

compareTo

public int compareTo(java.lang.Object obj,
                     java.util.Comparator stringComparator)

Internal use only.


hashCode

public int hashCode(boolean caseInsensitive)

Returns a hash code for this RangeValue object.

Returns:
the hash code as an int

toString

public java.lang.String toString()

Returns a String representation of this RangeValue object. The String is of the form: "r([includeStart][start]..[end][includeEnd])" where:
- [start] is the string representation of the start value
- [end] is the string representation of the end value
- [includeStart] is "[" if includeStart is true, otherwise "("
- [includeEnd] is "]" if includeEnd is true, otherwise ")"

Returns:
a String representation of this RangeValue object