NIST SIP Parser and Stack (v1.2) API

gov.nist.core
Class GenericObjectList

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

public abstract class GenericObjectList
extends LinkedList

Implements a homogenous consistent linked list. All the objects in the linked list must derive from the same root class. This is a useful constraint to place on our code as this property is invariant.The list is created with the superclass which can be specified as either a class name or a Class.

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

Method Summary
 boolean add(Object obj)
           
 void addFirst(Object objToAdd)
           
 Object clone()
          Implement the clone method.
 String debugDump()
          Convert this list of headers to a formatted string.
 String debugDump(int indent)
          Convert this list of headers to a string (for printing) with an indentation given.
 String encode()
          Encode the list in semicolon separated form.
 boolean equals(Object other)
          Equality checking predicate.
 Iterator getIterator()
          Get the list iterator for this list.
 Class getMyClass()
          Sets the class that all our elements derive from.
static boolean isMySubclass(Class other)
           
 boolean match(Object other)
          Match with a template (return true if we have a superset of the given template.
 void mergeObjects(GenericObjectList mergeList)
          Do a merge of the GenericObjects contained in this list with the GenericObjects in the mergeList.
 void replace(Match regexp, GenericObject replacementObject)
          Do a find and replace of objects in this list.
 void replace(Match regexp, GenericObjectList replacementObject)
          Do a find and replace of objects in this list.
 void replace(String objectText, GenericObject replacementObject, boolean matchSubstring)
          Do a find and replace of objects in this list.
 void replace(String objectText, GenericObjectList replacementObject, boolean matchSubstring)
          Do a find and replace of objects in this list.
 void setMyClass(Class cl)
           
 void setSeparator(String sep)
          Set the separator (for encoding the list)
 String toString()
          Alias for the encode function above.
 
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
 

Method Detail

isMySubclass

public static boolean isMySubclass(Class other)

clone

public Object clone()
Implement the clone method.

Overrides:
clone in class LinkedList

getMyClass

public Class getMyClass()
Sets the class that all our elements derive from.


setMyClass

public void setMyClass(Class cl)

getIterator

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


debugDump

public String debugDump()
Convert this list of headers to a formatted string.


debugDump

public String debugDump(int indent)
Convert this list of headers to a string (for printing) with an indentation given.


add

public boolean add(Object obj)
Specified by:
add in interface List
Overrides:
add in class LinkedList

addFirst

public void addFirst(Object objToAdd)
Overrides:
addFirst in class LinkedList

replace

public void replace(String objectText,
                    GenericObject replacementObject,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a find and replace of objects in this list.

Parameters:
objectText - text of the object to find.
replacementObject - object to replace the target with ( in case a target is found).
matchSubstring - boolean that indicates whether to flag a match when objectText is a substring of a candidate object's encoded text.
IllegalArgumentException

replace

public void replace(String objectText,
                    GenericObjectList replacementObject,
                    boolean matchSubstring)
             throws IllegalArgumentException
Do a find and replace of objects in this list.

Parameters:
objectText - text of the object to find.
replacementObject - object to replace the target with (in case a target is found).
matchSubstring - boolean that indicates whether to flag a match when objectText is a substring of a candidate object's encoded text.
IllegalArgumentException
Since:
v1.0

replace

public void replace(Match regexp,
                    GenericObjectList replacementObject)
             throws IllegalArgumentException
Do a find and replace of objects in this list.

Parameters:
regexp - regular expression to match with the canonical text we want to replace.
replacementObject - object to replace the target with (in case a target is found).
IllegalArgumentException

replace

public void replace(Match regexp,
                    GenericObject replacementObject)
             throws IllegalArgumentException
Do a find and replace of objects in this list.

Parameters:
regexp - match regular expression of the object to find. this is generated using the org.apache.regexp package.
replacementObject - object to replace the target with ( in case a target is found).
IllegalArgumentException

mergeObjects

public void mergeObjects(GenericObjectList mergeList)
Do a merge of the GenericObjects contained in this list with the GenericObjects in the mergeList. Note that this does an inplace modification of the given list. This does an object by object merge of the given objects.

Parameters:
mergeList - is the list of Generic objects that we want to do an object by object merge with. Note that no new objects are added to this list.

encode

public String encode()
Encode the list in semicolon separated form.

Returns:
an encoded string containing the objects in this list.
Since:
v1.0

toString

public String toString()
Alias for the encode function above.

Overrides:
toString in class AbstractCollection

setSeparator

public void setSeparator(String sep)
Set the separator (for encoding the list)

Parameters:
sep - is the new seperator (default is semicolon)
Since:
v1.0

equals

public boolean equals(Object other)
Equality checking predicate.

Specified by:
equals in interface List
Overrides:
equals in class AbstractList

match

public boolean match(Object other)
Match with a template (return true if we have a superset of the given template. This can be used for partial match (template matching of SIP objects). Note -- this implementation is not unnecessarily efficient :-)

Parameters:
other - template object to compare against.

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.