/// <summary> /// Override of semantic equality between this and <paramref name="other"/> /// </summary> public override BL SemanticEquals(MARC.Everest.DataTypes.Interfaces.IAny other) { var baseEq = base.SemanticEquals(other); if (!(bool)baseEq) { return(baseEq); } // Null-flavored if (this.IsNull && other.IsNull) { return(true); } else if (this.IsNull ^ other.IsNull) { return(false); } // Values are equal? UVP <T> uvOther = other as UVP <T>; if (uvOther == null) { return(false); } return((this.Value == null ? uvOther.Value == null : this.Value.Equals(uvOther.Value)) && (this.Probability == null ? uvOther.Probability == null : this.Probability.Equals(uvOther.Probability))); }
/// <summary> /// Determines if this UVP of T equals another UVP of T /// </summary> public bool Equals(UVP <T> other) { bool result = false; if (other != null) { result = base.Equals((PDV <T>)other) && other.Probability == this.Probability; } return(result); }
/// <summary> /// Convert a concrete UVP to a generic version /// </summary> /// <exception cref="T:System.InvalidCastException">When the <paramref name="o"/> instance cannot be parsed to a strongly typed UVP of <typeparamref name="T"/></exception> /// Obsolete //[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "o"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] //public static UVP<T> Parse(MARC.Everest.DataTypes.UVP<Object> o) //{ // UVP<T> retVal = new UVP<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; // try // { // retVal.Value = (T)Util.FromWireFormat(o.Value, typeof(T)); // } // catch (Exception e) // { // throw new InvalidCastException("Can't parse surrogate into a strongly typed UVP<T>", e); // } // return retVal; //} #region IEquatable<UVP<T>> Members /// <summary> /// Determines if this UVP of T equals another UVP of T /// </summary> public bool Equals(UVP <T> other) { bool result = false; if (other != null) { result = base.Equals((ANY)other) && (other.Value == null ? this.Value == null : other.Value.Equals(this.Value)) && other.Probability == this.Probability; } return(result); }
public static UVP <T> Parse(MARC.Everest.DataTypes.UVP <Object> o) { UVP <T> retVal = new UVP <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; try { retVal.Value = (T)Util.FromWireFormat(o.Value, typeof(T)); } catch (Exception e) { throw new InvalidCastException("Can't parse surrogate into a strongly typed UVP<T>", e); } return(retVal); }