Beispiel #1
0
        internal virtual Db4objects.Db4o.Internal.Query.Processor.QCon AddSharedConstraint
            (QField a_field, object a_object)
        {
            QConObject newConstraint = new QConObject(i_trans, this, a_field, a_object);

            AddConstraint(newConstraint);
            return(newConstraint);
        }
Beispiel #2
0
        internal virtual QCon AddSharedConstraint
            (QField a_field, object a_object)
        {
            var newConstraint = new QConObject(i_trans, this, a_field, a_object);

            AddConstraint(newConstraint);
            return(newConstraint);
        }
Beispiel #3
0
 internal override bool Evaluate(QConObject a_constraint, QCandidate a_candidate,
                                 object a_value)
 {
     if (i_objectID == 0)
     {
         i_objectID = a_constraint.GetObjectID();
     }
     return(a_candidate._key == i_objectID);
 }
Beispiel #4
0
		internal override bool Evaluate(QConObject a_constraint, QCandidate a_candidate, 
			object a_value)
		{
			if (i_objectID == 0)
			{
				i_objectID = a_constraint.GetObjectID();
			}
			return a_candidate._key == i_objectID;
		}
Beispiel #5
0
		public IndexedNodeBase(QConObject qcon)
		{
			if (null == qcon)
			{
				throw new ArgumentNullException();
			}
			if (null == qcon.GetField())
			{
				throw new ArgumentException();
			}
			_constraint = qcon;
		}
Beispiel #6
0
 internal virtual bool Evaluate(QConObject a_constraint, QE a_evaluator)
 {
     if (a_evaluator.Identity())
     {
         return(a_evaluator.Evaluate(a_constraint, this, null));
     }
     if (_member == null)
     {
         _member = Value();
     }
     return(a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_member)));
 }
Beispiel #7
0
		internal override bool Evaluate(QConObject a_constraint, QCandidate 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;
		}
Beispiel #8
0
		internal virtual bool Evaluate(QConObject constraint, QCandidate 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, QCandidate 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;
		}
Beispiel #10
0
        internal override bool Evaluate(QConObject a_constraint, QCandidate a_candidate,
                                        object a_value)
        {
            var i = i_evaluators.GetEnumerator();

            while (i.MoveNext())
            {
                if (((QE)i.Current).Evaluate(a_constraint, a_candidate, a_value))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #11
0
        internal virtual bool Evaluate(QConObject constraint, QCandidate 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);
        }
Beispiel #12
0
        internal override bool Evaluate(QConObject constraint, QCandidate 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);
        }
Beispiel #13
0
        private void AddConstraint(Collection4 col, object obj)
        {
            if (AttachToExistingConstraints(col, obj, true))
            {
                return;
            }
            if (AttachToExistingConstraints(col, obj, false))
            {
                return;
            }
            QConObject newConstraint = new QConObject(_trans, null, null, obj);

            AddConstraint(newConstraint);
            col.Add(newConstraint);
        }
Beispiel #14
0
		internal override QCon ShareParent(object a_object, BooleanByRef removeExisting)
		{
			if (i_parent == null)
			{
				return null;
			}
			object obj = GetField().Coerce(a_object);
			if (obj == No4.Instance)
			{
				QCon falseConstraint = new QConUnconditional(i_trans, false);
				Morph(removeExisting, falseConstraint, ReflectClassForObject(obj));
				return falseConstraint;
			}
			QConObject newConstraint = new QConObject(i_trans, i_parent, GetField(), obj);
			Morph(removeExisting, newConstraint, ReflectClassForObject(obj));
			return newConstraint;
		}
