1 56 57 package org.objectstyle.cayenne.exp.parser; 58 59 import org.objectstyle.cayenne.exp.Expression; 60 61 66 public class ASTNotIn extends ConditionNode { 67 ASTNotIn(int id) { 68 super(id); 69 } 70 71 public ASTNotIn() { 72 super(ExpressionParserTreeConstants.JJTNOTIN); 73 } 74 75 public ASTNotIn(ASTPath path, ASTList list) { 76 super(ExpressionParserTreeConstants.JJTNOTIN); 77 jjtAddChild(path, 0); 78 jjtAddChild(list, 1); 79 } 80 81 protected Object evaluateNode(Object o) throws Exception { 82 int len = jjtGetNumChildren(); 83 if (len != 2) { 84 return Boolean.FALSE; 85 } 86 87 Object o1 = evaluateChild(0, o); 88 if (o1 == null) { 89 return Boolean.FALSE; 90 } 91 92 Object [] objects = (Object []) evaluateChild(1, o); 93 if (objects == null) { 94 return Boolean.FALSE; 95 } 96 97 int size = objects.length; 98 for (int i = 0; i < size; i++) { 99 if (o1.equals(objects[i])) { 100 return Boolean.FALSE; 101 } 102 } 103 104 return Boolean.TRUE; 105 } 106 107 110 public Expression shallowCopy() { 111 return new ASTNotIn(id); 112 } 113 114 protected String getExpressionOperator(int index) { 115 return "not in"; 116 } 117 118 public int getType() { 119 return Expression.NOT_IN; 120 } 121 } 122 | Popular Tags |