Package kawa.lang
Class ListPat
java.lang.Object
kawa.lang.Pattern
kawa.lang.ListPat
- All Implemented Interfaces:
gnu.kawa.format.Printable
Match a list whose length in in the range [min_length..max_length].
-
Field Summary
Fields inherited from class kawa.lang.Pattern
matchPatternMethod, typePattern
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ListPat
public ListPat(int len) -
ListPat
public ListPat(int min, int max) -
ListPat
-
-
Method Details
-
match
-
match
Succeeds if obj is a list of length [min..max].- Parameters:
obj
- the object to match against- Returns:
- true iff the match succeeded On success, max_length values from the elements of the list are placed in vars (starting at start_vars); if obj is shorter, missing elements are set to default_value.
-
match
Succeeds if obj is a list of length [min_length..max_length].- Specified by:
match
in classPattern
- Parameters:
obj
- the object to match againstvars
- the "pattern variable" values extracted from obj go herestart_vars
- where in vars to strt putting the varCount() values- Returns:
- null on failure, or an array of bound pattern variables: max_length values from the elements of the list are placed in the result; if obj is shorter, missing elements are set to default_value.
-
varCount
public int varCount() -
print
-