Class BasePatternMatch

java.lang.Object
tools.refinery.interpreter.api.impl.BasePatternMatch
All Implemented Interfaces:
Cloneable, IPatternMatch
Direct Known Subclasses:
GenericPatternMatch

public abstract class BasePatternMatch extends Object implements IPatternMatch
Base implementation of IPatternMatch.
  • Constructor Details

    • BasePatternMatch

      public BasePatternMatch()
  • Method Details

    • makeImmutableList

      @SafeVarargs protected static <T> List<T> makeImmutableList(T... elements)
    • prettyPrintValue

      public static String prettyPrintValue(Object o)
    • get

      public Object get(int position)
      Description copied from interface: IPatternMatch
      Returns the value of the parameter at the given position, or null if position is invalid.
      Specified by:
      get in interface IPatternMatch
    • set

      public boolean set(int position, Object newValue)
      Description copied from interface: IPatternMatch
      Sets the parameter at the given position to the given value.

      Works only if match is mutable. See IPatternMatch.isMutable().

      Specified by:
      set in interface IPatternMatch
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isCompatibleWith

      public boolean isCompatibleWith(IPatternMatch other)
      Description copied from interface: IPatternMatch
      Checks that this match is compatible with the given other match. This is used for filtering the match set of a matcher.

      Two non-null matches are compatible if and only if:

      • They share the same pattern.
      • For each parameter, where they are set (non-null) in both matches, their values are equal.

      Furthermore, all matches are considered compatible with null matches (e.g. empty filter).

      Specified by:
      isCompatibleWith in interface IPatternMatch
      Parameters:
      other -
      Returns:
      true, if this is compatible with other, or other is null
    • patternName

      public String patternName()
      Description copied from interface: IPatternMatch
      Identifies the name of the pattern for which this is a match.
      Specified by:
      patternName in interface IPatternMatch
    • parameterNames

      public List<String> parameterNames()
      Description copied from interface: IPatternMatch
      Returns the list of symbolic parameter names.
      Specified by:
      parameterNames in interface IPatternMatch