You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



All Packages  This Package  Class Hierarchy  Class Search  Index

Class grendel.storage.PackedIntArray

java.lang.Object
   |
   +----grendel.storage.PackedIntArray

This class implements a fixed-size array capable of holding `long' values in the range [0, 1<<60). It packs the data efficiently, so that if the array actually only holds values less than 1<<15, it will take up no more space than a short[] array. (The overhead is 1 bit per 16.)


class  PackedIntArray
     extends java.lang.Object
{
          // Fields 1
     private short[] data;

          // Constructors 2
     PackedIntArray();
     PackedIntArray(int);

          // Methods 7
     private void check(long, long, long, long, long);
     long elementAt(int);
     public static final void main(String[]);
     public static void selfTest();
     void setCapacity(int);
     void setElementAt(int, long);
     public String toString();
}



Fields


data

   private short[] data



Constructors


PackedIntArray

   PackedIntArray() 

Make a new, empty PackedIntArray. Use setCapacity() to initialize it.



PackedIntArray

   PackedIntArray(int size) 

Make a new PackedIntArray capable of holding at most size elements.




Methods


setCapacity

   void setCapacity(int size) 

Set the number of elements this object is capable of holding. If the size is reduced, some elements will be discarded. If the size is increased, the new elements will default to 0.



elementAt

   long elementAt(int index) 

Returns the nth element as a long.



setElementAt

   void setElementAt(int index, 
                     long value) 

Stores the given value into the nth slot. The value must be in the range [0, 1<<60), or ArrayIndexOutOfBoundsException is thrown.



toString

   public String toString() 
Overrides:
toString in class Object


check

   private void check(long i0, 
                      long i1, 
                      long i2, 
                      long i3, 
                      long i4) 


selfTest

   public static void selfTest() 


main

   public static final void main(String[] arg) 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4