Data Request Broker
2-3-release

fr.gael.drb.value
Class UnsignedShortArray

java.lang.Object
  extended by fr.gael.drb.value.AbstractValueArray
      extended by fr.gael.drb.value.AbstractNumericArray
          extended by fr.gael.drb.value.UnsignedShortArray
All Implemented Interfaces:
DrbItem, DrbSequence, Comparison, NumericArray, Value, ValueArray, ValueFormat, Serializable

public class UnsignedShortArray
extends AbstractNumericArray
implements ValueFormat

The UnsignedShortArray class is a generic wrapper for unsigned short array values.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface fr.gael.drb.value.Value
ARRAY_ID, BINARY_ID, BINARY_INTEGER_ID, BOOLEAN_ID, BYTE_ID, DATE_ID, DATE_TIME_ID, DAY_ID, DAY_TIME_DURATION_ID, DECIMAL_ID, DOUBLE_ID, DURATION_ID, FLOAT_ID, INT_ID, INTEGER_ID, LONG_ID, MONTH_DAY_ID, MONTH_ID, NULL_ID, NUMERIC_ID, OTHER_ID, SHORT_ID, STRING_ID, TIME_ID, UNKNOWN_ID, UNSIGNED_BYTE_ID, UNSIGNED_INT_ID, UNSIGNED_LONG_ID, UNSIGNED_SHORT_ID, YEAR_ID, YEAR_MONTH_DURATION_ID, YEAR_MONTH_ID
 
Fields inherited from interface fr.gael.drb.DrbItem
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM
 
Constructor Summary
UnsignedShortArray(int size)
          Build a ShortArray value.
UnsignedShortArray(short[] v)
          Build an UnsignedShortArray value.
 
Method Summary
 void assign(int index, boolean value)
          assign
 void assign(int index, byte value)
          assign
 void assign(int index, double value)
          assign
 void assign(int index, float value)
          assign
 void assign(int index, int value)
          assign
 void assign(int index, long value)
          assign
 void assign(int index, short value)
          assign
 void assign(int index, Value element)
          assign
 void assign(Value v)
          Assign a value.
 boolean booleanValue(int index)
          booleanValue
 byte byteValue(int index)
          byteValue
 Value convertTo(int type)
          Convert the value into the specified type.
 double doubleValue(int index)
          doubleValue
 float floatValue(int index)
          floatValue
 int getArrayType()
          getArrayType
 short[] getData()
          Returns the underlying object for optimization.
 Value getElement(int index)
          get the element
 byte[] getFormattedBuffer()
          Return a byte buffer containing the value in a fixed format.
 String getFormattedString(int length)
          Return a string containing the value with a fixed format.
 int getItemType()
          A code that identifies the value items.
 String getName()
          Name of the item.
 String getNamespaceURI()
          Get namespace URI.
 int getPriority()
          Returns the ShortArray priority The type must be ARRAY_ID or STRING_ID otherwise a ClassCastException is thrown.
 int getType()
          The type identifier of this BooleanArray value.
 Value getValue()
          The value of the item.
 int intValue(int index)
          intValue
 int length()
          Return the length
 long longValue(int index)
          longValue
static void main(String[] args)
          mian
 void rename(String name)
          Changes the name of the item.
 void setNamespaceURI(String namespace_uri)
          Sets a namespace resource identifier.
 Value setValue(Value value)
          Changes the value of the item.
 short shortValue(int index)
          shortValue
 short[] shortValues()
          Returns this value as a short integer (signed 16 bits).
 Numeric toNumeric()
          Convert the value into the numeric type.
 String toString()
          toString
static UnsignedShortArray wrap(short[] v)
          Wrap the given array
 
Methods inherited from class fr.gael.drb.value.AbstractNumericArray
booleanValues, byteValues, convertArrayTo, doubleValues, floatValues, intValues, longValues
 
Methods inherited from class fr.gael.drb.value.AbstractValueArray
addItem, atomize, compareTo, getItem, getLength, removeItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fr.gael.drb.DrbItem
getItemType, getName, getNamespaceURI, getValue, rename, setNamespaceURI, setValue
 
