kawa.lang
public class ListPat extends Pattern
Constructor Summary | |
---|---|
ListPat(int len) | |
ListPat(int min, int max) | |
ListPat(int min, int max, Object default_val) |
Method Summary | |
---|---|
static boolean | match(int min, int max, Object default_val, Object obj, Object[] vars, int start_vars) |
static Object[] | match(int min, int max, Object default_val, Object obj)
Succeeds if obj is a list of length [min..max]. |
boolean | match(Object obj, Object[] vars, int start_vars)
Succeeds if obj is a list of length [min_length..max_length]. |
void | print(Consumer out) |
int | varCount() |
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.
Parameters: obj the object to match against
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.