com.cburch.editor.tokens
Class MutableTokenList<T extends BasicToken>

java.lang.Object
  extended by com.cburch.editor.tokens.TokenList<T>
      extended by com.cburch.editor.tokens.MutableTokenList<T>
Type Parameters:
T - the type of token maintained in the list.
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>

public class MutableTokenList<T extends BasicToken>
extends TokenList<T>

Maintains a list of tokens, just as with TokenList, except that modifications are allowed here. The Tokenizer class does not use this class, but other classes may find this useful to maintain their own lists of tokens.

Version:
0.1 2005-05-31
Author:
Carl Burch

Constructor Summary
MutableTokenList()
          Constructs an empty list of tokens.
MutableTokenList(java.util.List<? extends T> initialValues)
          Constructs a list of tokens initially holding the given values.
 
Method Summary
 void add(int arg0, T arg1)
          Implemented as defined in the List interface.
 boolean add(T arg0)
          Implemented as defined in the List interface.
 boolean addAll(java.util.Collection<? extends T> arg0)
          Implemented as defined in the List interface.
 boolean addAll(int arg0, java.util.Collection<? extends T> arg1)
          Implemented as defined in the List interface.
 void clear()
          Implemented as defined in the List interface.
 java.util.Iterator<T> iterator()
           
 java.util.ListIterator<T> listIterator()
           
 java.util.ListIterator<T> listIterator(int arg0)
           
 T remove(int arg0)
          Implemented as defined in the List interface.
 boolean remove(java.lang.Object arg0)
          Implemented as defined in the List interface.
 boolean removeAll(java.util.Collection<?> arg0)
          Implemented as defined in the List interface.
 void replace(int from, int to, java.util.List<T> newTokens)
          Replaces a range of the list with a different list instead.
 boolean retainAll(java.util.Collection<?> arg0)
          Implemented as defined in the List interface.
 T set(int arg0, T arg1)
          Implemented as defined in the List interface.
 java.util.List<T> subList(int arg0, int arg1)
           
 
Methods inherited from class com.cburch.editor.tokens.TokenList
contains, containsAll, get, getIndexContaining, getIndexContaining, getIndexEndingBefore, getIndexEndingBefore, getIndexStartingAfter, getIndexStartingAfter, indexOf, isEmpty, lastIndexOf, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

MutableTokenList

public MutableTokenList()
Constructs an empty list of tokens.


MutableTokenList

public MutableTokenList(java.util.List<? extends T> initialValues)
Constructs a list of tokens initially holding the given values.

Parameters:
initialValues - the tokens to have in the list initially.
Method Detail

replace

public void replace(int from,
                    int to,
                    java.util.List<T> newTokens)
Replaces a range of the list with a different list instead.

Parameters:
from - the first index to be removed.
to - the first index to be retained, one after the index of the last index to be removed.
newTokens - the tokens to be inserted in place of the removed tokens.

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T extends BasicToken>
Specified by:
iterator in interface java.util.Collection<T extends BasicToken>
Specified by:
iterator in interface java.util.List<T extends BasicToken>
Overrides:
iterator in class TokenList<T extends BasicToken>

listIterator

public java.util.ListIterator<T> listIterator()
Specified by:
listIterator in interface java.util.List<T extends BasicToken>
Overrides:
listIterator in class TokenList<T extends BasicToken>

listIterator

public java.util.ListIterator<T> listIterator(int arg0)
Specified by:
listIterator in interface java.util.List<T extends BasicToken>
Overrides:
listIterator in class TokenList<T extends BasicToken>

subList

public java.util.List<T> subList(int arg0,
                                 int arg1)
Specified by:
subList in interface java.util.List<T extends BasicToken>
Overrides:
subList in class TokenList<T extends BasicToken>

add

public boolean add(T arg0)
Implemented as defined in the List interface.

Specified by:
add in interface java.util.Collection<T extends BasicToken>
Specified by:
add in interface java.util.List<T extends BasicToken>
Overrides:
add in class TokenList<T extends BasicToken>

add

public void add(int arg0,
                T arg1)
Implemented as defined in the List interface.

Specified by:
add in interface java.util.List<T extends BasicToken>
Overrides:
add in class TokenList<T extends BasicToken>

addAll

public boolean addAll(java.util.Collection<? extends T> arg0)
Implemented as defined in the List interface.

Specified by:
addAll in interface java.util.Collection<T extends BasicToken>
Specified by:
addAll in interface java.util.List<T extends BasicToken>
Overrides:
addAll in class TokenList<T extends BasicToken>

addAll

public boolean addAll(int arg0,
                      java.util.Collection<? extends T> arg1)
Implemented as defined in the List interface.

Specified by:
addAll in interface java.util.List<T extends BasicToken>
Overrides:
addAll in class TokenList<T extends BasicToken>

removeAll

public boolean removeAll(java.util.Collection<?> arg0)
Implemented as defined in the List interface.

Specified by:
removeAll in interface java.util.Collection<T extends BasicToken>
Specified by:
removeAll in interface java.util.List<T extends BasicToken>
Overrides:
removeAll in class TokenList<T extends BasicToken>

retainAll

public boolean retainAll(java.util.Collection<?> arg0)
Implemented as defined in the List interface.

Specified by:
retainAll in interface java.util.Collection<T extends BasicToken>
Specified by:
retainAll in interface java.util.List<T extends BasicToken>
Overrides:
retainAll in class TokenList<T extends BasicToken>

clear

public void clear()
Implemented as defined in the List interface.

Specified by:
clear in interface java.util.Collection<T extends BasicToken>
Specified by:
clear in interface java.util.List<T extends BasicToken>
Overrides:
clear in class TokenList<T extends BasicToken>

set

public T set(int arg0,
             T arg1)
Implemented as defined in the List interface.

Specified by:
set in interface java.util.List<T extends BasicToken>
Overrides:
set in class TokenList<T extends BasicToken>

remove

public T remove(int arg0)
Implemented as defined in the List interface.

Specified by:
remove in interface java.util.List<T extends BasicToken>
Overrides:
remove in class TokenList<T extends BasicToken>

remove

public boolean remove(java.lang.Object arg0)
Implemented as defined in the List interface.

Specified by:
remove in interface java.util.Collection<T extends BasicToken>
Specified by:
remove in interface java.util.List<T extends BasicToken>
Overrides:
remove in class TokenList<T extends BasicToken>