Class COM.odi.util.OSVectorList

java.lang.Object
   |
   +----COM.odi.util.OSVector
           |
           +----COM.odi.util.OSVectorList

public class OSVectorList
extends OSVector
implements List
OSVectorList implements COM.odi.util.List. It behaves identically to an OSVector, except that its equals() and hashCode() methods meet the specification of COM.odi.util.List. This specification requires that equality and hashcode be content-based rather than identity-based. Two lists are equal if and only if they have the same elements, in the same order. Note that because the hashCode is content-based, it is not appropriate to store an instance of OSVectorList in a hashtable, or any other hashtable-based collection representation. Additional information about OSVectorList is in the user guide.

Here are exceptions that might be thrown by many of the methods in this class:

DatabaseNotOpenException If the database containing the object is not open.

NoTransactionInProgressException If there is no transaction in progress.

ObjectNotFoundException If the object was not found, either because the object itself, its segment, or its database was destroyed. ObjectException Ifthe object was local and was fetched in a previous transaction.

ObjectStoreException If the session implied by an argument to the call or the object the method is called on is not the same as the session associated with the current thread.

UpdateReadOnlyException If there is a readonly transaction in progress or if the database is open for readonly.

See Also:
IPersistent, OSVector

Constructor Index

 o OSVectorList()
Constructs an empty vector.
 o OSVectorList(int)
Constructs an empty vectorlist with the specified storage capacity.
 o OSVectorList(int, int)
Constructs an empty vectorlist with the specified storage capacity and the specified capacityIncrement.

Method Index

 o addElement(Object)
Appends the element to the vector.
 o equals(Object)
Compares the specified Object with this List for equality.
 o hashCode()
UNSUPPORTED IN THIS RELEASE OF PSE.
 o insertElementAt(Object, int)
Inserts the specified object at the specified index.
 o removeAllElements()
Removes all elements of the vector.
 o removeElementAt(int)
Deletes the element at the specified index and moves down all elements with indexes greater than the current index.
 o setElementAt(Object, int)
Sets the element at the specified index to the specified object.
 o setSize(int)
Sets the size of the vector.

Constructors

 o OSVectorList
  public OSVectorList(int initialBufferSize,
                      int capacityIncrement)
Constructs an empty vectorlist with the specified storage capacity and the specified capacityIncrement.

Parameters:
initialCapacity - The initial storage capacity of the vector.

capacityIncrement - The amount by which the capacity should be increased when the vector needs to grow.
 o OSVectorList
  public OSVectorList(int initialBufferSize)
Constructs an empty vectorlist with the specified storage capacity. This also sets capacityIncrement to the size of initialBufferSize for elementData growth.

Parameters:
initialCapacity - The initial storage capacity of the vector.
 o OSVectorList
  public OSVectorList()
Constructs an empty vector.

Methods

 o addElement
  public synchronized void addElement(Object obj)
Appends the element to the vector.

Parameters:
obj - The element to be added.
Overrides:
addElement in class OSVector
 o setSize
  public synchronized void setSize(int newSize)
Sets the size of the vector. If the size is less than elementCount, then elements beyond this number are lost. If the size increases, then new elements are set to null.

Parameters:
newSize - The new size of the vector.
Overrides:
setSize in class OSVector
 o setElementAt
  public synchronized void setElementAt(Object obj,
                                        int index)
Sets the element at the specified index to the specified object. If an element already exists at the specified index, it is replaced with the new object.

Parameters:
obj - What the element is to be set to.

index - The index of the modified element.

Throws: IndexOutOfBoundsException
If the index was invalid.
Overrides:
setElementAt in class OSVector
 o removeElementAt
  public synchronized void removeElementAt(int index)
Deletes the element at the specified index and moves down all elements with indexes greater than the current index.

Parameters:
index - The element to remove.

Throws: IndexOutOfBoundsException
If the index was invalid.
Overrides:
removeElementAt in class OSVector
 o insertElementAt
  public synchronized void insertElementAt(Object obj,
                                           int index)
Inserts the specified object at the specified index. Elements with an index greater than or equal to the current index are shifted up.

Parameters:
obj - The element to insert.

index - Where to insert the new element.

Throws: IndexOutOfBoundsException
If the index was invalid.
Overrides:
insertElementAt in class OSVector
 o removeAllElements
  public synchronized void removeAllElements()
Removes all elements of the vector.

Overrides:
removeAllElements in class OSVector
 o equals
  public boolean equals(Object obj)
Compares the specified Object with this List for equality. Returns true if and only if the specified Object is also a List, both Lists have the same size, and all corresponding pairs of elements in the two Lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two Lists are defined to be equal if they contain the same elements in the same order.

Parameters:
o - the Object to be compared for equality with this List.
Returns:
true if the specified Object is equal to this List.
Overrides:
equals in class Object
 o hashCode
  public int hashCode()
UNSUPPORTED IN THIS RELEASE OF PSE. THIS METHOD WILL BE CHANGED TO PROVIDE A BEHAVIOR COMPATIBLE WITH THE JDK1.2 LIST SPECIFICATION, WHEN THE JDK1.2 IS RELEASED.

Throws: UnsupportedOperationException
hashCode() is not supported. Returns the hash code value for this List.
Overrides:
hashCode in class OSVector
See Also:
hashCode, equals, equals

Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.