Package monq.jfa

Interface CharTrans<T>

All Superinterfaces:
Iterable<RangeEntry<T>>
All Known Implementing Classes:
EmptyCharTrans

public interface CharTrans<T> extends Iterable<RangeEntry<T>>

Interface of a data structure to map non-overlapping character ranges like 'a'-'f' to non-null objects. Since the character ranges are naturally sorted, a CharTrans object acts like an array for the stored object with a size() and access method getAt() to retrieve an object stored at a given index.

CharTrans objects should be immutable. To assemble them, use Intervals.

  • Method Summary

    Modifier and Type
    Method
    Description
    get(char ch)
    returns the object stored in the transition table map for character ch or null if ch is not mapped.
    getAt(int pos)
    returns the object stored at index position pos.
    char
    getFirstAt(int pos)
    returns the left boundary of the range stored at index pos
    char
    getLastAt(int pos)
    returns the right boundary of the range stored at index pos
    default boolean
    Returns true if no character is mapped.
     
    int
    returns the number of character ranges (and objects) stored.
    static <T> String
    toString(CharTrans<T> trans)
     

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • get

      T get(char ch)

      returns the object stored in the transition table map for character ch or null if ch is not mapped.

    • size

      int size()
      returns the number of character ranges (and objects) stored.
    • isEmpty

      default boolean isEmpty()
      Returns true if no character is mapped.
    • getAt

      T getAt(int pos)
      returns the object stored at index position pos.
    • getFirstAt

      char getFirstAt(int pos)
      returns the left boundary of the range stored at index pos
    • getLastAt

      char getLastAt(int pos)
      returns the right boundary of the range stored at index pos
    • toString

      static <T> String toString(CharTrans<T> trans)
    • iterator

      default Iterator<RangeEntry<T>> iterator()
      Specified by:
      iterator in interface Iterable<T>