org.onemind.commons.java.datastructure
Class LongList

java.lang.Object
  extended by org.onemind.commons.java.datastructure.LongList

public class LongList
extends java.lang.Object

Represents a list of long

Version:
$Id: LongList.java,v 1.2 2004/08/26 12:33:16 thlee Exp $ $Name: $
Author:
TiongHiang Lee (thlee@onemindsoft.org)

Field Summary
private  int _count
          the count of longs in the list *
private  long[] _list
          the list *
private static int GROW
          the growth rate *
private static int INITIAL_CAPACITY
          the initial capacity *
 
Constructor Summary
LongList()
          
LongList(int capacity)
          
 
Method Summary
 void add(long l)
          Add a long to the list
 void add(long l, int i)
          Add a long at index i
private  void ensureCapacity(int size)
          ensure the capacity of the long
 long first()
          Return the first long in the list
 long get(int i)
          Get the long on index i in the list
 long last()
          Return the last long in the list
 long remove(int i)
          Remove the long at index i
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
the initial capacity *

See Also:
Constant Field Values

GROW

private static final int GROW
the growth rate *

See Also:
Constant Field Values

_count

private int _count
the count of longs in the list *


_list

private long[] _list
the list *

Constructor Detail

LongList

public LongList()


LongList

public LongList(int capacity)

Parameters:
capacity - initial capacity
Method Detail

add

public void add(long l)
Add a long to the list

Parameters:
l - the long

get

public long get(int i)
Get the long on index i in the list

Parameters:
i - the index
Returns:
the long

add

public void add(long l,
                int i)
Add a long at index i

Parameters:
l - the long
i - the index

ensureCapacity

private void ensureCapacity(int size)
ensure the capacity of the long

Parameters:
size - the size

remove

public long remove(int i)
Remove the long at index i

Parameters:
i - the index
Returns:
the long at index i

first

public long first()
Return the first long in the list

Returns:
the first long

last

public long last()
Return the last long in the list

Returns:
the last long