spark.data
Class SArray

java.lang.Object
  extended by spark.data.SArray
All Implemented Interfaces:
SA, SParented

public class SArray
extends java.lang.Object
implements SA

This is a concrete implementation of SA that implements arrays with arbitrary content and of dynamic length.

Author:
olsen

Constructor Summary
SArray()
           
 
Method Summary
 void add(boolean val)
           
 void add(double val)
           
 void add(long val)
           
 void add(SA val)
           
 void add(SO val)
           
 void add(java.lang.String val)
           
 void add(SV val)
          Adds a new value to the end of the array
 void delete(int index)
          Removes a value from the array.
 void delete(int first, int last)
          Removes a sequence of values from the array.
 SA extract(int first, int last)
          Functions the same as delete except that the values to be deleted are first copied out of the array and then returned as an array.
 SV get(int index)
          The value stored at index.
 double getDouble(int index)
           
 long getLong(int index)
           
 SA getSA(int index)
           
 SO getSO(int index)
           
 java.lang.String getString(int index)
           
 void insert(int index, boolean val)
           
 void insert(int index, double val)
           
 void insert(int index, long val)
           
 void insert(int index, SA vals)
          Inserts a bunch of values into the array.
 void insert(int index, SO val)
           
 void insert(int index, java.lang.String val)
           
 void insert(int index, SV val)
          Inserts a value into the array at the specified index.
 boolean isTrue(int index)
           
 SParented myParent()
          Returns the parent of this object, if this object is part of a tree.
 void newParent(SParented newParent)
          changes the parent of this object.
 void set(int index, boolean val)
           
 void set(int index, double val)
           
 void set(int index, long val)
           
 void set(int index, SA val)
           
 void set(int index, SO val)
           
 void set(int index, java.lang.String val)
           
 void set(int index, SV val)
          Changes the value at a particular index
 int size()
          the size of the array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SArray

public SArray()
Method Detail

size

public int size()
Description copied from interface: SA
the size of the array

Specified by:
size in interface SA
Returns:
the total number of values in the array

get

public SV get(int index)
Description copied from interface: SA
The value stored at index.

Specified by:
get in interface SA
Parameters:
index - the index of the value to be retrieved.
Returns:
the retrieved value.

set

public void set(int index,
                SV val)
Description copied from interface: SA
Changes the value at a particular index

Specified by:
set in interface SA
Parameters:
index - the index where the value is to be saved
val - the value to be saved

add

public void add(SV val)
Description copied from interface: SA
Adds a new value to the end of the array

Specified by:
add in interface SA
Parameters:
val - the new value

insert

public void insert(int index,
                   SV val)
Description copied from interface: SA
Inserts a value into the array at the specified index. All values with equal or greater index are moved up one and the array is enlarged by 1.

Specified by:
insert in interface SA
Parameters:
index - the location where the new value is to be inserted.
val - the new value

insert

public void insert(int index,
                   SA vals)
Description copied from interface: SA
Inserts a bunch of values into the array. The array is extended by vals.size(), all elements at index or greater are moved up by vals.size() and the new values are copied into the array starting at index.

Specified by:
insert in interface SA
Parameters:
index - the location in the array where the
vals - the new values to be inserted

delete

public void delete(int index)
Description copied from interface: SA
Removes a value from the array. All elements with a greater index are moved down 1. If the array size cannot be changed, a null value can be inserted at the end.

Specified by:
delete in interface SA
Parameters:
index - the location of the value to be removed.

delete

public void delete(int first,
                   int last)
Description copied from interface: SA
Removes a sequence of values from the array. All elements with a greater index than last are moved down. If the array size cannot be changed, null values are inserted at the end.

Specified by:
delete in interface SA
Parameters:
first - the index of the first value to be removed.
last - the index of the last value to be removed.

extract

public SA extract(int first,
                  int last)
Description copied from interface: SA
Functions the same as delete except that the values to be deleted are first copied out of the array and then returned as an array.

Specified by:
extract in interface SA
Parameters:
first - the index of the first value to be removed.
last - the index of the last value to be removed.
Returns:
an array of the values that were deleted.

myParent

public SParented myParent()
Description copied from interface: SParented
Returns the parent of this object, if this object is part of a tree. This has been named so as not to interfere with the get/set method patterns used by SOReflect

Specified by:
myParent in interface SParented
Returns:
the parent object.

newParent

public void newParent(SParented newParent)
Description copied from interface: SParented
changes the parent of this object. This has been named so as not to interfere with the get/set method patterns used by SObjReflect.

Specified by:
newParent in interface SParented
Parameters:
newParent - the new parent object.

set

public void set(int index,
                long val)
Specified by:
set in interface SA

set

public void set(int index,
                double val)
Specified by:
set in interface SA

set

public void set(int index,
                boolean val)
Specified by:
set in interface SA

set

public void set(int index,
                java.lang.String val)
Specified by:
set in interface SA

set

public void set(int index,
                SA val)
Specified by:
set in interface SA

set

public void set(int index,
                SO val)
Specified by:
set in interface SA

add

public void add(long val)
Specified by:
add in interface SA

add

public void add(double val)
Specified by:
add in interface SA

add

public void add(boolean val)
Specified by:
add in interface SA

add

public void add(java.lang.String val)
Specified by:
add in interface SA

add

public void add(SA val)
Specified by:
add in interface SA

add

public void add(SO val)
Specified by:
add in interface SA

insert

public void insert(int index,
                   long val)
Specified by:
insert in interface SA

insert

public void insert(int index,
                   double val)
Specified by:
insert in interface SA

insert

public void insert(int index,
                   boolean val)
Specified by:
insert in interface SA

insert

public void insert(int index,
                   java.lang.String val)
Specified by:
insert in interface SA

insert

public void insert(int index,
                   SO val)
Specified by:
insert in interface SA

getLong

public long getLong(int index)
Specified by:
getLong in interface SA

getDouble

public double getDouble(int index)
Specified by:
getDouble in interface SA

isTrue

public boolean isTrue(int index)
Specified by:
isTrue in interface SA

getString

public java.lang.String getString(int index)
Specified by:
getString in interface SA

getSA

public SA getSA(int index)
Specified by:
getSA in interface SA

getSO

public SO getSO(int index)
Specified by:
getSO in interface SA