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); }
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; }
public virtual void AddAlternateGroup(PatternGroup group) { itsAlternateGroups.Add(group); }
/// <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); }