weka.core
Class DynamicArrayOfPosInt

java.lang.Object
  extended byweka.core.DynamicArrayOfPosInt

public class DynamicArrayOfPosInt
extends java.lang.Object

Implements a dynamic array of positive integers.


Constructor Summary
DynamicArrayOfPosInt()
          Constructor
DynamicArrayOfPosInt(int size)
          Constructor with size larger than 1.
 
Method Summary
 int deleteOneIndex(int value)
          Deletes an entry.
 int get(int position)
           
 int length()
           
 void set(int position, int value)
          Stores the value in the specified position in the array.
 void squeezeIn(int position, int value)
          Sqeezes in the value in the specified position in the array.
 java.lang.String toString()
          Build a string representing this array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicArrayOfPosInt

public DynamicArrayOfPosInt()
Constructor


DynamicArrayOfPosInt

public DynamicArrayOfPosInt(int size)
Constructor with size larger than 1.

Parameters:
size - initial size of the array
Method Detail

length

public int length()

get

public int get(int position)

set

public void set(int position,
                int value)
Stores the value in the specified position in the array. The data array will increase in size to include this position, if necessary.

Parameters:
position - position to write value to
value - value that is written to array

deleteOneIndex

public int deleteOneIndex(int value)
Deletes an entry. The positive integers are here understood as indices. Every indices is in the array only once. So if one is deleted all the others with a value higher have to have substracted a 1.

Parameters:
value - value that is to be deleted

squeezeIn

public void squeezeIn(int position,
                      int value)
Sqeezes in the value in the specified position in the array. The used array size is increased by one and also the data array increases in size.

Parameters:
position - position to write value to
value - value that is written to array

toString

public java.lang.String toString()
Build a string representing this array.