org.exolab.core.foundation
Interface VectorIfc

All Superinterfaces:
PersistentCapableIfc, java.io.Serializable
All Known Implementing Classes:
PMDVector

public interface VectorIfc
extends PersistentCapableIfc, java.io.Serializable

This interface abstracts a persistent capable Vector data structure so that it can be mapped by various datastores. It basically uses the JDK1.1.2 java.util.Vector to derive the interface and applies only to PersistentCapableIfc instances.

Note that the object is also Serializable

Version:
$Revision: 1.3 $ $Date: 2000/04/30 23:50:18 $
Author:
Jim Alateras

Method Summary
 void add(int index, PersistentCapableIfc element)
          Add the element at the specified index
 boolean add(PersistentCapableIfc element)
          Add the specified element to the end of the Vector
 void addElement(PersistentCapableIfc element)
          Add the specified element to the end of the vector
 void clear()
          Clear the vector
 boolean contains(PersistentCapableIfc element)
          Test to see whether the specified object exists
 PersistentCapableIfc elementAt(int index)
          Return the object at the specified index or null if one does not exist
 java.util.Enumeration elements()
          Return an enumeration of all elements in the Vector
 PersistentCapableIfc firstElement()
          Return the first element in the Vector or null if it is empty
 PersistentCapableIfc get(int index)
          Return the object at the specified index or null
 int indexOf(PersistentCapableIfc element)
          Return the index of the specified element or -1 if it does notr exist
 boolean isEmpty()
          Check to see of the vector is empty.
 PersistentCapableIfc lastElement()
          Return the last element in the Vector or null if it is empty
 PersistentCapableIfc remove(int index)
          Remove the element at the specified index and return it to the client
 boolean remove(PersistentCapableIfc element)
          Remove the specified element from the Vector
 void removeAllElements()
          Remove all the elements from the Vector.
 boolean removeElement(PersistentCapableIfc element)
          Remove the specified element from the Vector.
 void removeElementAt(int index)
          Remove the element at the specified index
 void set(int index, PersistentCapableIfc element)
          Set the object at the location given, overwriting the existing object if it exists.
 int size()
          Return the size of the vector
 java.lang.Object[] toArray()
          Return the objects in the Vector as an array.
 
Methods inherited from interface org.exolab.core.foundation.PersistentCapableIfc
getMinimumObjectSize, getObjectId, getObjectVersion, setMinimumObjectSize
 

Method Detail

size

public int size()
Return the size of the vector

Returns:
int

isEmpty

public boolean isEmpty()
Check to see of the vector is empty.

Returns:
boolean true if it is empty and false otherwise

elements

public java.util.Enumeration elements()
Return an enumeration of all elements in the Vector

Returns:
Enumeration

contains

public boolean contains(PersistentCapableIfc element)
Test to see whether the specified object exists

Parameters:
element - element to test for
Returns:
boolean true if it is present and false otherwise

indexOf

public int indexOf(PersistentCapableIfc element)
Return the index of the specified element or -1 if it does notr exist

Parameters:
element - element to search for
Returns:
int index of the found element or -1.

elementAt

public PersistentCapableIfc elementAt(int index)
Return the object at the specified index or null if one does not exist

Parameters:
index - index to query on
Returns:
PersistentCapableIfc founnd object or null

firstElement

public PersistentCapableIfc firstElement()
Return the first element in the Vector or null if it is empty

Returns:
PersistentCapableIfc first element in the Vector or null

lastElement

public PersistentCapableIfc lastElement()
Return the last element in the Vector or null if it is empty

Returns:
PersistentCapableIfc last element in the Vector or null

removeElementAt

public void removeElementAt(int index)
Remove the element at the specified index

Parameters:
index - index of element to remove

addElement

public void addElement(PersistentCapableIfc element)
Add the specified element to the end of the vector

Parameters:
element - element to add

removeElement

public boolean removeElement(PersistentCapableIfc element)
Remove the specified element from the Vector.

Parameters:
element - element to remove

removeAllElements

public void removeAllElements()
Remove all the elements from the Vector. Functionally, equivalent to the clear method


toArray

public java.lang.Object[] toArray()
Return the objects in the Vector as an array.

Returns:
Object[]

get

public PersistentCapableIfc get(int index)
Return the object at the specified index or null

Returns:
PersistentCapableIfc

add

public boolean add(PersistentCapableIfc element)
Add the specified element to the end of the Vector

Parameters:
element - element to add
Returns:
boolean true if successful and false otherwise

set

public void set(int index,
                PersistentCapableIfc element)
Set the object at the location given, overwriting the existing object if it exists. An additional constraint applies to element in that it must also be of type PersistentCapableIfc

Parameters:
index - index
element - element to add

remove

public boolean remove(PersistentCapableIfc element)
Remove the specified element from the Vector

Parameters:
element - element to remove
Returns:
boolean true if successful; and false otherwise

add

public void add(int index,
                PersistentCapableIfc element)
Add the element at the specified index

Parameters:
index - index
element - element to add

remove

public PersistentCapableIfc remove(int index)
Remove the element at the specified index and return it to the client

Parameters:
index - index to query
Returns:
PersistentCapableIfc returned object

clear

public void clear()
Clear the vector



Copyright © 1999-2005 The Exolab Group. All Rights Reserved.