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 ASTNotLikeIgnoreCase extends PatternMatchNode { 68 ASTNotLikeIgnoreCase(int id) { 69 super(id, true); 70 } 71 72 public ASTNotLikeIgnoreCase() { 73 super(ExpressionParserTreeConstants.JJTNOTLIKEIGNORECASE, true); 74 } 75 76 public ASTNotLikeIgnoreCase(ASTPath path, Object value) { 77 super(ExpressionParserTreeConstants.JJTNOTLIKEIGNORECASE, true); 78 jjtAddChild(path, 0); 79 jjtAddChild(new ASTScalar(value), 1); 80 } 81 82 protected Object evaluateNode(Object o) throws Exception { 83 int len = jjtGetNumChildren(); 84 if (len != 2) { 85 return Boolean.FALSE; 86 } 87 88 String s1 = ConversionUtil.toString(evaluateChild(0, o)); 89 if (s1 == null) { 90 return Boolean.FALSE; 91 } 92 93 return matchPattern(s1) ? Boolean.FALSE : Boolean.TRUE; 94 } 95 96 99 public Expression shallowCopy() { 100 return new ASTNotLikeIgnoreCase(id); 101 } 102 103 protected String getExpressionOperator(int index) { 104 return "not likeIgnoreCase"; 105 } 106 107 public int getType() { 108 return Expression.NOT_LIKE_IGNORE_CASE; 109 } 110 } 111 | Popular Tags |