edu.stanford.nlp.util
Class DoubleList

java.lang.Object
  extended by edu.stanford.nlp.util.DoubleList

public class DoubleList
extends java.lang.Object

Like a List but contains doubles. Backed by an array so arbitrary-position insertion is expensive, but insertion at the end of the list is fast, and access is fast.


Constructor Summary
DoubleList()
           
DoubleList(int initialSize)
           
 
Method Summary
 void add(double d)
          inserts d at the end of the list.
 void add(int index, double d)
          Inserts d into the list after the first index elements.
 void clear()
           
 double get(int index)
          gets the value of the index-th element of the list.
 boolean isEmpty()
          returns true iff the list contains no elements.
static void main(java.lang.String[] args)
           
 double set(int index, double d)
          sets the index-th element of the list to d, and returns the old value of the index-th element.
 int size()
           
 double[] toArray()
          as implemented, returns the actual array! Danger!
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleList

public DoubleList()

DoubleList

public DoubleList(int initialSize)
Method Detail

clear

public void clear()

add

public void add(double d)
inserts d at the end of the list.


add

public void add(int index,
                double d)
         throws java.lang.IndexOutOfBoundsException
Inserts d into the list after the first index elements.

Throws:
java.lang.IndexOutOfBoundsException

size

public int size()

get

public double get(int index)
           throws java.lang.IndexOutOfBoundsException
gets the value of the index-th element of the list.

Throws:
java.lang.IndexOutOfBoundsException

toArray

public double[] toArray()
as implemented, returns the actual array! Danger!


isEmpty

public boolean isEmpty()
returns true iff the list contains no elements.


set

public double set(int index,
                  double d)
           throws java.lang.IndexOutOfBoundsException
sets the index-th element of the list to d, and returns the old value of the index-th element.

Throws:
java.lang.IndexOutOfBoundsException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)