NIST SIP Parser and Stack (v1.2) API

gov.nist.core
Class NameValueList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.AbstractSequentialList
                    |
                    +--java.util.LinkedList
                          |
                          +--gov.nist.core.GenericObjectList
                                |
                                +--gov.nist.core.NameValueList
All Implemented Interfaces:
Cloneable, Collection, List, Serializable

public class NameValueList
extends GenericObjectList

Implements a simple NameValue association with a quick lookup function (via a hash table) this class is not thread safe because it uses HashTables.

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan
This code is in the public domain.
See Also:
Serialized Form

Constructor Summary
NameValueList()
          default constructor.
NameValueList(String listName)
           
 
Method Summary
 void add(NameValue nv)
           
 boolean add(Object obj)
          Generic add method (throws a class cast exception if anything but NameValue is added.
 void add(String name, Object obj)
          Add a name value record to this list.
 Object clone()
          Implement the clone method.
 void concatenate(NameValueList other)
          Grows this name-value list by adding all the elements from the other NameValue list.
 boolean delete(String name)
          Remove the element corresponding to this name.
 boolean equals(Object otherObject)
          Compare if two NameValue lists are equal.
 GenericObject first()
          Get the first element of the list.
 Iterator getIterator()
          Get the list iterator for this list.
 Iterator getNames()
          Get a list of parameter names.
 NameValue getNameValue(String name)
          Get the NameValue record given a name.
 String getParameter(String name)
          Get the parameter as a String.
 Object getValue(String name)
          Do a lookup on a given name and return value associated with it.
 boolean hasNameValue(String name)
          Returns a boolean telling if this NameValueList has a record with this name
 void set(NameValue nv)
          Set a namevalue object in this list.
 void set(String name, Object value)
          Set a namevalue object in this list.
 
Methods inherited from class gov.nist.core.GenericObjectList
addFirst, debugDump, debugDump, encode, getMyClass, isMySubclass, match, mergeObjects, replace, replace, replace, replace, setMyClass, setSeparator, toString
 
Methods inherited from class java.util.LinkedList
add, addAll, addAll, addLast, clear, contains, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, remove, remove, removeFirst, removeLast, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
hashCode, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

NameValueList

public NameValueList(String listName)

NameValueList

public NameValueList()
default constructor.

Method Detail

add

public void add(NameValue nv)

set

public void set(NameValue nv)
Set a namevalue object in this list.


set

public void set(String name,
                Object value)
Set a namevalue object in this list.


add

public boolean add(Object obj)
Generic add method (throws a class cast exception if anything but NameValue is added.

Specified by:
add in interface List
Overrides:
add in class GenericObjectList

add

public void add(String name,
                Object obj)
Add a name value record to this list.


equals

public boolean equals(Object otherObject)
Compare if two NameValue lists are equal.

Specified by:
equals in interface List
Overrides:
equals in class GenericObjectList
Parameters:
otherObject - is the object to compare to.
Returns:
true if the two objects compare for equality.

getValue

public Object getValue(String name)
Do a lookup on a given name and return value associated with it.


getNameValue

public NameValue getNameValue(String name)
Get the NameValue record given a name.

Since:
1.0

hasNameValue

public boolean hasNameValue(String name)
Returns a boolean telling if this NameValueList has a record with this name

Since:
1.0

delete

public boolean delete(String name)
Remove the element corresponding to this name.

Since:
1.0

getIterator

public Iterator getIterator()
Get the list iterator for this list.

Overrides:
getIterator in class GenericObjectList

getNames

public Iterator getNames()
Get a list of parameter names.

Returns:
a list iterator that has the names of the parameters.

concatenate

public void concatenate(NameValueList other)
Grows this name-value list by adding all the elements from the other NameValue list. Merges the hash tables for the name value lists together.


clone

public Object clone()
Description copied from class: GenericObjectList
Implement the clone method.

Overrides:
clone in class GenericObjectList

getParameter

public String getParameter(String name)
Get the parameter as a String.

Returns:
the parameter as a string.

first

public GenericObject first()
Get the first element of the list.

Overrides:
first in class GenericObjectList

NIST SIP Parser and Stack (v1.2) API

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Get the latest distribution.
Submit a bug report or feature request.