jet.formula
Class fArray

java.lang.Object
  extended by jet.connect.DbValue
      extended by jet.formula.fArray
All Implemented Interfaces:
jet.util.DbValueable, jet.util.QuickSortableNode
Direct Known Subclasses:
fBinaryArray, fBoolArray, fCurArray, fDateArray, fDateTimeArray, fImageArray, fIntArray, fNumArray, fRange, fStrArray, fTextArray, fTimeArray

public abstract class fArray
extends DbValue

This class and its subclasses implement the array data type in formula or represent a multiple-value parameter. JReport formula will be translated into java, and the array type object in the formula will be represented by the instance of one of fArrays.


Field Summary
 DbValue[] value
          The array elements are held here.
 
Fields inherited from class jet.connect.DbValue
bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC
 
Fields inherited from interface jet.util.DbValueable
EQUAL, GREATER, LESS
 
Constructor Summary
fArray()
          Creates an fArray object with 0 slot and the bNull being true.
fArray(int arraysize)
          Creates an fArray object with a specified number of slots and the bNull flag will be set to false.
 
Method Summary
 int compareTo(DbValue dbv)
          Overrides the same method of jet.connect.DbValue.
 boolean equals(DbValue dbv)
           Checks whether the two fArrays are the same.
We don't care if the two fArrays are with the same hashCode.
 java.lang.Object getArray(int datatype)
           
 java.lang.Object getArray(int datatype, boolean useLongForDatetime)
          Converts the formula's array type into java type.
static fArray getInstance(int dataType, DbColDesc desc)
          This method is called by JReport internally.
 boolean isAll()
          The value of a multiple-value parameter is represented by an fArray object.
 void set(DbValue dbv)
          If there is another fArray object, all of its status can be copied to this one, including value, bNull and isAll.
 void set(DbValue[] value)
          After calling this method, the value attribute will be replaced by the argument array.
 void set(java.sql.ResultSet res, int i)
          Overrides the same method of DbValue.
 void setIsAll(boolean isAll)
          Calling this method is equal to checking on or off the 'ALL' checkbox on UI.
 void setValue(java.lang.String v)
          Overrides the same method of DbValue.
 java.lang.String toString()
          Converts the value to string.
 java.lang.String toStringValue()
          
 
Methods inherited from class jet.connect.DbValue
clone, compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, set, setColDesc, setfoo, setNull, setValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public DbValue[] value
The array elements are held here.

Constructor Detail

fArray

public fArray()
Creates an fArray object with 0 slot and the bNull being true.


fArray

public fArray(int arraysize)
Creates an fArray object with a specified number of slots and the bNull flag will be set to false.

Parameters:
arraysize - Specifies how many slots to allocate.
Method Detail

toString

public java.lang.String toString()
Description copied from class: DbValue
Converts the value to string.

Specified by:
toString in class DbValue

toStringValue

public java.lang.String toStringValue()

Specified by:
toStringValue in class DbValue
Returns:
a string which will represent the value in the DbValue(null flag and value). When compare StringValue from DbValues, we always assume that: the two DbValues have same DbColDesc. Two StringValue equals means the original DbValue equals. Does NOT transfer the compareTo(DbValue v) method. Only comparable dbValue implements this methods. String coding uses Base64.

set

public void set(java.sql.ResultSet res,
                int i)
Overrides the same method of DbValue. Calling this method on an fArray will do nothing.

Specified by:
set in class DbValue
Parameters:
res - The source value result set.
i - The source value column number in the rs.

set

public void set(DbValue[] value)
After calling this method, the value attribute will be replaced by the argument array.

Parameters:
value -

isAll

public boolean isAll()
The value of a multiple-value parameter is represented by an fArray object. Under this situation, this method can be called to check whether the 'ALL' checkbox on UI is checked or not.

Returns:

setIsAll

public void setIsAll(boolean isAll)
Calling this method is equal to checking on or off the 'ALL' checkbox on UI.

Parameters:
isAll -

set

public void set(DbValue dbv)
If there is another fArray object, all of its status can be copied to this one, including value, bNull and isAll.

Specified by:
set in class DbValue
Parameters:
dbv - The fArray object to be copied, and it must be initialized from the same class as this object, otherwise, nothing happens.

equals

public boolean equals(DbValue dbv)

Checks whether the two fArrays are the same.
We don't care if the two fArrays are with the same hashCode.

Then under what condition we can say the two fArrays are equal? That is: An fArray must be input first, then The two objects must come from the same fArray class. If BOTH of them are null (bNull == true), they are the same. If ONLY one of them is null, they are different. If BOTH of them are all (isAll == true), they are the same. If ONLY one of them is all. they are different. If they are none of the above, they must have the same length first. If there is one index i making one of the fArrays[i] ! equal to the other fArray[i], they are different.

Specified by:
equals in class DbValue
Parameters:
dbv - The fArray object to be compared.
Returns:
See above description.

compareTo

public int compareTo(DbValue dbv)
Overrides the same method of jet.connect.DbValue. This method only checks equals or not.

Specified by:
compareTo in class DbValue
Returns:
DbValue.EQUAL if equals(DbValue) returns true, else returns DbValue.LESS
See Also:
DbValueable

setValue

public void setValue(java.lang.String v)
Overrides the same method of DbValue. Calling this method on an fArray will do nothing.

Specified by:
setValue in class DbValue

getArray

public java.lang.Object getArray(int datatype,
                                 boolean useLongForDatetime)
Converts the formula's array type into java type.

Parameters:
datatype -

getArray

public java.lang.Object getArray(int datatype)
Parameters:
datatype -
Returns:

getInstance

public static fArray getInstance(int dataType,
                                 DbColDesc desc)
This method is called by JReport internally. Please call the corresponding constructor to create your own fArray object.

Parameters:
dataType -
Returns: