Пример #1
0
        /// <summary>
        /// make 1/x operation.
        /// </summary>
        public virtual BaseQuantity Invert()
        {
            BaseQuantity bq = (BaseQuantity)this.MemberwiseClone();

            bq.SetExponent(0 - _Exponent);


            return(bq);
        }
Пример #2
0
        /// <summary>
        /// Provides the Dimensional Equality algorithm.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            BaseQuantity bd = obj as BaseQuantity;

            if (bd != null)
            {
                if (this.Dimension.IsDimensionless & bd.Dimension.IsDimensionless)
                {
                    //why I've tested dimensioless in begining??
                    //   because I want special dimensionless quantities like angle and solid angle to be treated
                    //   as normal dimensionless values

                    return(true);
                }

                return(this.Dimension.Equals(bd.Dimension));
            }
            else
            {
                return(false);
            }
        }