Class GenericPatternMatch

  • All Implemented Interfaces:
    java.lang.Cloneable, IPatternMatch

    public abstract class GenericPatternMatch
    extends BasePatternMatch
    Generic signature object implementation. See also the generated matcher and signature of the pattern, with pattern-specific API simplifications.
    Since:
    0.9
    • Method Detail

      • get

        public java.lang.Object get​(java.lang.String parameterName)
        Description copied from interface: IPatternMatch
        Returns the value of the parameter with the given name, or null if name is invalid.
      • 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
        Overrides:
        get in class BasePatternMatch
      • set

        public boolean set​(java.lang.String parameterName,
                           java.lang.Object newValue)
        Description copied from interface: IPatternMatch
        Sets the parameter with the given name to the given value.

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

      • toArray

        public java.lang.Object[] toArray()
        Description copied from interface: IPatternMatch
        Converts the match to an array representation, with each pattern parameter at their respective position. In case of a partial match, unsubstituted parameters will be represented as null elements in the array.
        Returns:
        a newly constructed array containing each parameter substitution of the match in order.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • prettyPrint

        public java.lang.String prettyPrint()
        Description copied from interface: IPatternMatch
        Prints the list of parameter-value pairs.
      • newMutableMatch

        public static GenericPatternMatch newMutableMatch​(GenericQuerySpecification<? extends GenericPatternMatcher> specification,
                                                          java.lang.Object... parameters)
        Returns a mutable (partial) match. Fields of the mutable match can be filled to create a partial match, usable as matcher input.
        Parameters:
        parameters - the fixed value of pattern parameters, or null if not bound.
        Returns:
        the new, mutable (partial) match object.
      • toImmutable

        public IPatternMatch toImmutable()
        Description copied from interface: IPatternMatch
        Takes an immutable snapshot of this match.
        Returns:
        the match itself in case of immutable matches, an immutable copy in case of mutable ones.