1 2 12 package com.versant.core.ejb.query; 13 14 18 public abstract class Node { 19 20 private Node next; 21 22 public Node() { 23 } 24 25 public Node getNext() { 26 return next; 27 } 28 29 public void setNext(Node next) { 30 this.next = next; 31 } 32 33 public void appendList(StringBuffer s) { 34 appendList(s, ", "); 35 } 36 37 public void appendList(StringBuffer s, String separator) { 38 s.append(this); 39 if (next != null) { 40 for (Node i = next; i != null; i = i.next) { 41 s.append(separator); 42 s.append(i); 43 } 44 } 45 } 46 47 public String toString() { 48 String s = getClass().getName(); 49 int i = s.lastIndexOf('.') + 1; 50 int j = s.lastIndexOf("Node"); 51 StringBuffer b = new StringBuffer (); 52 b.append('{'); 53 if (j >= 0) { 54 b.append(s.substring(i, j)); 55 } else { 56 b.append(s.substring(i)); 57 } 58 b.append(' '); 59 b.append(toStringImp()); 60 b.append('}'); 61 return b.toString(); 62 } 63 64 public abstract String toStringImp(); 65 66 69 public void resolve(ResolveContext rc) { 70 } 71 72 75 protected static void resolve(Node list, ResolveContext rc) { 76 for (; list != null; list = list.next) { 77 list.resolve(rc); 78 } 79 } 80 81 84 public abstract Object arrive(NodeVisitor v, Object msg); 85 86 } 87 88 | Popular Tags |