1 21 package com.db4o; 22 23 26 public abstract class QEStringCmp extends QEAbstract { 27 28 public boolean caseSensitive; 29 30 public QEStringCmp(boolean caseSensitive_) { 31 caseSensitive = caseSensitive_; 32 } 33 34 boolean evaluate(QConObject a_constraint, QCandidate a_candidate, Object a_value){ 35 if(a_value != null){ 36 if(a_value instanceof YapReader) { 37 a_value = a_candidate._marshallerFamily._string.readFromOwnSlot(a_constraint.i_trans.stream(), ((YapReader)a_value)); 38 } 39 String candidate=a_value.toString(); 40 String constraint=a_constraint.i_object.toString(); 41 if(!caseSensitive) { 42 candidate=candidate.toLowerCase(); 43 constraint=constraint.toLowerCase(); 44 } 45 return compareStrings(candidate,constraint); 46 } 47 return a_constraint.i_object.equals(null); 48 } 49 50 public boolean supportsIndex(){ 51 return false; 52 } 53 54 protected abstract boolean compareStrings(String candidate,String constraint); 55 } 56 | Popular Tags |