1 56 package org.objectstyle.cayenne.exp.parser; 57 58 import org.objectstyle.cayenne.exp.Expression; 59 import org.objectstyle.cayenne.util.ConversionUtil; 60 61 66 public class ASTLikeIgnoreCase extends PatternMatchNode { 67 ASTLikeIgnoreCase(int id) { 68 super(id, true); 69 } 70 71 public ASTLikeIgnoreCase() { 72 super(ExpressionParserTreeConstants.JJTLIKEIGNORECASE, true); 73 } 74 75 public ASTLikeIgnoreCase(ASTPath path, Object pattern) { 76 super(ExpressionParserTreeConstants.JJTLIKEIGNORECASE, true); 77 jjtAddChild(path, 0); 78 jjtAddChild(wrapChild(pattern), 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 String s1 = ConversionUtil.toString(evaluateChild(0, o)); 88 if (s1 == null) { 89 return Boolean.FALSE; 90 } 91 92 return matchPattern(s1) ? Boolean.TRUE : Boolean.FALSE; 93 } 94 95 98 public Expression shallowCopy() { 99 return new ASTLikeIgnoreCase(id); 100 } 101 102 protected String getExpressionOperator(int index) { 103 return "likeIgnoreCase"; 104 } 105 106 public int getType() { 107 return Expression.LIKE_IGNORE_CASE; 108 } 109 } 110 | Popular Tags |