Package kawa.lang

Class VarListPat

  • All Implemented Interfaces:
    gnu.kawa.format.Printable

    public class VarListPat
    extends Pattern
    A Pattern that will match a list of a given minimum length.
    • Constructor Summary

      Constructors 
      Constructor Description
      VarListPat​(int min)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean match​(java.lang.Object obj, java.lang.Object[] vars, int start_vars)
      Succeeds of obj is a list with at least min_length elements.
      void print​(Consumer out)  
      int varCount()  
      • Methods inherited from class java.lang.Object

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

      • VarListPat

        public VarListPat​(int min)
    • Method Detail

      • match

        public boolean match​(java.lang.Object obj,
                             java.lang.Object[] vars,
                             int start_vars)
        Succeeds of obj is a list with at least min_length elements.
        Specified by:
        match in class Pattern
        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 if the match succeeded. The elements vars[start_vars .. start_vars + min_length] contain the first min_length elements of obj followed by the min_length'th cdr of obj.
      • varCount

        public int varCount()
        Specified by:
        varCount in class Pattern
      • print

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