1 2 12 package com.versant.core.jdo.query; 13 14 17 public class AndNode extends Node { 18 19 public AndNode() { 20 } 21 22 23 24 public Object accept(NodeVisitor visitor, Object [] results) { 25 return visitor.visitAndNode(this, results); 26 } 27 28 31 protected AndNode createInstance() { 32 return new AndNode(); 33 } 34 35 38 protected void normalizeImp() { 39 if (getClass() != AndNode.class) { 40 super.normalizeImp(); 41 return; 42 } 43 Node prev = null; 45 for (Node n = childList; n != null;) { 46 n.normalizeImp(); 47 if (n.getClass() == AndNode.class) { 48 if (n.childList == null) { 49 n = n.next; 51 if (prev == null) { 52 childList = n; 53 } else { 54 prev.next = n; 55 } 56 } else { 57 Node pos; 60 for (pos = n.childList; pos.next != null; pos = pos.next) { 61 pos.parent = this; 62 } 63 pos.parent = this; 64 pos.next = n.next; 65 if (prev == null) { 66 childList = n.childList; 67 } else { 68 prev.next = n.childList; 69 } 70 prev = pos; 71 n = n.next; 72 } 73 } else { 74 prev = n; 75 n = n.next; 76 } 77 } 78 } 79 80 public Field visit(MemVisitor visitor, Object obj) { 81 return visitor.visitAndNode(this, obj); 82 } 83 84 public Object arrive(NodeVisitor v, Object msg) { 85 return v.arriveAndNode(this, msg); 86 } 87 88 } 89 | Popular Tags |