|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.data.VoidData
com.davisor.data.VoidValue
com.davisor.data.GenericValue
com.davisor.data.TupleData
TupleData defines a tuple data structure with elements defined by a
tuple data type. TupleData implements DataValue and
Map interfaces that allow a number of data
manipulation and access operations to be applied on tuple
members. Tuple data elements can also be accessed directly with a
set of straigforward accessor methods.
TupleData Map interface operations use member
identifiers as keys, as defined by tuple data type. The operations
are also restricted to tuple member access operations only; any
operations that attempt to add or remove elements from the
Map will fail, as the underlying tuple structure is
fixed, and follows the definition of tuple data type.
TuplePatternType,
TupleType,
TupleDataStream,
Serialized Form| Nested Class Summary | |
class |
TupleData.TupleEntry
TupleEntry implements an entry for TupleData Map interface entrySet method. |
class |
TupleData.TupleEntryIterator
TupleEntryIterator implemens an entry iterator for TupleData Map interface entrySet method. |
class |
TupleData.TupleEntrySet
TupleEntrySet implements an entry set for TupleData Map interface entrySet method. |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
static char |
DOT
Component identity separator ('.'). |
| Fields inherited from class com.davisor.data.VoidData |
M_type |
| Constructor Summary | |
TupleData(TupleData data,
boolean deep)
Deep or shallow copy constructor. |
|
TupleData(TupleType type)
Construct a new tuple data object with the given tuple type. |
|
TupleData(TupleType type,
java.sql.ResultSet resultSet)
Construct a new tuple data object from the current result set row. |
|
TupleData(TupleType type,
java.lang.String stringValue,
java.text.ParsePosition status)
Creates a tuple data value from a string value. |
|
| Method Summary | |
DataValue |
abs()
Returns absolute data value of current value. |
DataValue |
add(DataValue value)
Adds data values. |
DataValue |
ceil(DataValue precision)
Quantizes the current value up to an even value within given precision. |
void |
clear()
Removes all mappings from this map (not supported). |
int |
compareTo(java.lang.Object o)
Compares this data with other data objects. |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value. |
double |
deinterpolate(DataValue min,
DataValue max)
De-interpolates the current data value to a scalar value, in respect, with the given data value range. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this map (not supported). |
boolean |
equals(java.lang.Object o)
Tests if this object is equal with another object. |
DataValue |
floor(DataValue precision)
Quantizes the current value to an even value within the given precision. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which this map maps the specified key. |
java.lang.Object |
get(java.lang.Object key,
java.util.Map additionalValues)
Returns the value to which this or an additional map maps the specified key. |
java.lang.String |
getFormat()
Gets the type specification optimal for this particular value. |
int |
getMaxIndex()
Gets the index of the member with the largest value. |
int |
getMinIndex()
Gets the index of the member with the smallest value. |
int |
getSize()
Deprecated. replaced with size which coincides with
Map interface. |
DataValue |
getValue(int index)
Gets a direct reference to a tuple member value. |
DataValue |
getValue(int index,
Type type)
Gets the tuple member value, optionally converted to the given type. |
int |
hashCode()
Returns a hash code value for the object. |
DataValue |
interpolate(double value,
DataValue max)
Interpolates the given scalar value to data value, in respect, with the range defined by this value and the given maximum value. |
boolean |
isEmpty()
Returns true if this map contains no key-value
mappings. |
boolean |
isNull()
Tests if this data object value is undetermined. |
boolean |
isNumber(int index)
Tests if the given member is a NumberType instance. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this map. |
DataValue |
max(DataValue value)
Finds the larger of this and the given data value. |
DataValue |
min(DataValue value)
Finds the smallest data value. |
DataValue |
negate()
Returns the negation of current value. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map. |
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified map to this map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this map if present (not supported). |
void |
setValue(int index,
java.lang.Object value)
Sets a tuple member value. |
void |
setValue(java.lang.String value,
java.text.ParsePosition status)
Sets data value from a string value. |
int |
size()
Gets the number of tuple elements. |
DataValue |
sub(DataValue value)
Substracts a data value. |
java.lang.String |
toString()
Converts the current tuple data to a string. |
DataValue |
unit(DataValue targetValue,
double maxSteps)
Gets the largest suitable unit step to represent a value change between this value and the given target value. |
java.util.Collection |
values()
Returns a collection view of the values contained in this map. |
| Methods inherited from class com.davisor.data.GenericValue |
toStatement, toXML |
| Methods inherited from class com.davisor.data.VoidValue |
div, mul |
| Methods inherited from class com.davisor.data.VoidData |
getDataValue, getType, setType |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
| Field Detail |
public static final char DOT
| Constructor Detail |
public TupleData(TupleData data,
boolean deep)
data - source data (may be null)deep - determines if the copying is deep or shallowVoidData.getType(),
Type.dup()public TupleData(TupleType type)
type - tuple type
public TupleData(TupleType type,
java.sql.ResultSet resultSet)
throws InvalidDataException,
java.sql.SQLException
type - tuple typeresultSet - result set to read data row from
public TupleData(TupleType type,
java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
stringValue - string value to be parsedstatus - parse status (may be null)
InvalidDataException - if string value could not be parsersetValue(String,ParsePosition)| Method Detail |
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.ComparablecompareTo in class GenericValueGenericValue.max(com.davisor.data.DataValue),
GenericValue.min(com.davisor.data.DataValue),
Compare.compareTo(Object,Object)public boolean isNull()
isNull in interface SerializableDataisNull in class VoidValuetrue
public DataValue abs()
throws InvalidDataException
Absolute values must satisfy a requirement that when added to any other value, the result must be greater than or equal to the original value.
abs in interface DataValueabs in class VoidValueInvalidDataException - if absolute value can not be computed
public DataValue add(DataValue value)
throws InvalidDataException
add in interface DataValueadd in class VoidValuevalue - a data value to be added to this data value
InvalidDataException - if the data values cannot be added.
public DataValue ceil(DataValue precision)
throws InvalidDataException
Tuple data values are rounded off by rounding each tuple member separately.
ceil in interface DataValueceil in class VoidValueprecision - the precision within the quantization occurs
InvalidDataException - if precision was of unacceptable typeceil(com.davisor.data.DataValue)
public double deinterpolate(DataValue min,
DataValue max)
throws InvalidDataException
Tuple data values are de-interpolated by de-interpolating all tuple
members separately. If there are no elements, then the de-interpolation
results in a zero value. If there is just one element, then it's
de-interpolation value is returned. If there is more than one
element, and their respective de-interpolation values are equal, then
that particular value is returned. If the values are not equal, then the
de-interpolation fails with DeinterpolationException.
deinterpolate in interface DataValuedeinterpolate in class VoidValuemin - a data value representing a range lower limitmax - a data value representing a range higher limit
DeinterpolationException - if the de-interpolation fails due
to a de-interpolation value conflict
InvalidDataException - if the de-interpolation fails for some
other reasoninterpolate(double, com.davisor.data.DataValue),
DataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue)
public DataValue floor(DataValue precision)
throws InvalidDataException
Tuple data values are rounded off by rounding off each tuple member separately.
floor in interface DataValuefloor in class VoidValueprecision - the precision within the quantization occurs
InvalidDataException - if precision was of unacceptable typeceil(com.davisor.data.DataValue)public java.lang.String getFormat()
Tuple data specification strings are constructed by concatenating paranthesis enclosed tuple member specification strings together.
getFormat in interface DataValuegetFormat in class VoidValueData.getType(),
TupleType.getFormat(),
TupleType.setFormat(java.lang.String)
public DataValue interpolate(double value,
DataValue max)
throws InvalidDataException
Tuple data values are interpolated by interpolating all tuple members separately.
interpolate in interface DataValueinterpolate in class VoidValuevalue - the scalar value to be interpolatedmax - a data value representing a range's higher limit
InvalidDataException - if interpolation fails
public DataValue max(DataValue value)
throws InvalidDataException
If the given value is null or an
instance of VoidValue, a reference to
this instance is returned.
max in interface DataValuemax in class GenericValuevalue - a data value to be compared to this data value
InvalidDataException - if the data value cannot be compared.GenericValue.compareTo(java.lang.Object)
public DataValue min(DataValue value)
throws InvalidDataException
If the given value is null or an
instance of VoidValue, a reference to
this instance is returned.
min in interface DataValuemin in class GenericValuevalue - a data value to be compared with this data value
InvalidDataException - if the data value cannot be compared.GenericValue.compareTo(java.lang.Object)
public DataValue negate()
throws InvalidDataException
negate in interface DataValuenegate in class VoidValueInvalidDataException - if absolute value can not be computed
public void setValue(java.lang.String value,
java.text.ParsePosition status)
throws InvalidDataException
The string value is offered to all tuple members, one member at a
time. Tuple members are co-operatively responsible of parsing the
string and updating the parse position status. If the argument parse
position status is null, the parsing starts from the
beginning of the given string.
setValue in interface DataValuesetValue in class VoidValuevalue - string value to be parsed (may be null)status - parse status (may be null)
InvalidDataException - if string value could not be parserType.toData(String,ParsePosition)
public DataValue sub(DataValue value)
throws InvalidDataException
sub in interface DataValuesub in class VoidValuevalue - a data value to be substracted from this data value
InvalidDataException - if value can not be
substracted.public java.lang.String toString()
toString in interface DataValuetoString in class VoidDataFormatType.getFormatter(),
DataValue.toString()
public DataValue unit(DataValue targetValue,
double maxSteps)
throws InvalidDataException
The tuple data unit value is computed by taking the unit value for each member separately.
unit in interface DataValueunit in class VoidValuetargetValue - the target value to be reached (may be null)maxSteps - maximum number of steps (zero leaves the choise open)
InvalidDataException - if target value is unsuitablepublic com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupabledup in class VoidValuepublic void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mapget(java.lang.Object)public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
This implementation is a simplified convenience version of the
actual get method. Please see it for full
documentation about the various key formats supported.
get in interface java.util.Mapkey - element key, as described in
get(Object,Map) method documentation
null if no match
was foundget(Object,Map)
public java.lang.Object get(java.lang.Object key,
java.util.Map additionalValues)
If the key is an instance of Number, it's integer
value is taken as element index, and corresponding element, if
any, is returned.
If the key is a list, the first element of the list is extracted and used as a key to retrieve a member value. If the key list then contains more elements, the member found is expected to be another tuple, which is then recursively searched with the remaining list elements.
The key list may also contain just one element, in which case the
member value matching that element is returned. If the key list
is empty, null is returned. null is
also returned if recursive search can not be continued because an
intermediate member was not a tuple.
If the key list contains a null element, and an
additional values map has been provided, the remaining sublist is
used as a key to retrieve a value from the additional values map.
If only one key remains in the sublist, the key is taken out of
the list before accessing the additional values map, otherwise
the whole remaining sublist is used as key. If there is no
additional values map, the remaining keys, if any, are ignored,
and null is returned. Please note that tuple data
objects implement the Map interface, too, so another
tuple data object can be directly used as the additional values
map.
If the key is an object or integer array, the array elements are
treated like keys in a list. In particular, a null
object array element will cause a search to be made to the
additional values map, if any, with a smaller object array
containing the remaining array elements as a key.
If the key was none of the above, it is transformed to a string, and that string is used to search a tuple member with matching identity. If a matching member is found, the value of that member is returned.
If the key string did not match any member identity, it is interpreted as an integer value, if possible, and the corresponding elment, if any, is returned.
If no matching member was found, the key string is interpred as a
list of element identities, separated with dot (.)
characters. This list is then evaluated just like object lists,
with empty list elements corresponding to a null
list element.
The following examples list some possibilities of how tuple members can be accessed. Please note in particular, that when working with string keys, member identities take preference over integer and component strings.
key - element key, as described aboveadditionalValues - additional values map (may be null, but
if not, any access to the map will be synchronized to the map
object itself)
null if no match
was foundcontainsKey(java.lang.Object),
put(java.lang.Object, java.lang.Object),
Strings.stringify(Object),
TupleType.getIndex(java.lang.String)public boolean isEmpty()
true if this map contains no key-value
mappings.
isEmpty in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.MapTupleType.keySet()
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
The given key is first transformed to a string, after which a corresponding member identity is searched from current tuple type. If a matching member is found, the given new value will be assigned to that member. returned.
If no matching member is found, but the given object was a
Number, it's integer value is taken as element
index, and corresponding element, if any is modified.
put in interface java.util.Mapjava.lang.IllegalArgumentException - if given key does not match
any current element, or given value does not match the target
element typeget(java.lang.Object),
setValue(java.lang.String, java.text.ParsePosition),
Strings.stringify(Object),
TupleType.getIndex(java.lang.String)public void putAll(java.util.Map t)
putAll in interface java.util.MapentrySet(),
put(java.lang.Object, java.lang.Object)public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic boolean equals(java.lang.Object o)
Tuple data objects are equal if their super-classes and members are.
equals in interface java.util.Mapequals in class VoidDataCompare.equals(Object,Object)public int hashCode()
hashCode in interface java.util.MaphashCode in class VoidDatapublic java.util.Collection values()
values in interface java.util.Map
public int getMaxIndex()
throws InvalidDataException
InvalidDataException - if members cannot be comparedgetValue(int)
public int getMinIndex()
throws InvalidDataException
InvalidDataException - if members cannot be comparedgetValue(int)public int getSize()
size which coincides with
Map interface.
size()public DataValue getValue(int index)
null.
public DataValue getValue(int index,
Type type)
null. A
null type will return a direct reference to the
requested tuple element.
index - member indextype - the type that the member is to be converted to (may be null)public boolean isNumber(int index)
NumberType instance.
TupleType.isNumber(int)
public void setValue(int index,
java.lang.Object value)
throws InvalidDataException
DataValue, or if it's type does not equal the given
channel type, the value is converted to target channel type.
If tuple target member type is undefined, and the given value is
DataValue, the value is accepted unmodified. If the
value is not a DataValue, an
InvalidDataException is thrown.
Setting a value to null removes any old value.
index - channel indexvalue - element value (may be null)
InvalidDataException - if value is not
valid for the given channelType.toData(Object)public int size()
size in interface java.util.Map
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||