Methods inherited from interface fr.gael.drb.DrbSequence
addItem, atomize, getItem, getLength, removeItem
 
Methods inherited from interface fr.gael.drb.value.Comparison
compareTo
 

Constructor Detail

UnsignedShortArray

public UnsignedShortArray(short[] v)
Build an UnsignedShortArray value.

Parameters:
v - a short array.

UnsignedShortArray

public UnsignedShortArray(int size)
Build a ShortArray value.

Parameters:
size - The size
Method Detail

wrap

public static UnsignedShortArray wrap(short[] v)
Wrap the given array

Parameters:
v -
Returns:

getData

public final short[] getData()
Returns the underlying object for optimization.

Specified by:
getData in class AbstractNumericArray
Returns:
the underlying short array.

shortValues

public short[] shortValues()
Returns this value as a short integer (signed 16 bits). The conversion may result in a loss of precision.

Overrides:
shortValues in class AbstractNumericArray
Returns:
the numeric value represented by this object after conversion to type short.

getFormattedString

public String getFormattedString(int length)
Return a string containing the value with a fixed format.

Specified by:
getFormattedString in interface ValueFormat
Overrides:
getFormattedString in class AbstractNumericArray
Parameters:
length - The expected length of the output string
Returns:
The formatted string.

getFormattedBuffer

public final byte[] getFormattedBuffer()
Return a byte buffer containing the value in a fixed format.

Specified by:
getFormattedBuffer in interface ValueFormat
Overrides:
getFormattedBuffer in class AbstractNumericArray
Returns:
The formatted buffer.

getType

public final int getType()
The type identifier of this BooleanArray value.

Specified by:
getType in interface Value
Returns:
an identifier of the array type, namely ARRAY_ID

getPriority

public final int getPriority()
Returns the ShortArray priority The type must be ARRAY_ID or STRING_ID otherwise a ClassCastException is thrown.

Specified by:
getPriority in interface Value
Returns:
the ShortArray priority

convertTo

public final Value convertTo(int type)
                      throws ClassCastException
Convert the value into the specified type.

Specified by:
convertTo in interface Value
Overrides:
convertTo in class AbstractValueArray
Parameters:
type - The target type.
Returns:
The converted value.
Throws:
ClassCastException - exception

assign

public final void assign(Value v)
                  throws ClassCastException
Assign a value. This value must be a NumericArray otherwise a ClassCastException is thrown.

Specified by:
assign in interface Value
Parameters:
v - the value to be assigned.
Throws:
ClassCastException - exception

getArrayType

public final int getArrayType()
getArrayType

Specified by:
getArrayType in interface ValueArray
Overrides:
getArrayType in class AbstractNumericArray
Returns:
the type

getElement

public final Value getElement(int index)
get the element

Specified by:
getElement in interface ValueArray
Parameters:
index - the index
Returns:
the value

assign

public final void assign(int index,
                         Value element)
assign

Specified by:
assign in interface ValueArray
Parameters:
index - the index
element - the element

length

public final int length()
Return the length

Specified by:
length in interface ValueArray
Returns:
the length

booleanValue

public final boolean booleanValue(int index)
booleanValue

Specified by:
booleanValue in interface NumericArray
Overrides:
booleanValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
true or false

byteValue

public final byte byteValue(int index)
byteValue

Specified by:
byteValue in interface NumericArray
Overrides:
byteValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the byte

intValue

public final int intValue(int index)
intValue

Specified by:
intValue in interface NumericArray
Overrides:
intValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the int value

longValue

public final long longValue(int index)
longValue

Specified by:
longValue in interface NumericArray
Overrides:
longValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the long value

shortValue

public final short shortValue(int index)
shortValue

Specified by:
shortValue in interface NumericArray
Overrides:
shortValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the short value

floatValue

public final float floatValue(int index)
floatValue

Specified by:
floatValue in interface NumericArray
Overrides:
floatValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the float value

doubleValue

public final double doubleValue(int index)
doubleValue

