@@ -18,10 +18,10 @@ namespace Synercoding.Primitives
1818 /// <param name="unit">The unit type of the coordinates</param>
1919 public Rectangle ( double llx , double lly , double urx , double ury , Unit unit )
2020 {
21- LLX = new UnitValue ( llx , unit ) ;
22- LLY = new UnitValue ( lly , unit ) ;
23- URX = new UnitValue ( urx , unit ) ;
24- URY = new UnitValue ( ury , unit ) ;
21+ LLX = new Value ( llx , unit ) ;
22+ LLY = new Value ( lly , unit ) ;
23+ URX = new Value ( urx , unit ) ;
24+ URY = new Value ( ury , unit ) ;
2525 }
2626
2727 /// <summary>
@@ -31,7 +31,7 @@ public Rectangle(double llx, double lly, double urx, double ury, Unit unit)
3131 /// <param name="lly">The lower left y coordinate</param>
3232 /// <param name="urx">The upper right x coordinate</param>
3333 /// <param name="ury">The upper right y coordinate</param>
34- public Rectangle ( UnitValue llx , UnitValue lly , UnitValue urx , UnitValue ury )
34+ public Rectangle ( Value llx , Value lly , Value urx , Value ury )
3535 {
3636 LLX = llx ;
3737 LLY = lly ;
@@ -70,7 +70,7 @@ public void Deconstruct(out Point location, out Size size)
7070 /// <param name="lly">The out parameter for the lower left y coordinate</param>
7171 /// <param name="urx">The out parameter for the upper right x coordinate</param>
7272 /// <param name="ury">The out parameter for the upper right y coordinate</param>
73- public void Deconstruct ( out UnitValue llx , out UnitValue lly , out UnitValue urx , out UnitValue ury )
73+ public void Deconstruct ( out Value llx , out Value lly , out Value urx , out Value ury )
7474 {
7575 llx = LLX ;
7676 lly = LLY ;
@@ -87,33 +87,33 @@ public static Rectangle Zero
8787 /// <summary>
8888 /// The lower left x coordinate
8989 /// </summary>
90- public UnitValue LLX { get ; }
90+ public Value LLX { get ; }
9191
9292 /// <summary>
9393 /// The lower left y coordinate
9494 /// </summary>
95- public UnitValue LLY { get ; }
95+ public Value LLY { get ; }
9696
9797 /// <summary>
9898 /// The upper right x coordinate
9999 /// </summary>
100- public UnitValue URX { get ; }
100+ public Value URX { get ; }
101101
102102 /// <summary>
103103 /// The upper right y coordinate
104104 /// </summary>
105- public UnitValue URY { get ; }
105+ public Value URY { get ; }
106106
107107 /// <summary>
108108 /// The width of this <see cref="Rectangle"/>
109109 /// </summary>
110- public UnitValue Width
110+ public Value Width
111111 => URX - LLX ;
112112
113113 /// <summary>
114114 /// The height of this <see cref="Rectangle"/>
115115 /// </summary>
116- public UnitValue Height
116+ public Value Height
117117 => URY - LLY ;
118118
119119 /// <summary>
@@ -143,10 +143,8 @@ public override int GetHashCode()
143143 => HashCode . Combine ( LLX , LLY , URX , URY ) ;
144144
145145 /// <inheritdoc/>
146- public override bool Equals ( object obj )
147- {
148- return obj is Rectangle unit && Equals ( unit ) ;
149- }
146+ public override bool Equals ( object ? obj )
147+ => obj is Rectangle unit && Equals ( unit ) ;
150148
151149 /// <inheritdoc/>
152150 public bool Equals ( Rectangle other )
@@ -163,5 +161,23 @@ public bool Equals(Rectangle other)
163161 /// <inheritdoc/>
164162 public override string ToString ( )
165163 => $ "LLX { LLX } , LLY { LLY } , URX { URX } , URY { URY } ";
164+
165+ /// <summary>
166+ /// Returns a value that indicates whether two specified <see cref="Rectangle"/> values are equal.
167+ /// </summary>
168+ /// <param name="left">The first value to compare.</param>
169+ /// <param name="right">The second value to compare.</param>
170+ /// <returns>true if left and right are equal; otherwise, false.</returns>
171+ public static bool operator == ( Rectangle left , Rectangle right )
172+ => left . Equals ( right ) ;
173+
174+ /// <summary>
175+ /// Returns a value that indicates whether two specified <see cref="Rectangle"/> values are not equal.
176+ /// </summary>
177+ /// <param name="left">The first value to compare.</param>
178+ /// <param name="right">The second value to compare.</param>
179+ /// <returns>true if left and right are not equal; otherwise, false.</returns>
180+ public static bool operator != ( Rectangle left , Rectangle right )
181+ => ! ( left == right ) ;
166182 }
167183}
0 commit comments