edu.cmu.cs.able.gaugeInfrastructure.util
Class StringPairVector

java.lang.Object
  |
  +--edu.cmu.cs.able.gaugeInfrastructure.util.StringPairVector
All Implemented Interfaces:
java.io.Serializable

public class StringPairVector
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
StringPairVector()
           
 
Method Summary
 void addElement(edu.cmu.cs.able.gaugeInfrastructure.util.StringPair sp)
          Adds the specified component to the end of this vector, increasing its size by one.
 void addElement(java.lang.String name, java.lang.String value)
          Adds the specified component to the end of this vector, increasing its size by one.
 void copyInto(StringPairVector spv)
          Copies the values contained in this into the StringPairVector passed in.
 edu.cmu.cs.able.gaugeInfrastructure.util.StringPair elementAt(int index)
          Returns the component at the specified index.
 java.util.Enumeration elements()
          returns all the elements as an Enumeration
 boolean equals(java.lang.Object comp)
           
 java.lang.String getValue(java.lang.String name)
          Gets the value of a specified pair in this vector.
 boolean isEmpty()
          Tests if this vector has no components.
 java.lang.String nameAt(int index)
          Gets the name of a specified pair in this vector.
 void removeAllElements()
          Removes all components from this vector and sets its size to zero.
 void removeElementAt(int index)
          Removes the first (lowest-indexed) occurrence of the argument from this vector.
 void setValue(int index, java.lang.String value)
          Sets the value of a specified pair in this vector.
 void setValue(java.lang.String name, java.lang.String value)
          Sets the value of a specified pair in this vector.
 int size()
          Returns the number of components in this vector.
 java.lang.String toString()
          Returns a string representation of this Vector, containing the String representation of each element.
 java.lang.String valueAt(int index)
          Gets the value of a specified pair in this vector.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringPairVector

public StringPairVector()
Method Detail

size

public int size()
Returns the number of components in this vector.
Returns:
the number of components in this vector.

isEmpty

public boolean isEmpty()
Tests if this vector has no components.
Returns:
true if and only if this vector has no components, that is, its size is zero; false otherwise.

elements

public java.util.Enumeration elements()
returns all the elements as an Enumeration
Returns:
The enumeration of all the elements.

addElement

public void addElement(java.lang.String name,
                       java.lang.String value)
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.
Parameters:
name - the name of the pair to be added.
value - the value of the pair to be added.

addElement

public void addElement(edu.cmu.cs.able.gaugeInfrastructure.util.StringPair sp)
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.
Parameters:
sp - The element to add

elementAt

public edu.cmu.cs.able.gaugeInfrastructure.util.StringPair elementAt(int index)
Returns the component at the specified index.
Parameters:
index - an index into this vector.
Returns:
the pair at the specified index.

removeElementAt

public void removeElementAt(int index)
Removes the first (lowest-indexed) occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.

Parameters:
index - the index to be deleted.

removeAllElements

public void removeAllElements()
Removes all components from this vector and sets its size to zero.

getValue

public java.lang.String getValue(java.lang.String name)
Gets the value of a specified pair in this vector.
Parameters:
name - name of the pair.
Returns:
value of the pair.

setValue

public void setValue(java.lang.String name,
                     java.lang.String value)
Sets the value of a specified pair in this vector.
Parameters:
name - name of the pair.
value - value of the pair.

setValue

public void setValue(int index,
                     java.lang.String value)
Sets the value of a specified pair in this vector.

Parameters:
index - index of the pair.
value - value of the pair.

nameAt

public java.lang.String nameAt(int index)
Gets the name of a specified pair in this vector.

Parameters:
index - index of the pair.
Returns:
name of the pair.

valueAt

public java.lang.String valueAt(int index)
Gets the value of a specified pair in this vector.

Parameters:
index - index of the pair.
Returns:
value of the pair.

copyInto

public void copyInto(StringPairVector spv)
Copies the values contained in this into the StringPairVector passed in.

Parameters:
spv - The StringPairVector to copy elements into

toString

public java.lang.String toString()
Returns a string representation of this Vector, containing the String representation of each element.
Overrides:
toString in class java.lang.Object
Returns:
The string representation

equals

public boolean equals(java.lang.Object comp)
Overrides:
equals in class java.lang.Object