Class Pattern.Either<A>

java.lang.Object
eu.bandm.tools.paisley.Pattern<C>
eu.bandm.tools.paisley.Binary<A,A,A>
eu.bandm.tools.paisley.Pattern.Either<A>
All Implemented Interfaces:
Serializable, Cloneable
Enclosing class:
Pattern<A>

static class Pattern.Either<A> extends Binary<A,A,A>
  • Field Details

    • target_save

      A target_save
    • left_matched

      boolean left_matched
  • Constructor Details

  • Method Details

    • match

      public boolean match(A target)
      Description copied from class: Pattern
      Attempts to match this pattern against a given object. If the class of this pattern imposes a specific order on matches, the first one is chosen.
      Specified by:
      match in class Pattern<A>
      Parameters:
      target - the object to match against
      Returns:
      true if the matching is successful, false if it fails. Which Variables are bound by a successful or failed match depends.
      See Also:
    • matchAgain

      public boolean matchAgain()
      Description copied from class: Pattern
      Attempts to re-match this pattern against a previously matched object. If the class of this pattern imposes a specific order on matches, they are chosen in that order, beginning with the second one. The behaviour of this method is unspecified if the last matching attempt of this pattern has not been successful.

      Patterns classes that do not override this method are deterministic. Pattern classes that overwrite this method to provide additional matches should also override Pattern.isDeterministic().

      Overrides:
      matchAgain in class Pattern<A>
      Returns:
      true if the matching is successful, false if it fails. Which Variables are bound by a successful match depends. The default implementation always returns false.
      See Also:
    • cut

      public void cut(boolean recursively)
      Description copied from class: Pattern
      Disposes of all internal state related to nondeterminism.

      The default implementation does nothing. Subclasses that override this method should also override Pattern.clear(boolean) and ensure that it implies the effect of cut(false).

      Overrides:
      cut in class Binary<A,A,A>
      Parameters:
      recursively - true if all subpatterns should be deactivated, false otherwise.
    • binds

      public boolean binds(Variable<?> v)
      Description copied from class: Pattern
      Checks whether a variable is bound by this pattern.

      The default implementation returns false.

      Overrides:
      binds in class Pattern<A>
      Parameters:
      v - a pattern variable
      Returns:
      true if the variable is guaranteed to have a meaningful value when this pattern is open, false otherwise.
    • preserves

      public boolean preserves(Variable<?> v, boolean success)
      Description copied from class: Pattern
      Checks whether a variable is preserved by this pattern, conditionally on success or failure.

      The default implementation returns false.

      Overrides:
      preserves in class Pattern<A>
      Parameters:
      v - a pattern variable
      success - specifies preservation on success or failure
      Returns:
      true if the variable value is guaranteed to be unaffected by a matching attempt with this pattern that returns a value equal to success.
    • preserves

      public boolean preserves(Variable<?> v)
      Description copied from class: Pattern
      Checks whether a variable is preserved by this pattern, unconditionally.

      The default implementation returns false.

      Overrides:
      preserves in class Pattern<A>
      Parameters:
      v - a pattern variable
      Returns:
      true if the variable value is guaranteed to be unaffected by any matching attempt with this pattern.
    • isDeterministic

      public boolean isDeterministic()
      Description copied from class: Pattern
      Checks whether this pattern is deterministic.

      The default implementation returns true.

      Overrides:
      isDeterministic in class Pattern<A>
      Returns:
      true if this pattern is guaranteed to match any object at most once, false otherwise.
      See Also:
    • compileCut

      protected void compileCut(CompilationContext context, boolean recursively)
      Overrides:
      compileCut in class Binary<A,A,A>
    • toStringOperator

      protected String toStringOperator()
      Overrides:
      toStringOperator in class Binary<A,A,A>
    • compileMatch

      protected void compileMatch(CompilationContext context)
      Overrides:
      compileMatch in class Binary<A,A,A>
    • compileMatchNext

      protected void compileMatchNext(CompilationContext context, boolean again)
    • compileMatchAgain

      protected void compileMatchAgain(CompilationContext context)
      Overrides:
      compileMatchAgain in class Binary<A,A,A>
    • compileMatchNext

      protected void compileMatchNext(CompilationContext context)