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)); }
public virtual bool IsAssignableFrom(IReflectClass subclassCandidate) { if (subclassCandidate == null) { return(false); } if (Equals(subclassCandidate)) { return(true); } if (_delegate != null) { if (subclassCandidate is Db4objects.Db4o.Reflect.Generic.GenericClass) { subclassCandidate = ((Db4objects.Db4o.Reflect.Generic.GenericClass)subclassCandidate ).GetDelegate(); } return(_delegate.IsAssignableFrom(subclassCandidate)); } if (!(subclassCandidate is Db4objects.Db4o.Reflect.Generic.GenericClass)) { return(false); } return(IsAssignableFrom(subclassCandidate.GetSuperclass())); }
internal override bool Evaluate(QCandidate a_candidate) { bool res = true; IReflectClass claxx = a_candidate.ClassReflector(); if (claxx == null) { res = false; } else { res = i_equal ? _claxx.Equals(claxx) : _claxx.IsAssignableFrom(claxx); } return(i_evaluator.Not(res)); }
public Collection4 ForInterface(IReflectClass claxx) { Collection4 col = new Collection4(); ClassMetadataIterator i = Iterator(); while (i.MoveNext()) { ClassMetadata clazz = i.CurrentClass(); IReflectClass candidate = clazz.ClassReflector(); if (!candidate.IsInterface()) { if (claxx.IsAssignableFrom(candidate)) { col.Add(clazz); IEnumerator j = new Collection4(col).GetEnumerator(); while (j.MoveNext()) { ClassMetadata existing = (ClassMetadata)j.Current; if (existing != clazz) { ClassMetadata higher = clazz.GetHigherHierarchy(existing); if (higher != null) { if (higher == clazz) { col.Remove(existing); } else { col.Remove(clazz); } } } } } } } return(col); }
private bool CanHold(IReflectClass type) { if (type == null) { throw new ArgumentNullException(); } ITypeHandler4 typeHandler = GetHandler(); if (typeHandler is IQueryableTypeHandler) { if (((IQueryableTypeHandler)typeHandler).DescendsIntoMembers()) { return(true); } } IReflectClass classReflector = FieldType().ClassReflector(); if (classReflector.IsCollection()) { return(true); } return(classReflector.IsAssignableFrom(type)); }
public int CompareTo(object obj) { if (obj is TransactionContext) { obj = ((TransactionContext)obj)._object; } if (obj == null) { return(_id == 0 ? 0 : 1); } if (obj is int) { int targetInt = ((int)obj); return(_id == targetInt ? 0 : (_id < targetInt ? -1 : 1)); } if (_claxx != null) { if (_claxx.IsAssignableFrom(_claxx.Reflector().ForObject(obj))) { return(0); } } throw new IllegalComparisonException(); }
public Collection4 ForInterface(IReflectClass claxx) { Collection4 col = new Collection4(); ClassMetadataIterator i = Iterator(); while (i.MoveNext()) { ClassMetadata clazz = i.CurrentClass(); IReflectClass candidate = clazz.ClassReflector(); if (!candidate.IsInterface()) { if (claxx.IsAssignableFrom(candidate)) { col.Add(clazz); IEnumerator j = new Collection4(col).GetEnumerator(); while (j.MoveNext()) { ClassMetadata existing = (ClassMetadata)j.Current; if (existing != clazz) { ClassMetadata higher = clazz.GetHigherHierarchy(existing); if (higher != null) { if (higher == clazz) { col.Remove(existing); } else { col.Remove(clazz); } } } } } } } return col; }
public virtual bool CanHandleClass(IReflectClass claxx) { return(_reflectMapClass.IsAssignableFrom(claxx)); }
public bool Match(IReflectClass candidate) { return(collectionClass.IsAssignableFrom(candidate)); }