3030 */
3131public interface Arity {
3232
33+ /**
34+ * Creates arity with given {@code min} and {@code max}.
35+ *
36+ * @param min The minimum number of arguments. Must be zero or positive.
37+ * @param max The maximum number of arguments. Must be zero or positive and greater than or equal to {@code min}.
38+ * @return the created arity
39+ */
40+ static Arity of (int min , int max ) {
41+ return min == max ? nary (min ) : new DynamicArity (min , max );
42+ }
43+
44+ /**
45+ * Creates N-ary object.
46+ *
47+ * @param n The N.
48+ * @return the created arity
49+ */
50+ static Arity nary (int n ) {
51+ return new NAry (n );
52+ }
53+
3354 /**
3455 * The minimum number of arguments operator can receive.
3556 *
@@ -48,23 +69,21 @@ public interface Arity {
4869 int max ();
4970
5071 /**
51- * Creates arity with given {@code min} and {@code max}.
72+ * Compares this object with the specified object for equality. Two objects are considered equal if they represent
73+ * the same Arity, meaning their min and max are equal.
5274 *
53- * @param min The minimum number of arguments. Must be zero or positive.
54- * @param max The maximum number of arguments. Must be zero or positive and greater than or equal to {@code min}.
55- * @return the created arity
75+ * @param o The object to be compared for equality with this object.
76+ * @return {@code true} if the specified object is equal to this object; {@code false} otherwise.
5677 */
57- static Arity of (int min , int max ) {
58- return min == max ? nary (min ) : new DynamicArity (min , max );
59- }
78+ @ Override
79+ boolean equals (Object o );
6080
6181 /**
62- * Creates N-ary object.
82+ * Returns the hash code value for this object. The hash code is computed based on the properties of the object and
83+ * ensures that equal objects have the same hash code.
6384 *
64- * @param n The N.
65- * @return the created arity
85+ * @return The hash code value for this object.
6686 */
67- static Arity nary (int n ) {
68- return new NAry (n );
69- }
87+ @ Override
88+ int hashCode ();
7089}
0 commit comments