internal override bool Evaluate(IInternalCandidate candidate) { bool result = true; QCandidates qCandidates = candidate.Candidates(); if (qCandidates.IsTopLevel() && qCandidates.WasLoadedFromClassFieldIndex()) { if (_classMetadata.GetAncestor() != null) { BTreeClassIndexStrategy index = (BTreeClassIndexStrategy)_classMetadata.Index(); if (index == null) { return(i_evaluator.Not(true)); } BTree btree = index.Btree(); object searchResult = btree.Search(candidate.Transaction(), candidate.Id()); result = searchResult != null; } } else { IReflectClass claxx = candidate.ClassMetadata().ClassReflector(); if (claxx == null) { result = false; } else { result = i_equal ? _claxx.Equals(claxx) : _claxx.IsAssignableFrom(claxx); } } return(i_evaluator.Not(result)); }
internal override bool Evaluate(IInternalCandidate candidate) { bool result = true; QCandidates qCandidates = candidate.Candidates(); if (qCandidates.IsTopLevel() && qCandidates.WasLoadedFromClassFieldIndex()) { if (_classMetadata.GetAncestor() != null) { BTreeClassIndexStrategy index = (BTreeClassIndexStrategy)_classMetadata.Index(); if (index == null) { return i_evaluator.Not(true); } BTree btree = index.Btree(); object searchResult = btree.Search(candidate.Transaction(), candidate.Id()); result = searchResult != null; } } else { IReflectClass claxx = candidate.ClassMetadata().ClassReflector(); if (claxx == null) { result = false; } else { result = i_equal ? _claxx.Equals(claxx) : _claxx.IsAssignableFrom(claxx); } } return i_evaluator.Not(result); }
internal virtual void EvaluatePending(IInternalCandidate root, QPending pending, int secondResult) { bool res = i_evaluator.Not(i_and ? ((pending._result + secondResult) > 0) : (pending ._result + secondResult) > QPending.False); if (HasJoins()) { IEnumerator i = IterateJoins(); while (i.MoveNext()) { Db4objects.Db4o.Internal.Query.Processor.QConJoin qcj = (Db4objects.Db4o.Internal.Query.Processor.QConJoin )i.Current; root.Evaluate(new QPending(qcj, this, res)); } } else { if (!res) { Constraint1().DoNotInclude(root); Constraint2().DoNotInclude(root); } } }
internal override bool Evaluate(IInternalCandidate candidate) { if (!candidate.FieldIsAvailable()) { VisitOnNull(candidate.GetRoot()); } return true; }
internal override bool Evaluate(IInternalCandidate candidate) { if (!candidate.FieldIsAvailable()) { VisitOnNull(candidate.GetRoot()); } return(true); }
private ITypeHandler4 TypeHandlerFor(IInternalCandidate candidate) { Db4objects.Db4o.Internal.ClassMetadata classMetadata = candidate.ClassMetadata(); if (classMetadata != null) { return(classMetadata.TypeHandler()); } return(null); }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { if (i_objectID == 0) { i_objectID = a_constraint.GetObjectID(); } return(a_candidate.Id() == i_objectID); }
internal virtual IPreparedComparison PrepareComparison(IInternalCandidate candidate ) { if (_preparedComparison != null) { return(_preparedComparison); } return(candidate.PrepareComparison(Container(), i_object)); }
public virtual void Visit(object a_tree) { IInternalCandidate candidate = (IInternalCandidate)a_tree; if (candidate.Include()) { AddKeyCheckDuplicates(candidate.Id()); } }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { if (i_objectID == 0) { i_objectID = a_constraint.GetObjectID(); } return a_candidate.Id() == i_objectID; }
public virtual bool CreateChild(QField field, QCandidates candidates) { if (!_include) { return(false); } UseField(field); if (_fieldMetadata == null || _fieldMetadata is NullFieldMetadata) { return(false); } ITypeHandler4 handler = _fieldMetadata.GetHandler(); if (handler != null) { QueryingReadContext queryingReadContext = new QueryingReadContext(Transaction(), MarshallerFamily().HandlerVersion(), _bytes, _key); ITypeHandler4 arrayElementHandler = Handlers4.ArrayElementHandler(handler, queryingReadContext ); if (arrayElementHandler != null) { return(CreateChildForDescendable(candidates, handler, queryingReadContext, arrayElementHandler )); } // We may get simple types here too, if the YapField was null // in the higher level simple evaluation. Evaluate these // immediately. if (Handlers4.IsQueryLeaf(handler)) { candidates._currentConstraint.Visit(this); return(true); } } _classMetadata.SeekToField(Transaction(), _bytes, _fieldMetadata); IInternalCandidate candidate = ReadSubCandidate(candidates); if (candidate == null) { return(false); } // fast early check for ClassMetadata if (candidates._classMetadata != null && candidates._classMetadata.IsStronglyTyped ()) { if (Handlers4.IsUntyped(handler)) { handler = TypeHandlerFor(candidate); } if (handler == null) { return(false); } } AddDependant(candidates.Add(candidate)); return(true); }
internal override bool Evaluate(IInternalCandidate candidate) { try { return(candidate.Evaluate(this, i_evaluator)); } catch (Exception e) { return(false); } }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { IEnumerator i = i_evaluators.GetEnumerator(); while (i.MoveNext()) { if (((QE)i.Current).Evaluate(a_constraint, a_candidate, a_value)) { return true; } } return false; }
public IInternalCandidate Add(IInternalCandidate candidate) { _result.Add(candidate); if (((QCandidateBase)candidate)._size == 0) { // This means that the candidate was already present // and QCandidate does not allow duplicates. // In this case QCandidate#isDuplicateOf will have // placed the existing QCandidate in the i_root // variable of the new candidate. We return it here: return(candidate.GetRoot()); } return(candidate); }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { IEnumerator i = i_evaluators.GetEnumerator(); while (i.MoveNext()) { if (((QE)i.Current).Evaluate(a_constraint, a_candidate, a_value)) { return(true); } } return(false); }
public IInternalCandidate Add(IInternalCandidate candidate) { _result.Add(candidate); if (((QCandidateBase)candidate)._size == 0) { // This means that the candidate was already present // and QCandidate does not allow duplicates. // In this case QCandidate#isDuplicateOf will have // placed the existing QCandidate in the i_root // variable of the new candidate. We return it here: return candidate.GetRoot(); } return candidate; }
internal override bool Evaluate(QConObject constraint, IInternalCandidate candidate , object obj) { if (obj == null) { return false; } IPreparedComparison preparedComparison = constraint.PrepareComparison(candidate); if (preparedComparison is PreparedArrayContainsComparison) { return ((PreparedArrayContainsComparison)preparedComparison).IsGreaterThan(obj); } return preparedComparison.CompareTo(obj) > 0; }
internal virtual bool Evaluate(QConObject constraint, IInternalCandidate candidate , object obj) { IPreparedComparison prepareComparison = constraint.PrepareComparison(candidate); if (obj == null) { return(prepareComparison is Null); } if (prepareComparison is PreparedArrayContainsComparison) { return(((PreparedArrayContainsComparison)prepareComparison).IsEqual(obj)); } return(prepareComparison.CompareTo(obj) == 0); }
internal override bool Evaluate(QConObject constraint, IInternalCandidate candidate , object obj) { if (obj == null) { return(false); } IPreparedComparison preparedComparison = constraint.PrepareComparison(candidate); if (preparedComparison is PreparedArrayContainsComparison) { return(((PreparedArrayContainsComparison)preparedComparison).IsGreaterThan(obj)); } return(preparedComparison.CompareTo(obj) > 0); }
internal virtual void DoNotInclude(IInternalCandidate root) { if (DTrace.enabled) { DTrace.Donotinclude.Log(Id()); } if (i_parent != null) { i_parent.Visit1(root, this, false); } else { root.DoNotInclude(); } }
public void Visit(object obj) { IInternalCandidate cand = (IInternalCandidate)obj; if (cand.Include()) { _innerRes.value = !_isNot; } // Collect all pending subresults. if (cand.PendingJoins() == null) { return; } cand.PendingJoins().Traverse(new _IVisitor4_529(this)); }
internal void VisitOnNull(IInternalCandidate a_root) { // TODO: It may be more efficient to rule out // all possible keepOnNull issues when starting // evaluation. IEnumerator i = IterateChildren(); while (i.MoveNext()) { ((Db4objects.Db4o.Internal.Query.Processor.QCon)i.Current).VisitOnNull(a_root); } if (VisitSelfOnNull()) { Visit(a_root, IsNullConstraint()); } }
public override void Visit(object obj) { IInternalCandidate qc = (IInternalCandidate)obj; bool res = true; bool processed = false; if (_checkClassMetadataOnly) { ClassMetadata yc = qc.ClassMetadata(); if (yc != null) { res = i_evaluator.Not(_classMetadata.GetHigherHierarchy(yc) == _classMetadata); processed = true; } } if (!processed) { res = Evaluate(qc); } Visit1(qc.GetRoot(), this, res); }
internal override bool Evaluate(QConObject constraint, IInternalCandidate candidate , object obj) { if (obj != null) { if (obj is ByteArrayBuffer) { obj = StringHandler.ReadString(candidate.Transaction().Context(), (ByteArrayBuffer )obj); } string candidateStringValue = obj.ToString(); string stringConstraint = constraint.GetObject().ToString(); if (!caseSensitive) { candidateStringValue = candidateStringValue.ToLower(); stringConstraint = stringConstraint.ToLower(); } return CompareStrings(candidateStringValue, stringConstraint); } return constraint.GetObject() == null; }
internal override bool Evaluate(QConObject constraint, IInternalCandidate candidate , object obj) { if (obj != null) { if (obj is ByteArrayBuffer) { obj = StringHandler.ReadString(candidate.Transaction().Context(), (ByteArrayBuffer )obj); } string candidateStringValue = obj.ToString(); string stringConstraint = constraint.GetObject().ToString(); if (!caseSensitive) { candidateStringValue = candidateStringValue.ToLower(); stringConstraint = stringConstraint.ToLower(); } return(CompareStrings(candidateStringValue, stringConstraint)); } return(constraint.GetObject() == null); }
internal virtual void Visit1(IInternalCandidate root, Db4objects.Db4o.Internal.Query.Processor.QCon reason, bool res) { // The a_reason parameter makes it eays to distinguish // between calls from above (a_reason == this) and below. if (HasJoins()) { // this should probably be on the Join IEnumerator i = IterateJoins(); while (i.MoveNext()) { root.Evaluate(new QPending((QConJoin)i.Current, this, res)); } } else { if (!res) { DoNotInclude(root); } } }
public override void Visit(object obj) { IInternalCandidate candidate = (IInternalCandidate)obj; // force activation outside the try block // so any activation errors bubble up ForceActivation(candidate); try { Platform4.EvaluationEvaluate(i_evaluation, candidate); } catch (Exception) { candidate.Include(false); } // TODO: implement Exception callback for the user coder // at least for test cases if (!candidate.Include()) { DoNotInclude(candidate.GetRoot()); } }
private IInternalCandidate ReadSubCandidate(QCandidates candidateCollection) { Read(); if (_bytes == null || _fieldMetadata == null) { return(null); } int offset = CurrentOffSet(); QueryingReadContext context = NewQueryingReadContext(); ITypeHandler4 handler = HandlerRegistry.CorrectHandlerVersion(context, _fieldMetadata .GetHandler()); IInternalCandidate subCandidate = candidateCollection.ReadSubCandidate(context, handler ); Seek(offset); if (subCandidate != null) { subCandidate.Root(GetRoot()); return(subCandidate); } return(null); }
public virtual void Root(IInternalCandidate root) { _root = root; }
public virtual void Visit(object obj) { IInternalCandidate candidate = (IInternalCandidate)obj; Visit1(candidate.GetRoot(), this, Evaluate(candidate)); }
internal virtual void Visit(IInternalCandidate root, bool res) { Visit1(root, this, i_evaluator.Not(res)); }
internal override bool Evaluate(IInternalCandidate candidate) { try { return candidate.Evaluate(this, i_evaluator); } catch (Exception e) { return false; } }
internal virtual IPreparedComparison PrepareComparison(IInternalCandidate candidate ) { if (_preparedComparison != null) { return _preparedComparison; } return candidate.PrepareComparison(Container(), i_object); }
public virtual void Add(IInternalCandidate candidate) { ToQCandidates(); _candidates = ((QCandidateBase)Tree.Add(_candidates, (QCandidateBase)candidate)); }
internal override bool Evaluate(IInternalCandidate a_candidate) { return _value; }
/// <param name="candidate"></param> internal virtual bool Evaluate(IInternalCandidate candidate) { throw Exceptions4.VirtualException(); }
public override Tree OnAttemptToAddDuplicate(Tree oldNode) { _size = 0; _root = (IInternalCandidate)oldNode; return oldNode; }
private void ForceActivation(IInternalCandidate candidate) { candidate.GetObject(); }
internal override void DoNotInclude(IInternalCandidate root) { Constraint1().DoNotInclude(root); Constraint2().DoNotInclude(root); }
protected virtual void AddDependant(IInternalCandidate a_candidate) { _dependants = new List4(_dependants, a_candidate); }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { return(!i_evaluator.Evaluate(a_constraint, a_candidate, a_value)); }
internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate , object a_value) { return !i_evaluator.Evaluate(a_constraint, a_candidate, a_value); }