Ejemplo n.º 1
0
        public PatternGroup Rest()
        {
            PatternGroup rest = new PatternGroup();

            rest.itsPatterns.AddRange(itsPatterns.GetRange(1, itsPatterns.Count - 1));
            rest.OptionalGroup = itsOptionalPatterns;
            rest.itsAlternateGroups.AddRange(itsAlternateGroups);
            rest.itsConstraints.AddRange(itsConstraints);

            return(rest);
        }
Ejemplo n.º 2
0
 public Query()
 {
     itsPatternGroup   = new PatternGroup();
     itsVariables      = new ArrayList();
     itsDescribeTerms  = new ArrayList();
     itsIsDistinct     = false;
     itsSelectAll      = true;
     itsBase           = String.Empty;
     itsOrderDirection = SortOrder.Ascending;
     itsOrderBy        = new NullOrdering();
     itsResultLimit    = Int32.MaxValue;
     itsResultForm     = ResultFormType.Select;
     itsQueryGroup     = null;
 }
Ejemplo n.º 3
0
 public virtual void AddAlternateGroup(PatternGroup group)
 {
     itsAlternateGroups.Add(group);
 }
Ejemplo n.º 4
0
        /// <summary>Determines whether two PatternGroup instances are equal.</summary>
        /// <returns>True if the two PatternGroups are equal, False otherwise</returns>
        public override bool Equals(object other)
        {
            if (null == other)
            {
                return(false);
            }
            if (this == other)
            {
                return(true);
            }


            PatternGroup specific = (PatternGroup)other;

            if (itsPatterns.Count != specific.itsPatterns.Count)
            {
                return(false);
            }
            if (itsAlternateGroups.Count != specific.itsAlternateGroups.Count)
            {
                return(false);
            }
            if (itsConstraints.Count != specific.itsConstraints.Count)
            {
                return(false);
            }
            if (null == itsOptionalPatterns)
            {
                if (null != specific.itsOptionalPatterns)
                {
                    return(false);
                }
            }
            else
            {
                if (!itsOptionalPatterns.Equals(specific.itsOptionalPatterns))
                {
                    return(false);
                }
            }

            IList otherPatterns = specific.itsPatterns;

            foreach (Pattern pattern in itsPatterns)
            {
                if (!otherPatterns.Contains(pattern))
                {
                    return(false);
                }
            }

            IList otherAlternateGroups = specific.itsAlternateGroups;

            foreach (PatternGroup group in itsAlternateGroups)
            {
                if (!otherAlternateGroups.Contains(group))
                {
                    return(false);
                }
            }

            IList otherConstraints = specific.itsConstraints;

            foreach (Constraint constraint in itsConstraints)
            {
                if (!otherConstraints.Contains(constraint))
                {
                    return(false);
                }
            }

            return(true);
        }