SMILA (incubation) API documentation

org.eclipse.smila.datamodel.impl
Class AnySeqImpl

java.lang.Object
  extended by org.eclipse.smila.datamodel.impl.AbstractAny
      extended by org.eclipse.smila.datamodel.impl.AnySeqImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Any>, java.util.Collection<Any>, java.util.List<Any>, Any, AnySeq

public final class AnySeqImpl
extends AbstractAny
implements AnySeq

Sequence of Any objects.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.smila.datamodel.Any
Any.ValueType
 
Field Summary
 
Fields inherited from class org.eclipse.smila.datamodel.impl.AbstractAny
_valueType
 
Constructor Summary
AnySeqImpl()
          constructs a new instance of AnySeqImpl.
 
Method Summary
 boolean add(Any value)
          
 void add(int index, Any element)
          
 boolean add(java.lang.Number n)
          Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object of type DOUBLE.
 boolean add(java.lang.String e)
          
 boolean addAll(java.util.Collection<? extends Any> c)
          
 boolean addAll(int index, java.util.Collection<? extends Any> c)
          
 java.util.List<java.lang.Long> asLongs()
          returns all values as a List of Long.
 AnySeq asSeq()
          returns this Any as an AnySeq object or throws an InvalidValueTypeException.
 java.util.List<java.lang.String> asStrings()
          returns all values as a List of Strings.
 void clear()
          
 boolean contains(java.lang.Object o)
          
 boolean containsAll(java.util.Collection<?> c)
          
 boolean equals(java.lang.Object obj)
          
 Any get(int index)
          
 java.lang.Boolean getBooleanValue(int index)
          
 java.util.Date getDateTimeValue(int index)
          
 java.util.Date getDateValue(int index)
          
 java.lang.Double getDoubleValue(int index)
          
 java.lang.Long getLongValue(int index)
          
 AnyMap getMap(int index)
          
 AnySeq getSeq(int index)
          
 java.lang.String getStringValue(int index)
          
 Value getValue(int index)
          
 int hashCode()
          
 int indexOf(java.lang.Object o)
          
 boolean isEmpty()
          
 java.util.Iterator<Any> iterator()
          
 int lastIndexOf(java.lang.Object o)
          
 java.util.ListIterator<Any> listIterator()
          
 java.util.ListIterator<Any> listIterator(int index)
          
 Any remove(int index)
          
 boolean remove(java.lang.Object o)
          
 boolean removeAll(java.util.Collection<?> c)
          
 boolean retainAll(java.util.Collection<?> c)
          
 Any set(int index, Any element)
          
 int size()
          
 java.util.List<Any> subList(int fromIndex, int toIndex)
          
 java.lang.Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
 java.lang.String toString()
          
 
Methods inherited from class org.eclipse.smila.datamodel.impl.AbstractAny
asMap, asValue, getFactory, getValueType, isBoolean, isDate, isDateTime, isDouble, isLong, isMap, isNumber, isSeq, isString, isValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.smila.datamodel.Any
asMap, asValue, getFactory, getValueType, isBoolean, isDate, isDateTime, isDouble, isLong, isMap, isNumber, isSeq, isString, isValue
 

Constructor Detail

AnySeqImpl

public AnySeqImpl()
constructs a new instance of AnySeqImpl.

Method Detail

add

public boolean add(Any value)

Specified by:
add in interface java.util.Collection<Any>
Specified by:
add in interface java.util.List<Any>

add

public boolean add(java.lang.String e)

Specified by:
add in interface AnySeq
Parameters:
e - The string object to add
Returns:
true if successfully added, false else

add

public boolean add(java.lang.Number n)
Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object of type DOUBLE.

Specified by:
add in interface AnySeq
Parameters:
n - The number object to add
Returns:
true if successfully added, false else

add

public void add(int index,
                Any element)

Specified by:
add in interface java.util.List<Any>
Specified by:
add in interface AnySeq
Parameters:
index - The index where to add the any object
element - The any object to add

addAll

public boolean addAll(java.util.Collection<? extends Any> c)

Specified by:
addAll in interface java.util.Collection<Any>
Specified by:
addAll in interface java.util.List<Any>

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends Any> c)

Specified by:
addAll in interface java.util.List<Any>

clear

public void clear()

Specified by:
clear in interface java.util.Collection<Any>
Specified by:
clear in interface java.util.List<Any>

contains

public boolean contains(java.lang.Object o)

Specified by:
contains in interface java.util.Collection<Any>
Specified by:
contains in interface java.util.List<Any>

containsAll

public boolean containsAll(java.util.Collection<?> c)

Specified by:
containsAll in interface java.util.Collection<Any>
Specified by:
containsAll in interface java.util.List<Any>

get

public Any get(int index)

Specified by:
get in interface java.util.List<Any>

set

public Any set(int index,
               Any element)

Specified by:
set in interface java.util.List<Any>

indexOf

public int indexOf(java.lang.Object o)

