com.sas.util
Class ArrayAccess

com.sas.util.ArrayAccess
All Implemented Interfaces:
com.sas.PublicClonable, com.sas.util.Countable, IndexedGetInterface, IndexedSetInterface, java.io.Serializable, java.lang.Cloneable

public class ArrayAccess
implements IndexedSetInterface, java.io.Serializable, com.sas.PublicClonable

A wrapper for an Object[] array so that it may be sorted with the static sort methods in Sort

See Also:
VectorAccess, Sort, Serialized Form

Constructor Summary
ArrayAccess(java.lang.Object[] array)
          Construct an ArrayAccess object which wraps an Object array.
 
Method Summary
 java.lang.Object clone()
          Clone the object.
 int count()
          Returns the number of items in the array
 java.lang.Object get(int index)
          Get a value via an integer index.
 void set(int index, java.lang.Object object)
          Set a value via an integer index.
 

Constructor Detail

ArrayAccess

public ArrayAccess(java.lang.Object[] array)
Construct an ArrayAccess object which wraps an Object array.

Parameters:
array - an object array.
Method Detail

get

public java.lang.Object get(int index)
Get a value via an integer index. This is like an array reference.

Specified by:
get in interface IndexedGetInterface
Parameters:
index - the index of the item to fetch.
Returns:
Object the object associated with the index.
Throws:
java.lang.IndexOutOfBoundsException - The implementor of this interface may throw this RuntimeException if the index is not valid.

set

public void set(int index,
                java.lang.Object object)
Set a value via an integer index. This is like an array element assignment.

Specified by:
set in interface IndexedSetInterface
Parameters:
index - the index of the item to store
Object - the object to store or associate with the index.
Throws:
java.lang.IndexOutOfBoundsException - The implementor of this interface may throw this RuntimeException if the index is not valid.

count

public int count()
Returns the number of items in the array

Specified by:
count in interface com.sas.util.Countable
Returns:
the number of items in the array

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the object. This does not clone the array.

Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException - if the clone fails.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.