net.aerith.misao.util
Class ArrayIndex

java.lang.Object
  |
  +--net.aerith.misao.util.ArrayIndex

public class ArrayIndex
extends java.lang.Object

The ArrayIndex


Field Summary
protected  int[] index
          The buffer of index.
protected  int size
          The size of buffer.
 
Constructor Summary
ArrayIndex(int buffer_size)
          Constructs an ArrayIndex with a specified size of buffer.
 
Method Summary
 int get(int i)
          Gets the indicated location of the specified index.
 void swap(int i, int j)
          Swaps two indices.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

index

protected int[] index
The buffer of index.

size

protected int size
The size of buffer.
Constructor Detail

ArrayIndex

public ArrayIndex(int buffer_size)
Constructs an ArrayIndex with a specified size of buffer. The buffer is initialized so that i-th index indicates the i-th location.
Parameters:
buffer_size - the size of buffer to create.
Method Detail

get

public int get(int i)
Gets the indicated location of the specified index.
Parameters:
i - the index.
Returns:
the indicated location.

swap

public void swap(int i,
                 int j)
Swaps two indices.
Parameters:
i - one of the indices to swap.
j - one of the indices to swap.