Specified by:
indexOf in interface java.util.List<Any>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface java.util.Collection<Any>
Specified by:
isEmpty in interface java.util.List<Any>
Specified by:
isEmpty in interface Any
Returns:
true, if the Any does not have content. For Value: returns always false.

iterator

public java.util.Iterator<Any> iterator()

Specified by:
iterator in interface java.lang.Iterable<Any>
Specified by:
iterator in interface java.util.Collection<Any>
Specified by:
iterator in interface java.util.List<Any>
Specified by:
iterator in interface Any
Returns:
iterator over elements. For Value, this return an iterator about the value itself. For AnyMap it returns an iterator on the values.

lastIndexOf

public int lastIndexOf(java.lang.Object o)

Specified by:
lastIndexOf in interface java.util.List<Any>

listIterator

public java.util.ListIterator<Any> listIterator()

Specified by:
listIterator in interface java.util.List<Any>

listIterator

public java.util.ListIterator<Any> listIterator(int index)

Specified by:
listIterator in interface java.util.List<Any>

remove

public Any remove(int index)

Specified by:
remove in interface java.util.List<Any>

remove

public boolean remove(java.lang.Object o)

Specified by:
remove in interface java.util.Collection<Any>
Specified by:
remove in interface java.util.List<Any>

removeAll

public boolean removeAll(java.util.Collection<?> c)

Specified by:
removeAll in interface java.util.Collection<Any>
Specified by:
removeAll in interface java.util.List<Any>

retainAll

public boolean retainAll(java.util.Collection<?> c)

Specified by:
retainAll in interface java.util.Collection<Any>
Specified by:
retainAll in interface java.util.List<Any>

size

public int size()

Specified by:
size in interface java.util.Collection<Any>
Specified by:
size in interface java.util.List<Any>
Specified by:
size in interface Any
Returns:
size of Any. For Value this is always 1.

subList

public java.util.List<Any> subList(int fromIndex,
                                   int toIndex)

Specified by:
subList in interface java.util.List<Any>

toArray

public java.lang.Object[] toArray()

Specified by:
toArray in interface java.util.Collection<Any>
Specified by:
toArray in interface java.util.List<Any>

toArray

public <T> T[] toArray(T[] a)

Specified by:
toArray in interface java.util.Collection<Any>
Specified by:
toArray in interface java.util.List<Any>

getMap

public AnyMap getMap(int index)

Specified by:
getMap in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The AnyMap matching to the index, an InvalidValueTypeException is thrown if the value is not of type AnyMap

getSeq

public AnySeq getSeq(int index)

Specified by:
getSeq in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The AnySeq matching to this index, an InvalidValueTypeException is thrown if the value is not of type

getValue

public Value getValue(int index)

Specified by:
getValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The value matching to this index, an InvalidValueTypeException is thrown if the value is no value type.

getStringValue

public java.lang.String getStringValue(int index)

Specified by:
getStringValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The string value matching to this index, an InvalidValueTypeException is thrown if the value is not of type string

getDoubleValue

public java.lang.Double getDoubleValue(int index)

Specified by:
getDoubleValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The double value matching to this index, an InvalidValueTypeException is thrown if the value is not of type double

getLongValue

public java.lang.Long getLongValue(int index)

Specified by:
getLongValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The long value matching to this index, an InvalidValueTypeException is thrown if the value is not of type long

getBooleanValue

public java.lang.Boolean getBooleanValue(int index)

Specified by:
getBooleanValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The boolean value matching to this index, an InvalidValueTypeException is thrown if the value is not of type boolean

getDateValue

public java.util.Date getDateValue(int index)

Specified by:
getDateValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The date value matching to this index, an InvalidValueTypeException is thrown if the value is not of type date

getDateTimeValue

public java.util.Date getDateTimeValue(int index)

Specified by:
getDateTimeValue in interface AnySeq
Parameters:
index - The index of the object to return
Returns:
The date time value matching to this index, an InvalidValueTypeException is thrown if the value is not of type date time

hashCode

public int hashCode()

Specified by:
hashCode in interface java.util.Collection<Any>
Specified by:
hashCode in interface java.util.List<Any>
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Specified by:
equals in interface java.util.Collection<Any>
Specified by:
equals in interface java.util.List<Any>
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

asSeq

public AnySeq asSeq()
returns this Any as an AnySeq object or throws an InvalidValueTypeException.

Specified by:
asSeq in interface Any
Overrides:
asSeq in class AbstractAny
See Also:
Any.asSeq()

asStrings

public java.util.List<java.lang.String> asStrings()
returns all values as a List of Strings.

Specified by:
asStrings in interface AnySeq
See Also:
AnySeq.asStrings()

asLongs

public java.util.List<java.lang.Long> asLongs()
returns all values as a List of Long.

Specified by:
asLongs in interface AnySeq
See Also:
AnySeq.asLongs()

SMILA (incubation) API documentation