kawa.lang
Class ListPat
Match a list whose length in in the range [min_length..max_length].
boolean | match(Object obj, Object[] vars, int start_vars) - Succeeds if obj is a list of length [min_length..max_length].
|
static Object[] | match(int min, int max, Object default_val, Object obj) - Succeeds if obj is a list of length [min..max].
|
static boolean | match(int min, int max, Object default_val, Object obj, Object[] vars, int start_vars)
|
int | varCount()
|
ListPat
public ListPat(int len)
ListPat
public ListPat(int min,
int max)
ListPat
public ListPat(int min,
int max,
Object default_val)
match
public boolean match(Object obj,
Object[] vars,
int start_vars)
Succeeds if obj is a list of length [min_length..max_length].
- match in interface Pattern
obj
- the object to match against
- 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.
match
public static Object[] match(int min,
int max,
Object default_val,
Object obj)
Succeeds if obj is a list of length [min..max].
obj
- the object to match against
- 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
public static boolean match(int min,
int max,
Object default_val,
Object obj,
Object[] vars,
int start_vars)