Specified by:
doubleValue in interface NumericArray
Overrides:
doubleValue in class AbstractNumericArray
Parameters:
index - the index
Returns:
the doublevalue

assign

public final void assign(int index,
                         boolean value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the boolean value

assign

public final void assign(int index,
                         byte value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the byte value

assign

public final void assign(int index,
                         int value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the int value

assign

public final void assign(int index,
                         short value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the short value

assign

public final void assign(int index,
                         long value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the long value

assign

public final void assign(int index,
                         float value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the float value

assign

public final void assign(int index,
                         double value)
assign

Specified by:
assign in interface NumericArray
Overrides:
assign in class AbstractNumericArray
Parameters:
index - the index
value - the double value

toString

public String toString()
toString

Overrides:
toString in class Object
Returns:
the string

main

public static void main(String[] args)
mian

Parameters:
args - string[]

getItemType

public int getItemType()
A code that identifies the value items.

Specified by:
getItemType in interface DrbItem
Returns:
The code of value items.

getName

public String getName()
Name of the item. This method always returns null.

Specified by:
getName in interface DrbItem
Returns:
null

rename

public void rename(String name)
            throws NullPointerException,
                   UnsupportedOperationException
Changes the name of the item. This method always throw an UnsupportedOperationException.

Specified by:
rename in interface DrbItem
Parameters:
name - Reference to the new name.
Throws:
UnsupportedOperationException - This exception always raised because the name property is not defined for values.
NullPointerException - This exception is overriden by an UnsupportedOperationException.

getNamespaceURI

public String getNamespaceURI()
Get namespace URI. This method always returns null.

Specified by:
getNamespaceURI in interface DrbItem
Returns:
null.

setNamespaceURI

public void setNamespaceURI(String namespace_uri)
                     throws NullPointerException,
                            UnsupportedOperationException
Sets a namespace resource identifier. This method always throw an UnsupportedOperationException.

Specified by:
setNamespaceURI in interface DrbItem
Parameters:
namespace_uri - A reference to the new namespace identifier.
Throws:
UnsupportedOperationException - This exception always raised because the name property is not defined for values.
NullPointerException - This exception is overriden by an UnsupportedOperationException.

getValue

public Value getValue()
The value of the item. The value is expressed according to one of the types supported by the fr.gael.drb.value package. Generally these types correspond to primitive types (e.g. integer, floatting points, etc.) or very low level types (e.g. string, date, etc.). On the contrary to DOM implementation all the types are allowed even the arrays, date etc. Only the Value.NULL_ID type is forbidden.

Specified by:
getValue in interface DrbItem
Returns:
The value of the attribute.

setValue

public Value setValue(Value value)
               throws NullPointerException,
                      ClassCastException,
                      UnsupportedOperationException
Changes the value of the item. This operation sets a new value of the current item.The value type of the item shall be compatible with the item implementation. If the type does not match exactly it is casted to a compatible one based on the the fr.gael.drb.value capabilities. A reference to the effectivelly assigned value is returned by the operation so it is possible to check if a cast has been performed and therefore assess the accuracy of the assignement. If the cast is not possible the operation raises an UnsupportedOperationException. If the assignment is possible and the item implementation has a physical representation the value is updated in the physical source in order to persist among sessions. It therefore possible that this operation consumses an variable time.

Specified by:
setValue in interface DrbItem
Parameters:
value - The new value of the node. This value shall not be null.
Returns:
The effectivelly assigned value. The type of this value may differ from the input one.
Throws:
NullPointerException - This exception is raised when the passed reference to the value is null. This exception may be overriden by an UnsupportedOperationException.
ClassCastException - This exception is raised when the implementation has not succeeded to cast the input value in a type compatible with the current node.
UnsupportedOperationException - This exception is raised when the implementation does not support the requested assignment for any reason.

toNumeric

public Numeric toNumeric()
                  throws ClassCastException
Convert the value into the numeric type. In case of identity conversion the value itself should be returned. If the conversion is not allowed a ClassCastException is thrown.

Returns:
The converted value.
Throws:
ClassCastException - is the convertion is impossible

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .