net.sf.cpsolver.studentsct
Class OnlineSectProof.Sequence

java.lang.Object
  extended by net.sf.cpsolver.studentsct.OnlineSectProof.Sequence
Direct Known Subclasses:
OnlineSectProof.StudentSequence
Enclosing class:
OnlineSectProof

public static class OnlineSectProof.Sequence
extends Object

A representation of a long number of given base.


Constructor Summary
OnlineSectProof.Sequence(int length, int base)
          Constructor
 
Method Summary
 int base()
          Base of the sequence
 String cat()
          Category of a sequence, i.e., a string representation of the count of each number in the sequence.
 int count(int i)
          Count number of occurrences of given number in the sequence
 boolean inc()
          Increment vector by 1, returns false it flips from the highest possible number to zero
 double progress()
          If a sequence of all zeros is considered as 0, and the highest possible sequence (sequence of all base-1) is 1, this returns the position of the current sequence between these two bounds.
 int seq(int i)
          Return number on the given position, zero is the number of the least significant value, size()-1 is the highest one
 void set(String seq)
          Set the sequence from a string representation (A..0, B..1, C..2, etc.)
 int size()
          Size of the sequence
 String toString()
          String representation (A..0, B..1, C..2, etc.) going from the least significant value to the highest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OnlineSectProof.Sequence

public OnlineSectProof.Sequence(int length,
                                int base)
Constructor

Parameters:
length - size of the vector
base - base (e.g., 2 for a binary vector)
Method Detail

inc

public boolean inc()
Increment vector by 1, returns false it flips from the highest possible number to zero


base

public int base()
Base of the sequence


count

public int count(int i)
Count number of occurrences of given number in the sequence


size

public int size()
Size of the sequence


seq

public int seq(int i)
Return number on the given position, zero is the number of the least significant value, size()-1 is the highest one


set

public void set(String seq)
Set the sequence from a string representation (A..0, B..1, C..2, etc.)


toString

public String toString()
String representation (A..0, B..1, C..2, etc.) going from the least significant value to the highest

Overrides:
toString in class Object

progress

public double progress()
If a sequence of all zeros is considered as 0, and the highest possible sequence (sequence of all base-1) is 1, this returns the position of the current sequence between these two bounds.


cat

public String cat()
Category of a sequence, i.e., a string representation of the count of each number in the sequence. E.g., A5B3C1 means that there are 5 zeros, 3 ones, and 1 two int the sequence.