Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
		}
Ejemplo n.º 5
0
		public IndexedNodeBase(QConObject qcon)
		{
			if (null == qcon)
			{
				throw new ArgumentNullException();
			}
			if (null == qcon.GetField())
			{
				throw new ArgumentException();
			}
			_constraint = qcon;
		}
Ejemplo n.º 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)));
 }
Ejemplo n.º 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;
		}
Ejemplo n.º 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;
		}
Ejemplo n.º 9
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;
		}
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
		}
Ejemplo n.º 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);
        }
Ejemplo n.º 16
0
 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);
 }
Ejemplo n.º 17
0
		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;
		}
Ejemplo n.º 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;
		}
Ejemplo n.º 19
0
 public virtual void CollectConstraints(Transaction trans, QConObject parentConstraint
     , object obj, IVisitor4 visitor)
 {
     TraverseAllAspects(new _TraverseFieldCommand_536(trans, parentConstraint, obj, visitor
         ));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 21
0
 public abstract bool Evaluate(QConObject arg1, QE arg2);
Ejemplo n.º 22
0
		public IndexedLeaf(QConObject qcon) : base(qcon)
		{
			_range = Search();
		}
Ejemplo n.º 23
0
 public override bool Evaluate(QConObject a_constraint, QE a_evaluator)
 {
     return(a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_obj)));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 25
0
 public _IVisitor4_84(QConObject _enclosing)
 {
     this._enclosing = _enclosing;
 }
Ejemplo n.º 26
0
		public IndexedPath(QConObject parent, IIndexedNode next) : base(parent)
		{
			_next = next;
		}
Ejemplo n.º 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;
		}
Ejemplo n.º 28
0
		private Collection4 CollectTopLevelJoins(QConObject constraintWithJoins)
		{
			Collection4 joins = new Collection4();
			CollectTopLevelJoins(joins, constraintWithJoins);
			return joins;
		}
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
		}
Ejemplo n.º 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));
			}
		}
Ejemplo n.º 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);
		}
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 35
0
		public abstract bool Evaluate(QConObject arg1, QE arg2);
Ejemplo n.º 36
0
		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);
						}
					}
				}
			}
		}
Ejemplo n.º 37
0
		public override bool Evaluate(QConObject a_constraint, QE a_evaluator)
		{
			return a_evaluator.Evaluate(a_constraint, this, a_constraint.Translate(_obj));
		}
Ejemplo n.º 38
0
			public _IVisitor4_84(QConObject _enclosing)
			{
				this._enclosing = _enclosing;
			}
Ejemplo n.º 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);
			}
		}
Ejemplo n.º 40
0
		internal override void CollectConstraints(Transaction a_trans, QConObject a_parent
			, object a_template, IVisitor4 a_visitor)
		{
		}