Class Transitions


  • public final class Transitions
    extends Object
    An object encapsulating a list of transitions. This is sometimes useful when defining finite automatons.
    • Constructor Detail

      • Transitions

        public Transitions()
    • Method Detail

      • parse

        public static Transitions parse​(String transitions)
        Parses the specified string and returns an object Transitions that contains a list of transitions. The string must represent a sequence of transitions as defined in XCSP3. For example, it could be "(q0,0,q2)(q0,1,q3)(q1,0,q3)(q2,1,q3)" when symbols are defined by integers or "(q0,a,q2)(q0,b,q3)(q1,a,q3)(q2,b,q3)" when symbols are defined by strings.
        Parameters:
        transitions - a string representing a sequence of transitions
        Returns:
        an object Transitions containing a list of transitions after parsing the specified argument
      • add

        public Transitions add​(String transitions)
        Adds transitions to this object.
        Parameters:
        transitions - a string representing a sequence of transitions
        Returns:
        this object (for chaining)
      • add

        public Transitions add​(Transition transition)
        Adds a transition to this object.
        Parameters:
        transition - a transition to be added
        Returns:
        this object (for chaining)
      • add

        public Transitions add​(java.util.stream.Stream<Transition> transitions)
        Adds transitions from a stream to this object.
        Parameters:
        transitions - a stream of transitions
        Returns:
        this object (for chaining)
      • add

        public Transitions add​(String firstState,
                               Object symbol,
                               String secondState)
        Adds a transition to this object.
        Parameters:
        firstState - the first state, where the transition begins
        symbol - the symbol labeling the transition
        secondState - the second state, where the transition ends
        Returns:
        this object (for chaining)
      • add

        public Transitions add​(String firstState,
                               int[] symbols,
                               String secondState)
        Adds some transitions to this object, one for each (integer) symbol.
        Parameters:
        firstState - the first state, where the transition begins
        symbols - the different symbols (here, integers) labeling the transition
        secondState - the second state, where the transition ends
        Returns:
        this object (for chaining)
      • add

        public Transitions add​(String firstState,
                               Range range,
                               String secondState)
        Adds some transitions to this object, one for each (integer) symbol contained in the specified range.
        Parameters:
        firstState - the first state, where the transition begins
        range - the different symbols (here, integers contained in the range) labeling the transition
        secondState - the second state, where the transition ends
        Returns:
        this object (for chaining)
      • toArray

        public Transition[] toArray()
        Returns an array with collected objects Transition
        Returns:
        an array with collected objects Transition