Esempio n. 1
0
        /// <summary>
        /// Determine semantic equality
        /// </summary>
        /// <remarks>Since this data-type is an adaptation of an R1 data type with no semantic equality statements,
        /// the value of this method will be that of the IVL type combined with the UVP type meaning that two
        /// URG instances are semantically equal when their <see cref="P:Low"/> and <see cref="P:High"/> bounds
        /// are specified and equal and their <see cref="P:Probability"/> properties are equal</remarks>
        public override BL SemanticEquals(IAny other)
        {
            // Based on set, first, is the other a DSET?
            if (other is URG <T> )
            {
                URG <T> ivlOther = other as URG <T>;
                // Parameters to semantic equality
                bool otherHighInfinite = (ivlOther.High == null || (NullFlavor)ivlOther.High.NullFlavor == DataTypes.NullFlavor.PositiveInfinity),
                     thisHighInfinite  = (this.High == null || (NullFlavor)this.High.NullFlavor == DataTypes.NullFlavor.PositiveInfinity),
                     otherLowInifinite = (ivlOther.Low == null || (NullFlavor)ivlOther.Low.NullFlavor == DataTypes.NullFlavor.NegativeInfinity),
                     thisLowInfinite   = (this.Low == null || (NullFlavor)this.Low.NullFlavor == DataTypes.NullFlavor.NegativeInfinity),
                     isOtherUnbound    = (ivlOther.High == null || ivlOther.High.IsNull) && !otherHighInfinite ||
                                         (ivlOther.Low == null || ivlOther.Low.IsNull) && !otherLowInifinite,
                     isThisUnbound = (this.High == null || this.High.IsNull) && !thisHighInfinite ||
                                     (this.Low == null || this.Low.IsNull) && !thisLowInfinite;

                // Case 1 : Both are bound
                if (!isOtherUnbound && !isThisUnbound)
                {
                    return(((otherHighInfinite && thisHighInfinite) || (bool)this.High.SemanticEquals(ivlOther.High)) &&
                           ((otherLowInifinite && thisLowInfinite) || (bool)this.Low.SemanticEquals(ivlOther.Low)) &&
                           (this.Probability == null ? ivlOther.Probability == null : this.Probability.Equals(ivlOther.Probability)));
                }
                return(false); // all others are not equal
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Determines if this URG of T is equal to another URG of T
        /// </summary>
        public bool Equals(URG <T> other)
        {
            bool result = false;

            if (other != null)
            {
                result = base.Equals((UVP <T>)other) &&
                         (other.High != null ? other.High.Equals(this.High) : this.High == null) &&
                         other.HighClosed == this.HighClosed &&
                         (other.Low != null ? other.Low.Equals(this.Low) : this.Low == null) &&
                         other.LowClosed == this.LowClosed &&
                         (other.OriginalText != null ? other.OriginalText.Equals(this.OriginalText) : this.OriginalText == null) &&
                         (other.Width != null ? other.Width.Equals(this.Width) : this.Width == null);
            }
            return(result);
        }
Esempio n. 3
0
        public static URG <T> Parse(MARC.Everest.DataTypes.URG <Object> o)
        {
            URG <T> retVal = new URG <T>();

            retVal.NullFlavor     = o.NullFlavor == null ? null : o.NullFlavor.Clone() as CS <NullFlavor>;
            retVal.ControlActExt  = o.ControlActExt;
            retVal.ControlActRoot = o.ControlActRoot;
            retVal.Flavor         = o.Flavor;
            retVal.Probability    = o.Probability;
            retVal.UpdateMode     = o.UpdateMode == null ? null : o.UpdateMode.Clone() as CS <UpdateMode>;
            retVal.ValidTimeHigh  = o.ValidTimeHigh;
            retVal.ValidTimeLow   = o.ValidTimeLow;
            retVal.Value          = (T)Util.FromWireFormat(o.Value, typeof(T));
            retVal.OriginalText   = o.OriginalText == null ? null : o.OriginalText.Clone() as ED;
            retVal.Low            = (T)Util.FromWireFormat(o.Low, typeof(T));
            retVal.High           = (T)Util.FromWireFormat(o.High, typeof(T));
            retVal.LowClosed      = o.LowClosed;
            retVal.HighClosed     = o.HighClosed;
            retVal.Width          = (PQ)Util.FromWireFormat(o.Width, typeof(PQ));
            return(retVal);
        }