Package kawa.lang

Class Pattern

    • Field Detail

      • typePattern

        public static ClassType typePattern
      • matchPatternMethod

        public static final Method matchPatternMethod
    • Constructor Detail

      • Pattern

        public Pattern()
    • Method Detail

      • match

        public Object[] match​(Object obj)
        Match this Pattern against an object.
        Parameters:
        obj - object to match against this pattern
        Returns:
        null on failure, or an array of bound pattern variables.
      • match

        public abstract boolean match​(Object obj,
                                      Object[] vars,
                                      int start_vars)
        Match this Pattern against an Object.
        Parameters:
        obj - the Object to match against
        vars - the "pattern variable" values extracted from obj go here
        start_vars - where in vars to strt putting the varCount() values
        Returns:
        true iff the match succeeded.
      • varCount

        public abstract int varCount()
      • print

        public void print​(Consumer out)
        Specified by:
        print in interface gnu.kawa.format.Printable