Beispiel #15
0
        internal override QCon ShareParent(object a_object, BooleanByRef removeExisting)
        {
            if (i_parent == null)
            {
                return(null);
            }
            object obj = GetField().Coerce(a_object);

            if (obj == No4.Instance)
            {
                QCon falseConstraint = new QConUnconditional(i_trans, false);
                Morph(removeExisting, falseConstraint, ReflectClassForObject(obj));
                return(falseConstraint);
            }
            QConObject newConstraint = new QConObject(i_trans, i_parent, GetField(), obj);

            Morph(removeExisting, newConstraint, ReflectClassForObject(obj));
            return(newConstraint);
        }
 internal override bool Evaluate(QConObject constraint, QCandidate candidate, object
                                 obj)
 {
     if (obj != null)
     {
         if (obj is ByteArrayBuffer)
         {
             obj = candidate.ReadString((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, QCandidate candidate, object
			 obj)
		{
			if (obj != null)
			{
				if (obj is ByteArrayBuffer)
				{
					obj = candidate.ReadString((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;
		}
Beispiel #18
0
		internal virtual Db4objects.Db4o.Internal.Query.Processor.QCon AddSharedConstraint
			(QField a_field, object a_object)
		{
			QConObject newConstraint = new QConObject(i_trans, this, a_field, a_object);
			AddConstraint(newConstraint);
			return newConstraint;
		}
Beispiel #19
0
 public virtual void CollectConstraints(Transaction trans, QConObject parentConstraint
     , object obj, IVisitor4 visitor)
 {
     TraverseAllAspects(new _TraverseFieldCommand_536(trans, parentConstraint, obj, visitor
         ));
 }
Beispiel #20
0
 internal virtual bool Evaluate(QConObject a_constraint, QE a_evaluator)
 {
     if (a_evaluator.Identity())
     {
         return a_evaluator.Evaluate(a_constraint, this, null);
     }
     if (_member == null)
     {
         _member = Value();
     }
     return a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_member));
 }
 public abstract bool Evaluate(QConObject arg1, QE arg2);
Beispiel #22
0
		public IndexedLeaf(QConObject qcon) : base(qcon)
		{
			_range = Search();
		}
 public override bool Evaluate(QConObject a_constraint, QE a_evaluator)
 {
     return(a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_obj)));
 }
Beispiel #24
0
 internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate
                                 , object a_value)
 {
     return(!i_evaluator.Evaluate(a_constraint, a_candidate, a_value));
 }
Beispiel #25
0
 public _IVisitor4_84(QConObject _enclosing)
 {
     this._enclosing = _enclosing;
 }
Beispiel #26
0
		public IndexedPath(QConObject parent, IIndexedNode next) : base(parent)
		{
			_next = next;
		}
Beispiel #27
0
		private IndexedLeaf FindLeafOnSameField(QConObject conObject)
		{
			IEnumerator i = _nodes.GetEnumerator();
			while (i.MoveNext())
			{
				if (i.Current is IndexedLeaf)
				{
					IndexedLeaf leaf = (IndexedLeaf)i.Current;
					if (conObject.OnSameFieldAs(leaf.Constraint()))
					{
						return leaf;
					}
				}
			}
			return null;
		}
Beispiel #28
0
		private Collection4 CollectTopLevelJoins(QConObject constraintWithJoins)
		{
			Collection4 joins = new Collection4();
			CollectTopLevelJoins(joins, constraintWithJoins);
			return joins;
		}
Beispiel #29
0
 internal virtual QCon AddSharedConstraint
     (QField a_field, object a_object)
 {
     var newConstraint = new QConObject(i_trans, this, a_field, a_object);
     AddConstraint(newConstraint);
     return newConstraint;
 }
Beispiel #30
0
		private void CollectJoinedNode(QConObject constraintWithJoins)
		{
			Collection4 joins = CollectTopLevelJoins(constraintWithJoins);
			if (!CanJoinsBeSearchedByIndex(joins))
			{
				return;
			}
			if (1 == joins.Size())
			{
				_nodes.Add(NodeForConstraint((QCon)joins.SingleElement()));
				return;
			}
			CollectImplicitlyAndingJoins(joins, constraintWithJoins);
		}
Beispiel #31
0
		private void CollectStandaloneNode(QConObject conObject)
		{
			IndexedLeaf existing = FindLeafOnSameField(conObject);
			if (existing != null)
			{
				CollectImplicitAnd(conObject, existing, new IndexedLeaf(conObject));
			}
			else
			{
				_nodes.Add(new IndexedLeaf(conObject));
			}
		}
Beispiel #32
0
		internal override bool Evaluate(QConObject a_constraint, IInternalCandidate a_candidate
			, object a_value)
		{
			return !i_evaluator.Evaluate(a_constraint, a_candidate, a_value);
		}
Beispiel #33
0
 public _TraverseFieldCommand_536(Transaction trans, QConObject parentConstraint,
     object obj, IVisitor4 visitor)
 {
     this.trans = trans;
     this.parentConstraint = parentConstraint;
     this.obj = obj;
     this.visitor = visitor;
 }
Beispiel #34
0
 private void AddConstraint(Collection4 col, object obj)
 {
     if (AttachToExistingConstraints(col, obj, true))
     {
         return;
     }
     if (AttachToExistingConstraints(col, obj, false))
     {
         return;
     }
     var newConstraint = new QConObject(_trans, null, null, obj);
     AddConstraint(newConstraint);
     col.Add(newConstraint);
 }
Beispiel #35
0
		public abstract bool Evaluate(QConObject arg1, QE arg2);
		internal virtual void CollectConstraints(Transaction trans, QConObject a_parent, 
			object a_template, IVisitor4 a_visitor)
		{
			object obj = GetOn(trans, a_template);
			if (obj != null)
			{
				Collection4 objs = Platform4.FlattenCollection(trans.Container(), obj);
				IEnumerator j = objs.GetEnumerator();
				while (j.MoveNext())
				{
					obj = j.Current;
					if (obj != null)
					{
						if (_isPrimitive && !_isArray)
						{
							object nullValue = _reflectField.GetFieldType().NullValue();
							if (obj.Equals(nullValue))
							{
								return;
							}
						}
						if (Platform4.IgnoreAsConstraint(obj))
						{
							return;
						}
						if (!a_parent.HasObjectInParentPath(obj))
						{
							QConObject constraint = new QConObject(trans, a_parent, QField(trans), obj);
							constraint.ByExample();
							a_visitor.Visit(constraint);
						}
					}
				}
			}
		}
Beispiel #37
0
		public override bool Evaluate(QConObject a_constraint, QE a_evaluator)
		{
			return a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_obj));
		}
Beispiel #38
0
			public _IVisitor4_84(QConObject _enclosing)
			{
				this._enclosing = _enclosing;
			}
Beispiel #39
0
		private void CollectImplicitlyAndingJoins(Collection4 joins, QConObject constraintWithJoins
			)
		{
			IEnumerator i = joins.GetEnumerator();
			i.MoveNext();
			IIndexedNodeWithRange last = NodeForConstraint((QCon)i.Current);
			while (i.MoveNext())
			{
				IIndexedNodeWithRange node = NodeForConstraint((QCon)i.Current);
				last = new AndIndexedLeaf(constraintWithJoins, node, last);
				_nodes.Add(last);
			}
		}
Beispiel #40
0
		internal override void CollectConstraints(Transaction a_trans, QConObject a_parent
			, object a_template, IVisitor4 a_visitor)
		{
		}