Class BasePatternMatch

  • All Implemented Interfaces:
    java.lang.Cloneable, IPatternMatch
    Direct Known Subclasses:
    GenericPatternMatch

    public abstract class BasePatternMatch
    extends java.lang.Object
    implements IPatternMatch
    Base implementation of IPatternMatch.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(int position)
      Returns the value of the parameter at the given position, or null if position is invalid.
      boolean isCompatibleWith​(IPatternMatch other)
      Checks that this match is compatible with the given other match.
      protected static <T> java.util.List<T> makeImmutableList​(T... elements)  
      java.util.List<java.lang.String> parameterNames()
      Returns the list of symbolic parameter names.
      java.lang.String patternName()
      Identifies the name of the pattern for which this is a match.
      static java.lang.String prettyPrintFeature​(java.lang.Object o, java.lang.String featureName)  
      static java.lang.String prettyPrintValue​(java.lang.Object o)  
      boolean set​(int position, java.lang.Object newValue)
      Sets the parameter at the given position to the given value.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BasePatternMatch

        public BasePatternMatch()
    • Method Detail

      • makeImmutableList

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

        public static java.lang.String prettyPrintValue​(java.lang.Object o)
      • prettyPrintFeature

        public static java.lang.String prettyPrintFeature​(java.lang.Object o,
                                                          java.lang.String featureName)
      • get

        public java.lang.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,
                           java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.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
        Returns:
        true, if this is compatible with other, or other is null
      • patternName

        public java.lang.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 java.util.List<java.lang.String> parameterNames()
        Description copied from interface: IPatternMatch
        Returns the list of symbolic parameter names.
        Specified by:
        parameterNames in interface IPatternMatch