Exemple #1
0
        protected bool Equals(YogaCachedMeasurement other)
        {
            bool isEqual = WidthMeasureMode == other.WidthMeasureMode &&
                           HeightMeasureMode == other.HeightMeasureMode;

            if (AvailableWidth.HasValue() || other.AvailableWidth.HasValue())
            {
                isEqual = isEqual && FloatsEqual(AvailableWidth, other.AvailableWidth);
            }

            if (AvailableHeight.HasValue() || other.AvailableHeight.HasValue())
            {
                isEqual = isEqual && FloatsEqual(AvailableHeight, other.AvailableHeight);
            }

            if (ComputedWidth.HasValue() || other.ComputedWidth.HasValue())
            {
                isEqual = isEqual && FloatsEqual(ComputedWidth, other.ComputedWidth);
            }

            if (ComputedHeight.HasValue() || other.ComputedHeight.HasValue())
            {
                isEqual = isEqual && FloatsEqual(ComputedHeight, other.ComputedHeight);
            }

            return(isEqual);
        }
Exemple #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AvailableHeight.GetHashCode();
         hashCode = (hashCode * 397) ^ AvailableWidth.GetHashCode();
         hashCode = (hashCode * 397) ^ ComputedHeight.GetHashCode();
         hashCode = (hashCode * 397) ^ ComputedWidth.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)HeightMeasureMode;
         hashCode = (hashCode * 397) ^ (int)WidthMeasureMode;
         return(hashCode);
     }
 }
Exemple #3
0
        /// <inheritdoc />
        public bool Equals(CachedMeasurement other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                (AvailableHeight.Equals(other.AvailableHeight) &&
                 AvailableWidth.Equals(other.AvailableWidth) &&
                 ComputedHeight.Equals(other.ComputedHeight) &&
                 ComputedWidth.Equals(other.ComputedWidth) &&
                 HeightMeasureMode == other.HeightMeasureMode &&
                 WidthMeasureMode == other.WidthMeasureMode);
        }