org.cpsolver.studentsct

## Class OnlineSectProof.Sequence

- java.lang.Object
- - org.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

    Constructors
    Constructor and Description
    `Sequence(int length, int base)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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

    - #### Sequence

          public 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
      Returns:
        false if flipped back to zero

    - #### base

          public int base()

      Base of the sequence
      Returns:
        sequence base

    - #### count

          public int count(int i)

      Count number of occurrences of given number in the sequence
      Parameters:
        `i` - given number
      Returns:
        number of occurrences in the sequence

    - #### size

          public int size()

      Size of the sequence
      Returns:
        sequence size

    - #### 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
      Parameters:
        `i` - given position
      Returns:
        number of the given position

    - #### set

          public void set(String seq)

      Set the sequence from a string representation (A..0, B..1, C..2, etc.)
      Parameters:
        `seq` - a sequence

    - #### 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.
      Returns:
        current progress

    - #### 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.
      Returns:
        sequence category