AnyPat.java 777 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package kawa.lang;
  2. import gnu.mapping.*;
  3. import java.io.*;
  4. import gnu.kawa.format.Printable;
  5. import gnu.lists.Consumer;
  6. /**
  7. * A pattern that matches anything.
  8. */
  9. public class AnyPat extends Pattern implements Printable, Externalizable
  10. {
  11. public AnyPat () { }
  12. public static AnyPat make () { return new AnyPat (); }
  13. public void print (Consumer out)
  14. {
  15. out.write("#<match any>");
  16. }
  17. public boolean match (Object obj, Object[] vars, int start_vars)
  18. {
  19. vars[start_vars] = obj;
  20. return true;
  21. }
  22. public int varCount () { return 1; }
  23. /**
  24. * @serialData Write nothing.
  25. */
  26. public void writeExternal(ObjectOutput out) throws IOException
  27. {
  28. }
  29. public void readExternal(ObjectInput in)
  30. throws IOException, ClassNotFoundException
  31. {
  32. }
  33. }