1 21 package com.db4o; 22 23 import com.db4o.foundation.*; 24 import com.db4o.query.*; 25 import com.db4o.reflect.*; 26 27 33 public class QConClass extends QConObject{ 34 35 private transient ReflectClass _claxx; 36 public String _className; 37 public boolean i_equal; 38 39 public QConClass(){ 40 } 42 43 QConClass(Transaction a_trans, QCon a_parent, QField a_field, ReflectClass claxx){ 44 super(a_trans, a_parent, a_field, null); 45 if(claxx != null){ 46 i_yapClass = a_trans.stream().produceYapClass(claxx); 47 if(claxx.equals(a_trans.stream().i_handlers.ICLASS_OBJECT)){ 48 i_yapClass = (YapClass)((YapClassPrimitive)i_yapClass).i_handler; 49 } 50 } 51 _claxx = claxx; 52 } 53 54 public boolean canBeIndexLeaf(){ 55 return false; 56 } 57 58 boolean evaluate(QCandidate a_candidate){ 59 boolean res = true; 60 ReflectClass claxx = a_candidate.classReflector(); 61 if(claxx == null){ 62 res = false; 63 }else{ 64 res = i_equal ? _claxx.equals(claxx) : _claxx.isAssignableFrom(claxx); 65 } 66 return i_evaluator.not(res); 67 } 68 69 void evaluateSelf() { 70 71 if(i_evaluator.isDefault()){ 77 if(i_orderID == 0 && ! hasJoins()){ 78 if(i_yapClass != null && i_candidates.i_yapClass != null){ 79 if(i_yapClass.getHigherHierarchy(i_candidates.i_yapClass) == i_yapClass){ 80 return; 81 } 82 } 83 } 84 } 85 i_candidates.filter(this); 86 } 87 88 public Constraint equal (){ 89 synchronized(streamLock()){ 90 i_equal = true; 91 return this; 92 } 93 } 94 95 boolean isNullConstraint() { 96 return false; 97 } 98 99 String logObject() { 100 if (Debug.queries) { 101 if(_claxx != null){ 102 return _claxx.toString(); 103 } 104 } 105 return ""; 106 } 107 108 void marshall() { 109 super.marshall(); 110 if(_claxx!=null) { 111 _className = _claxx.getName(); 112 } 113 } 114 115 public String toString(){ 116 if(! Debug4.prettyToStrings){ 117 return super.toString(); 118 } 119 String str = "QConClass "; 120 if(_claxx != null){ 121 str += _claxx.toString() + " "; 122 } 123 return str + super.toString(); 124 } 125 126 void unmarshall(Transaction a_trans) { 127 if (i_trans == null) { 128 super.unmarshall(a_trans); 129 if(_className!=null) { 130 _claxx = a_trans.reflector().forName(_className); 131 } 132 } 133 } 134 135 } 136 137 | Popular Tags |