1 56 57 package org.objectstyle.cayenne.exp.parser; 58 59 import org.objectstyle.cayenne.exp.Expression; 60 import org.objectstyle.cayenne.util.ConversionUtil; 61 62 67 public class ASTNotLike extends PatternMatchNode { 68 69 ASTNotLike(int id) { 70 super(id, false); 71 } 72 73 public ASTNotLike() { 74 super(ExpressionParserTreeConstants.JJTNOTLIKE, false); 75 } 76 77 public ASTNotLike(ASTPath path, Object value) { 78 super(ExpressionParserTreeConstants.JJTNOTLIKE, false); 79 jjtAddChild(path, 0); 80 jjtAddChild(new ASTScalar(value), 1); 81 } 82 83 protected Object evaluateNode(Object o) throws Exception { 84 int len = jjtGetNumChildren(); 85 if (len != 2) { 86 return Boolean.FALSE; 87 } 88 89 String s1 = ConversionUtil.toString(evaluateChild(0, o)); 90 if (s1 == null) { 91 return Boolean.FALSE; 92 } 93 94 return matchPattern(s1) ? Boolean.FALSE : Boolean.TRUE; 95 } 96 97 100 public Expression shallowCopy() { 101 return new ASTNotLike(id); 102 } 103 104 protected String getExpressionOperator(int index) { 105 return "not like"; 106 } 107 108 public int getType() { 109 return Expression.NOT_LIKE; 110 } 111 } 112 | Popular Tags |