Ejemplo n.º 1
0
        /// <summary>
        /// Determines if this SXCM of T equals another SXCM of T
        /// </summary>
        public bool Equals(SXCM <T> other)
        {
            bool result = false;

            if (other != null)
            {
                result = base.Equals((PDV <T>)other) &&
                         other.Operator == this.Operator;
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Remove an item from the collection
 /// </summary>
 public bool Remove(SXCM <T> item)
 {
     return(Terms.Remove(item));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns if the component collection contains the specified item
 /// </summary>
 public bool Contains(SXCM <T> item)
 {
     return(Terms.Contains(item));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Add an item to the component collection
 /// </summary>
 public void Add(SXCM <T> item)
 {
     Terms.Add(item);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Insert an item
 /// </summary>
 public void Insert(int index, SXCM <T> item)
 {
     Terms.Insert(index, item);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Index of an item in the component collection
 /// </summary>
 public int IndexOf(SXCM <T> item)
 {
     return(Terms.IndexOf(item));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a new instance of the GTS class with the specified <paramref name="hull"/>
 /// </summary>
 /// <param name="hull"></param>
 public GTS(SXCM <TS> hull)
     : base()
 {
     this.Hull = hull;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets just the value type from the SXCM
 /// </summary>
 internal static T ToValueType(SXCM <T> value)
 {
     return(value.Value);
 }