01: package kawa.lang;
02:
03: import gnu.mapping.*;
04: import java.io.*;
05: import gnu.text.Printable;
06: import gnu.lists.Consumer;
07:
08: /**
09: * A pattern that matches anything.
10: */
11:
12: public class AnyPat extends Pattern implements Printable,
13: Externalizable {
14: public AnyPat() {
15: }
16:
17: public static AnyPat make() {
18: return new AnyPat();
19: }
20:
21: public void print(Consumer out) {
22: out.write("#<match any>");
23: }
24:
25: public boolean match(Object obj, Object[] vars, int start_vars) {
26: vars[start_vars] = obj;
27: return true;
28: }
29:
30: public int varCount() {
31: return 1;
32: }
33:
34: /**
35: * @serialData Write nothing.
36: */
37: public void writeExternal(ObjectOutput out) throws IOException {
38: }
39:
40: public void readExternal(ObjectInput in) throws IOException,
41: ClassNotFoundException {
42: }
43: }
|