Class ShiftTransition

  • All Implemented Interfaces:
    Transition, Serializable

    public class ShiftTransition
    extends Object
    implements Transition
    Transition that moves a single item from the front of the queue to the top of the stack without making any other changes.
    See Also:
    Serialized Form
    • Constructor Detail

      • ShiftTransition

        public ShiftTransition()
    • Method Detail

      • isLegal

        public boolean isLegal​(State state,
                               List<ParserConstraint> constraints)
        Shifting is legal as long as the state is not finished and there are more items on the queue to be shifted. TODO: go through the papers and make sure they don't mention any other conditions where one shouldn't shift
        Specified by:
        isLegal in interface Transition
      • apply

        public State apply​(State state)
        Add the new preterminal to the stack, increment the queue position.
        Specified by:
        apply in interface Transition
      • apply

        public State apply​(State state,
                           double scoreDelta)
        Add the new preterminal to the stack, increment the queue position.
        Specified by:
        apply in interface Transition
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object