com.cometway.props
Class VectorPropsContainer

java.lang.Object
  extended by com.cometway.props.AbstractPropsContainer
      extended by com.cometway.props.VectorPropsContainer
All Implemented Interfaces:
IPropsContainer

public class VectorPropsContainer
extends AbstractPropsContainer

This props container uses a Vector for indexable storage as a Props.


Constructor Summary
VectorPropsContainer()
          Creates a new instance with its own Vector for storage.
VectorPropsContainer(java.util.Vector v)
          Creates a new instance using the specified Vector for storage.
 
Method Summary
 void copy(IPropsContainer ipc)
          Copys the elements specified by enumerateProps() into the Props.
 java.util.Enumeration enumerateProps()
          Returns a range of integer keys represented by the storage Vector.
 java.lang.Object getProperty(java.lang.String key)
          Returns the Object specified by key.
 java.util.Vector getVector()
          Returns the Vector used for storage.
 boolean removeProperty(java.lang.String key)
          Removes the specified Object at the Vector index specified by key.
 void setProperty(java.lang.String key, java.lang.Object value)
          Sets the specified Vector property.
 void setVector(java.util.Vector v)
          Sets the Vector used for Props storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorPropsContainer

public VectorPropsContainer()
Creates a new instance with its own Vector for storage.


VectorPropsContainer

public VectorPropsContainer(java.util.Vector v)
Creates a new instance using the specified Vector for storage.

Method Detail

getVector

public java.util.Vector getVector()
Returns the Vector used for storage.


getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns the Object specified by key.
 If the key is Vector, the Vector used for storage is returned.
 If the key is size, the result of Vector.size() is returned.
 If the key is isEmpty, the result of Vector.isEmpty() is returned.
 If the key is capacity, the result of Vector.capacity() is returned.
 If the key is elements, the result of Vector.elements() is returned.
 If the key is firstElement, the result of Vector.firstElement() is returned.
 If the key is lastElement, the result of Vector.lastElement() is returned.
 If the key is an integer, the result of Vector.get(integer) is returned.
 Otherwise, null is returned.

Parameters:
key - the name of the object to retrieve.
Returns:
an object reference.

removeProperty

public boolean removeProperty(java.lang.String key)
Removes the specified Object at the Vector index specified by key. Returns true if the key is a valid integer within the range of the Vectors size; false otherwise.

Parameters:
key - the name of the object to remove.
Returns:
true if the object existed and was removed; false otherwise.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Sets the specified Vector property.
 If the key is Vector; the storage Vector is replaced by the value.
 If the key is size; the storage Vector is set to the specified size using Vector.setSize().
 If the key is capacity; the storage Vector capacity is incresed using Vector.ensureCapacity().
 If the key is add; the value is appended to the storage Vector using Vector.add().
 If the key is an integer within the valid range of the Vector, the specified element is replaced by the value.

Parameters:
key - the name of the object to add or change.
value - a reference to the new object.

setVector

public void setVector(java.util.Vector v)
Sets the Vector used for Props storage.


copy

public void copy(IPropsContainer ipc)
Copys the elements specified by enumerateProps() into the Props.

Parameters:
ipc - the container to be copied into.

enumerateProps

public java.util.Enumeration enumerateProps()
Returns a range of integer keys represented by the storage Vector.

Returns:
an Enumeration of keys