ptolemy.caltrop.util
Class IntegerList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<IntToken>
          extended by ptolemy.caltrop.util.IntegerList
All Implemented Interfaces:
java.lang.Iterable<IntToken>, java.util.Collection<IntToken>, java.util.List<IntToken>

public class IntegerList
extends java.util.AbstractList<IntToken>

A sparse list of integers.

Since:
Ptolemy II 4.0
Version:
$Id: IntegerList.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Jörn W. Janneck
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
private  int _a
           
private  int _b
           
private  caltrop.interpreter.Context _context
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IntegerList(caltrop.interpreter.Context context, int a, int b)
          Construct a list of Integers IntegerList object.
 
Method Summary
 IntToken get(int n)
          Return an integer from the Caltrop interpreter context.
 int size()
          The size of the list.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

_context

private caltrop.interpreter.Context _context

_a

private int _a

_b

private int _b
Constructor Detail

IntegerList

public IntegerList(caltrop.interpreter.Context context,
                   int a,
                   int b)
Construct a list of Integers IntegerList object.

Parameters:
context - a Caltrop interpreter context.
a - The lower limit of the range of integers.
b - The upper limit of the range of integers.
Method Detail

get

public IntToken get(int n)
Return an integer from the Caltrop interpreter context.

Specified by:
get in interface java.util.List<IntToken>
Specified by:
get in class java.util.AbstractList<IntToken>
Parameters:
n - The integer that is added to the a value and returned n+a must be less than or equal to b.
Returns:
the integer at slot a+n.

size

public int size()
The size of the list.

Specified by:
size in interface java.util.Collection<IntToken>
Specified by:
size in interface java.util.List<IntToken>
Specified by:
size in class java.util.AbstractCollection<IntToken>
Returns:
The size of the list. (b-a)+1