Exemple #1
0
        public bool FitsIntoExistingConstraintHierarchy(QCon constraint)
        {
            if (_field != null)
            {
                QField qf = constraint.GetField();
                if (qf != null)
                {
                    if (_field.Name() != null && !_field.Name().Equals(qf.Name()))
                    {
                        return(false);
                    }
                }
            }
            if (i_classMetadata == null || constraint.IsNullConstraint())
            {
                return(true);
            }
            ClassMetadata classMetadata = constraint.GetYapClass();

            if (classMetadata == null)
            {
                return(false);
            }
            classMetadata = i_classMetadata.GetHigherOrCommonHierarchy(classMetadata);
            if (classMetadata == null)
            {
                return(false);
            }
            i_classMetadata = classMetadata;
            return(true);
        }
Exemple #2
0
        // FIXME: This method should go completely.
        //        We changed the code to create the QCandidates graph in two steps:
        //        (1) call fitsIntoExistingConstraintHierarchy to determine whether
        //            or not we need more QCandidates objects
        //        (2) add all constraints
        //        This method tries to do both in one, which results in missing
        //        constraints. Not all are added to all QCandiates.
        //        Right methodology is in
        //        QQueryBase#createCandidateCollection
        //        and
        //        QQueryBase#createQCandidatesList
        internal bool TryAddConstraint(QCon a_constraint)
        {
            if (_field != null)
            {
                QField qf = a_constraint.GetField();
                if (qf != null)
                {
                    if (_field.Name() != null && !_field.Name().Equals(qf.Name()))
                    {
                        return(false);
                    }
                }
            }
            if (i_classMetadata == null || a_constraint.IsNullConstraint())
            {
                AddConstraint(a_constraint);
                return(true);
            }
            ClassMetadata yc = a_constraint.GetYapClass();

            if (yc != null)
            {
                yc = i_classMetadata.GetHigherOrCommonHierarchy(yc);
                if (yc != null)
                {
                    i_classMetadata = yc;
                    AddConstraint(a_constraint);
                    return(true);
                }
            }
            AddConstraint(a_constraint);
            return(false);
        }
Exemple #3
0
        public virtual QQueryBase.CreateCandidateCollectionResult CreateCandidateCollection
            ()
        {
            List4       candidatesList  = CreateQCandidatesList();
            bool        checkDuplicates = false;
            bool        topLevel        = true;
            IEnumerator i = IterateConstraints();

            while (i.MoveNext())
            {
                QCon constraint = (QCon)i.Current;
                QCon old        = constraint;
                constraint = constraint.GetRoot();
                if (constraint != old)
                {
                    checkDuplicates = true;
                    topLevel        = false;
                }
                ClassMetadata classMetadata = constraint.GetYapClass();
                if (classMetadata == null)
                {
                    break;
                }
                AddConstraintToCandidatesList(candidatesList, constraint);
            }
            return(new QQueryBase.CreateCandidateCollectionResult(candidatesList, checkDuplicates
                                                                  , topLevel));
        }
Exemple #4
0
        private List4 CreateQCandidatesList()
        {
            List4       candidatesList = null;
            IEnumerator i = IterateConstraints();

            while (i.MoveNext())
            {
                QCon constraint = (QCon)i.Current;
                constraint = constraint.GetRoot();
                ClassMetadata classMetadata = constraint.GetYapClass();
                if (classMetadata == null)
                {
                    continue;
                }
                if (ConstraintCanBeAddedToExisting(candidatesList, constraint))
                {
                    continue;
                }
                QCandidates candidates = new QCandidates((LocalTransaction)_trans, classMetadata,
                                                         null);
                candidatesList = new List4(candidatesList, candidates);
            }
            return(candidatesList);
        }
Exemple #5
0
		public bool FitsIntoExistingConstraintHierarchy(QCon constraint)
		{
			if (_field != null)
			{
				QField qf = constraint.GetField();
				if (qf != null)
				{
					if (_field.Name() != null && !_field.Name().Equals(qf.Name()))
					{
						return false;
					}
				}
			}
			if (i_classMetadata == null || constraint.IsNullConstraint())
			{
				return true;
			}
			ClassMetadata classMetadata = constraint.GetYapClass();
			if (classMetadata == null)
			{
				return false;
			}
			classMetadata = i_classMetadata.GetHigherOrCommonHierarchy(classMetadata);
			if (classMetadata == null)
			{
				return false;
			}
			i_classMetadata = classMetadata;
			return true;
		}
Exemple #6
0
		// FIXME: This method should go completely.
		//        We changed the code to create the QCandidates graph in two steps:
		//        (1) call fitsIntoExistingConstraintHierarchy to determine whether
		//            or not we need more QCandidates objects
		//        (2) add all constraints
		//        This method tries to do both in one, which results in missing
		//        constraints. Not all are added to all QCandiates.
		//        Right methodology is in 
		//        QQueryBase#createCandidateCollection
		//        and
		//        QQueryBase#createQCandidatesList
		internal bool TryAddConstraint(QCon a_constraint)
		{
			if (_field != null)
			{
				QField qf = a_constraint.GetField();
				if (qf != null)
				{
					if (_field.Name() != null && !_field.Name().Equals(qf.Name()))
					{
						return false;
					}
				}
			}
			if (i_classMetadata == null || a_constraint.IsNullConstraint())
			{
				AddConstraint(a_constraint);
				return true;
			}
			ClassMetadata yc = a_constraint.GetYapClass();
			if (yc != null)
			{
				yc = i_classMetadata.GetHigherOrCommonHierarchy(yc);
				if (yc != null)
				{
					i_classMetadata = yc;
					AddConstraint(a_constraint);
					return true;
				}
			}
			AddConstraint(a_constraint);
			return false;
		}