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

java.lang.Object
  extended by com.cburch.editor.tokens.TokenList<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>
Direct Known Subclasses:
MutableTokenList

public class TokenList<T extends BasicToken>
extends java.lang.Object
implements java.util.List<T>

Maintains the list of tokens. All modifying List methods are prohibited to ensure that only a tokenizer will have access to modify the list. These tokens will be stored in the order they appear in the underlying document.

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

Method Summary
 void add(int arg0, T arg1)
          Unsupported operation.
 boolean add(T arg0)
          Unsupported operation.
 boolean addAll(java.util.Collection<? extends T> arg0)
          Unsupported operation.
 boolean addAll(int arg0, java.util.Collection<? extends T> arg1)
          Unsupported operation.
 void clear()
          Unsupported operation.
 boolean contains(java.lang.Object arg0)
           
 boolean containsAll(java.util.Collection<?> arg0)
           
 T get(int arg0)
           
 int getIndexContaining(int offset)
          Returns the index of the token that includes the given offset, or -1 if no token includes that offset.
 int getIndexContaining(javax.swing.text.Position pos)
          Returns the index of the token that includes the given position, or -1 if no token includes that position.
 int getIndexEndingBefore(int offset)
          Returns the index of the first token that ends at or before the given offset.
 int getIndexEndingBefore(javax.swing.text.Position pos)
          Returns the index of the first token that ends at or before the given position.
 int getIndexStartingAfter(int offset)
          Returns the index of the first token that begins at or after the given offset.
 int getIndexStartingAfter(javax.swing.text.Position pos)
          Returns the index of the first token that begins at or after the given position.
 int indexOf(java.lang.Object arg0)
           
 boolean isEmpty()
           
 java.util.Iterator<T> iterator()
           
 int lastIndexOf(java.lang.Object arg0)
           
 java.util.ListIterator<T> listIterator()
           
 java.util.ListIterator<T> listIterator(int arg0)
           
 T remove(int arg0)
          Unsupported operation.
 boolean remove(java.lang.Object arg0)
          Unsupported operation.
 boolean removeAll(java.util.Collection<?> arg0)
          Unsupported operation.
 boolean retainAll(java.util.Collection<?> arg0)
          Unsupported operation.
 T set(int arg0, T arg1)
          Unsupported operation.
 int size()
           
 java.util.List<T> subList(int arg0, int arg1)
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] arg0)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Method Detail

size

public int size()
Specified by:
size in interface java.util.Collection<T extends BasicToken>
Specified by:
size in interface java.util.List<T extends BasicToken>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<T extends BasicToken>
Specified by:
isEmpty in interface java.util.List<T extends BasicToken>

contains

public boolean contains(java.lang.Object arg0)
Specified by:
contains in interface java.util.Collection<T extends BasicToken>
Specified by:
contains in interface java.util.List<T extends BasicToken>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<T extends BasicToken>
Specified by:
toArray in interface java.util.List<T extends BasicToken>

toArray

public <T> T[] toArray(T[] arg0)
Specified by:
toArray in interface java.util.Collection<T extends BasicToken>
Specified by:
toArray in interface java.util.List<T extends BasicToken>

containsAll

public boolean containsAll(java.util.Collection<?> arg0)
Specified by:
containsAll in interface java.util.Collection<T extends BasicToken>
Specified by:
containsAll in interface java.util.List<T extends BasicToken>

get

public T get(int arg0)
Specified by:
get in interface java.util.List<T extends BasicToken>

indexOf

public int indexOf(java.lang.Object arg0)
Specified by:
indexOf in interface java.util.List<T extends BasicToken>

lastIndexOf

public int lastIndexOf(java.lang.Object arg0)
Specified by:
lastIndexOf in interface java.util.List<T extends BasicToken>

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>

listIterator

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

listIterator

public java.util.ListIterator<T> listIterator(int arg0)
Specified by:
listIterator in interface java.util.List<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>

add

public boolean add(T arg0)
Unsupported operation.

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

add

public void add(int arg0,
                T arg1)
Unsupported operation.

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

addAll

public boolean addAll(java.util.Collection<? extends T> arg0)
Unsupported operation.

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

addAll

public boolean addAll(int arg0,
                      java.util.Collection<? extends T> arg1)
Unsupported operation.

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

removeAll

public boolean removeAll(java.util.Collection<?> arg0)
Unsupported operation.

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

retainAll

public boolean retainAll(java.util.Collection<?> arg0)
Unsupported operation.

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

clear

public void clear()
Unsupported operation.

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

set

public T set(int arg0,
             T arg1)
Unsupported operation.

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

remove

public T remove(int arg0)
Unsupported operation.

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

remove

public boolean remove(java.lang.Object arg0)
Unsupported operation.

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

getIndexContaining

public int getIndexContaining(int offset)
Returns the index of the token that includes the given offset, or -1 if no token includes that offset.

Parameters:
offset - the query offset.
Returns:
the index of the token including the offset, or -1 if there is no such token.

getIndexContaining

public int getIndexContaining(javax.swing.text.Position pos)
Returns the index of the token that includes the given position, or -1 if no token includes that position.

Parameters:
pos - the query position.
Returns:
the index of the token including the position, or -1 if there is no such token.

getIndexStartingAfter

public int getIndexStartingAfter(int offset)
Returns the index of the first token that begins at or after the given offset. Note: This method is not thoroughly tested.

Parameters:
offset - the minimum offset.
Returns:
the index of the first token beginning at or after the offset.

getIndexStartingAfter

public int getIndexStartingAfter(javax.swing.text.Position pos)
Returns the index of the first token that begins at or after the given position. Note: This method is not thoroughly tested.

Parameters:
pos - the minimum position.
Returns:
the index of the first token beginning at or after the position.

getIndexEndingBefore

public int getIndexEndingBefore(int offset)
Returns the index of the first token that ends at or before the given offset. Note: This method is not thoroughly tested.

Parameters:
offset - the maximum offset.
Returns:
the index of the first token ending at or before the offset.

getIndexEndingBefore

public int getIndexEndingBefore(javax.swing.text.Position pos)
Returns the index of the first token that ends at or before the given position. Note: This method is not thoroughly tested.

Parameters:
pos - the maximum position.
Returns:
the index of the first token ending at or before the position.