com.thomaso.numeric
Class IncreasingSequence

java.lang.Object
  |
  +--com.thomaso.numeric.IncreasingSequence

public class IncreasingSequence
extends java.lang.Object

Utility class for implementing the Squashed Order. Used by the Impossible Bridge Book.


Constructor Summary
IncreasingSequence()
           
 
Method Summary
static int[] decode(java.math.BigInteger index, int length)
          Do a lookup in the squashed order.
static java.util.Vector decodeToVector(java.math.BigInteger index, int length)
          Same as decode, only computs a Vector.
static java.math.BigInteger encode(int[] sequence)
          Starting with an increasing sequence of natural numbers, determine the index of that number in the squashed order.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IncreasingSequence

public IncreasingSequence()
Method Detail

decode

public static int[] decode(java.math.BigInteger index,
                           int length)
Do a lookup in the squashed order.

decodeToVector

public static java.util.Vector decodeToVector(java.math.BigInteger index,
                                              int length)
Same as decode, only computs a Vector.

encode

public static java.math.BigInteger encode(int[] sequence)
Starting with an increasing sequence of natural numbers, determine the index of that number in the squashed order.

main

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