csli.dialog.core.util
Class TermList

java.lang.Object
  extended by csli.dialog.core.util.TermList
All Implemented Interfaces:
Serializable

public class TermList
extends Object
implements Serializable

List of Terms. Note that this does NO error-checking!! If incoming string is an ill-formed term then result is unpredictable ... Author: Lawrence Cavedon, 3/03 7/21/03 : added the ability to parse quoted terms as units. Doesn't support nesting of quote (because there is only one quote character) and has no error checking.

See Also:
Serialized Form

Field Summary
protected  List terms
           
 
Constructor Summary
TermList()
          Default ctor.
TermList(List termList)
          Construct TermList from list of Term objects
TermList(String string)
          Constructs TermList from comma-separated list of terms
TermList(Term term)
          Deprecated. use TermList( A.list(term) ) instead
TermList(Term term1, Term term2)
          Deprecated. use TermList( A.list(term1, term2) ) instead
 
Method Summary
 void addTerm(int index, Term term)
          Insert a new term at the specified position
 void addTerm(Term term)
          Insert a new term at the end
 Term getTerm(int n)
          Return nth Term---indexing starts at 0.
static void main(String[] params)
          Simple test program ...
protected  String quotedTerm(String s)
           
 void setTerm(int index, Term term)
          Replaces the term at the given positon with the new one
 int size()
           
protected  String tillMatching(String string, char openChar, char closeChar)
           
 String toString()
          Convert this list of Terms to comma-separated string of term-strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

terms

protected List terms
Constructor Detail

TermList

public TermList()
Default ctor. Constructs an empty term list


TermList

public TermList(String string)
Constructs TermList from comma-separated list of terms


TermList

public TermList(List termList)
Construct TermList from list of Term objects


TermList

public TermList(Term term)
Deprecated. use TermList( A.list(term) ) instead


TermList

public TermList(Term term1,
                Term term2)
Deprecated. use TermList( A.list(term1, term2) ) instead

Method Detail

size

public int size()
Returns:
the number of children

getTerm

public Term getTerm(int n)
Return nth Term---indexing starts at 0.


addTerm

public void addTerm(Term term)
Insert a new term at the end


addTerm

public void addTerm(int index,
                    Term term)
Insert a new term at the specified position


setTerm

public void setTerm(int index,
                    Term term)
Replaces the term at the given positon with the new one

Parameters:
index -
term -

tillMatching

protected String tillMatching(String string,
                              char openChar,
                              char closeChar)

quotedTerm

protected String quotedTerm(String s)

toString

public String toString()
Convert this list of Terms to comma-separated string of term-strings

Overrides:
toString in class Object

main

public static void main(String[] params)
                 throws Exception
Simple test program ...

Throws:
Exception