/// <summary> /// Determines if this SXPR of T is equal to another SXPR of T /// </summary> /// <remarks> /// This equality method checks to ensure that not only are the core data elements of the /// two instanes the same, but each of the <see cref="P:Component"/> elements are equal. /// </remarks> public bool Equals(SXPR <T> other) { if (other != null) { bool result = base.Equals((SXCM <T>)other) && other.Count == this.Count; for (int i = 0; i < (result ? this.Count : 0); i++) { result &= this.Terms[i] != null ? this.Terms[i].Equals(other.Terms[i]) : other.Terms[i] == null; } return(result); } return(false); }
/// <summary> /// Translate this QSET to an SXPR /// </summary> /// <exception cref="T:System.InvalidOperationException">When a member of the set cannot be translated to an SXCM expression</exception> public SXPR <T> TranslateToSXPR() { SXPR <T> retVal = new SXPR <T>(); if (this.NullFlavor != null) { retVal.NullFlavor = this.NullFlavor.Clone() as CS <NullFlavor>; } else if (this is IEnumerable) { IEnumerator ienum = (this as IEnumerable).GetEnumerator(); while (ienum.MoveNext()) { IAny current = ienum.Current as IAny; if (current is QSET <T> ) { var sxpr = (current as QSET <T>).TranslateToSXPR(); sxpr.Operator = this.GetEquivalentSetOperator(); retVal.Add(sxpr); } else if (current is SXCM <T> ) { var sxcm = current.Clone() as SXCM <T>; sxcm.Operator = this.GetEquivalentSetOperator(); // This is a shallow clone, but that is ok since we only want to modify the SetOperator which is immutable retVal.Add(sxcm); } else if (current is T) { SXCM <T> sxcm = null; if (current is IImplicitInterval <T> ) { sxcm = (current as IImplicitInterval <T>).ToIVL(); } else { throw new InvalidOperationException("Cannot interpret the member of the set with type '{0}' as it cannot be converted to a union of interval"); } sxcm.Operator = this.GetEquivalentSetOperator(); retVal.Add(sxcm); } } } return(retVal); }
/// <summary> /// Create a new instance of the GTS class with the specified <paramref name="hull"/> /// </summary> /// <param name="hull"></param> public GTS(SXPR <TS> hull) : base() { this.Hull = hull; }