Class Vector
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector
-
- com.sun.jdo.spi.persistence.support.sqlstore.sco.Vector
-
- All Implemented Interfaces:
SCO,SCOCollection,Serializable,Cloneable,Iterable,Collection,List,RandomAccess
public class Vector extends Vector implements SCOCollection
A mutable 2nd class object date.- Version:
- 1.0
- Author:
- Marina Vatkina
- See Also:
Vector, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description Vector(Object owner, String fieldName, Class elementType, boolean allowNulls)Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.Vector(Object owner, String fieldName, Class elementType, boolean allowNulls, int initialCapacity)Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Object element)Inserts the specified element at the specified position in this Vector.booleanadd(Object o)Appends the specified element to the end of this Vector.booleanaddAll(int index, Collection c)Inserts all of the elements in in the specified Collection into this Vector at the specified position.booleanaddAll(Collection c)Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.voidaddAllInternal(Collection c)Adds a Collection to the list without recording changesvoidaddElement(Object obj)Adds the specified component to the end of this vector, increasing its size by one.voidaddInternal(Object o)Adds an object to the list without recording changesvoidaddToBaseCollection(Object o)Adds an object to the list without recording changes.voidapplyDeferredUpdates(Collection c)voidapplyUpdates(StateManager sm, boolean modified)Apply changes (can be a no-op)voidclear()Removes all of the elements from this Vector.voidclearInternal()Clears Collection without notifing the ownerObjectclone()Creates and returns a copy of this object.ObjectcloneInternal()Creates and returns a copy of this object without resetting the owner and field value.CollectiongetAdded()Returns added collectionStringgetFieldName()Returns the field nameObjectgetOwner()Returns the owner object of the SCO instanceCollectiongetRemoved()Returns removed collectionvoidinsertElementAt(Object obj, int index)Inserts the specified object as a component in this vector at the specifiedindex.booleanisDeferred()StateManagermakeDirty()Marks object dirtyvoidmarkDeferred()Objectremove(int index)Removes the element at the specified position in this Vector.booleanremove(Object o)Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.booleanremoveAll(Collection c)Removes from this Vector all of its elements that are contained in the specified Collection.voidremoveAllElements()Removes all components from this vector and sets its size to zero.voidremoveAllInternal(Collection c)Removes from this collection without recording changesbooleanremoveElement(Object obj)Removes the first (lowest-indexed) occurrence of the argument from this vector.voidremoveElementAt(int index)Deletes the component at the specified index.voidremoveInternal(Object o)Removes an element without notifing the ownervoidreset()Cleans removed and added listsbooleanretainAll(Collection c)Retains only the elements in this Vector that are contained in the specified Collection.Objectset(int index, Object element)Replaces the element at the specified position in this Vector with the specified element.voidsetElementAt(Object obj, int index)Sets the component at the specifiedindexof this vector to be the specified object.voidsetOwner(Object owner, String fieldName, Class elementType)Set the owner if this instance is not owned.voidunsetOwner()Nullifies references to the owner Object and Field-
Methods inherited from class java.util.Vector
capacity, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, removeIf, removeRange, replaceAll, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Constructor Detail
-
Vector
public Vector(Object owner, String fieldName, Class elementType, boolean allowNulls)
Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero. Assigns owning object and field name- Parameters:
owner- the owning objectfieldName- the owning field nameelementType- the element types allowedallowNulls- true if nulls are allowed
-
Vector
public Vector(Object owner, String fieldName, Class elementType, boolean allowNulls, int initialCapacity)
Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero. Assigns owning object and field name- Parameters:
owner- the owning objectfieldName- the owning field nameelementType- the element types allowedallowNulls- true if nulls are allowedinitialCapacity- the initial capacity of the vector.- Throws:
IllegalArgumentException- if the specified initial capacity is negative
-
-
Method Detail
-
setElementAt
public void setElementAt(Object obj, int index)
Sets the component at the specifiedindexof this vector to be the specified object. The previous component at that position is discarded.- Overrides:
setElementAtin classVector- Parameters:
obj- what the component is to be set to.index- the specified index.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
Vector
-
removeElementAt
public void removeElementAt(int index)
Deletes the component at the specified index.- Overrides:
removeElementAtin classVector- Parameters:
index- the index of the object to remove.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
Vector
-
insertElementAt
public void insertElementAt(Object obj, int index)
Inserts the specified object as a component in this vector at the specifiedindex.- Overrides:
insertElementAtin classVector- Parameters:
obj- the component to insert.index- where to insert the new component.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
Vector
-
addElement
public void addElement(Object obj)
Adds the specified component to the end of this vector, increasing its size by one.- Overrides:
addElementin classVector- Parameters:
obj- the component to be added.- See Also:
Vector
-
removeElement
public boolean removeElement(Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this vector.- Overrides:
removeElementin classVector- Parameters:
obj- the component to be removed.- Returns:
trueif the argument was a component of this vector;falseotherwise.- See Also:
Vector
-
removeAllElements
public void removeAllElements()
Removes all components from this vector and sets its size to zero.- Overrides:
removeAllElementsin classVector- See Also:
Vector
-
set
public Object set(int index, Object element)
Replaces the element at the specified position in this Vector with the specified element.- Specified by:
setin interfaceList- Overrides:
setin classVector- Parameters:
index- index of element to replace.element- element to be stored at the specified position.- Returns:
- the element previously at the specified position.
- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index >= size()).IllegalArgumentException- fromIndex > toIndex.- See Also:
Vector
-
add
public boolean add(Object o)
Appends the specified element to the end of this Vector.
-
remove
public boolean remove(Object o)
Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.
-
add
public void add(int index, Object element)Inserts the specified element at the specified position in this Vector.
-
remove
public Object remove(int index)
Removes the element at the specified position in this Vector. shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the Vector.
-
clear
public void clear()
Removes all of the elements from this Vector. The Vector will be empty after this call returns (unless it throws an exception).
-
addAll
public boolean addAll(Collection c)
Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.
-
removeAll
public boolean removeAll(Collection c)
Removes from this Vector all of its elements that are contained in the specified Collection.
-
addAll
public boolean addAll(int index, Collection c)Inserts all of the elements in in the specified Collection into this Vector at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the Vector in the order that they are returned by the specified Collection's iterator.- Specified by:
addAllin interfaceList- Overrides:
addAllin classVector- Parameters:
index- index at which to insert first element from the specified collection.c- elements to be inserted into this Vector.- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index > size()).- See Also:
Vector
-
retainAll
public boolean retainAll(Collection c)
Retains only the elements in this Vector that are contained in the specified Collection.
-
clone
public Object clone()
Creates and returns a copy of this object.Mutable Second Class Objects are required to provide a public clone method in order to allow for copying PersistenceCapable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.
-
cloneInternal
public Object cloneInternal()
Creates and returns a copy of this object without resetting the owner and field value.- Specified by:
cloneInternalin interfaceSCO
-
reset
public void reset()
Cleans removed and added lists- Specified by:
resetin interfaceSCOCollection
-
markDeferred
public void markDeferred()
- Specified by:
markDeferredin interfaceSCOCollection
-
isDeferred
public boolean isDeferred()
- Specified by:
isDeferredin interfaceSCOCollection
-
applyDeferredUpdates
public void applyDeferredUpdates(Collection c)
- Specified by:
applyDeferredUpdatesin interfaceSCOCollection
-
addInternal
public void addInternal(Object o)
Adds an object to the list without recording changes- Specified by:
addInternalin interfaceSCOCollection
-
addAllInternal
public void addAllInternal(Collection c)
Adds a Collection to the list without recording changes- Specified by:
addAllInternalin interfaceSCOCollection
-
addToBaseCollection
public void addToBaseCollection(Object o)
Description copied from interface:SCOCollectionAdds an object to the list without recording changes.- Specified by:
addToBaseCollectionin interfaceSCOCollection
-
removeAllInternal
public void removeAllInternal(Collection c)
Removes from this collection without recording changes- Specified by:
removeAllInternalin interfaceSCOCollection
-
getAdded
public Collection getAdded()
Returns added collection- Specified by:
getAddedin interfaceSCOCollection- Returns:
- added collection of added elements
-
getRemoved
public Collection getRemoved()
Returns removed collection- Specified by:
getRemovedin interfaceSCOCollection- Returns:
- removed collection of removed elements
-
clearInternal
public void clearInternal()
Clears Collection without notifing the owner- Specified by:
clearInternalin interfaceSCOCollection
-
removeInternal
public void removeInternal(Object o)
Removes an element without notifing the owner- Specified by:
removeInternalin interfaceSCOCollection
-
unsetOwner
public void unsetOwner()
Nullifies references to the owner Object and Field- Specified by:
unsetOwnerin interfaceSCO
-
getOwner
public Object getOwner()
Returns the owner object of the SCO instance
-
getFieldName
public String getFieldName()
Returns the field name- Specified by:
getFieldNamein interfaceSCO- Returns:
- field name as java.lang.String
-
makeDirty
public StateManager makeDirty()
Marks object dirty
-
applyUpdates
public void applyUpdates(StateManager sm, boolean modified)
Apply changes (can be a no-op)- Specified by:
applyUpdatesin interfaceSCO
-
setOwner
public void setOwner(Object owner, String fieldName, Class elementType)
Set the owner if this instance is not owned.- Specified by:
setOwnerin interfaceSCOCollection- Parameters:
owner- the new owner.fieldName- the new field name.elementType- the new element type as Class, or null if type is not to be checked.- See Also:
SCOCollection.setOwner(java.lang.Object, java.lang.String, java.lang.Class)
-
-