File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
core/src/main/java/ai/timefold/solver/core/impl/score/stream/common/inliner Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 11package ai .timefold .solver .core .impl .score .stream .common .inliner ;
22
33import java .math .BigDecimal ;
4+ import java .util .Arrays ;
5+ import java .util .Objects ;
46
57import ai .timefold .solver .core .api .score .buildin .bendablebigdecimal .BendableBigDecimalScore ;
68import ai .timefold .solver .core .impl .score .stream .common .AbstractConstraint ;
@@ -116,6 +118,35 @@ public void undo() {
116118 public BendableBigDecimalScore toScore () {
117119 return BendableBigDecimalScore .of (hardImpacts , softImpacts );
118120 }
121+
122+ @ Override
123+ public boolean equals (Object o ) {
124+ if (this == o ) {
125+ return true ;
126+ }
127+ if (!(o instanceof ComplexImpact that )) {
128+ return false ;
129+ }
130+ return Objects .equals (ctx , that .ctx ) &&
131+ Objects .deepEquals (hardImpacts , that .hardImpacts ) &&
132+ Objects .deepEquals (softImpacts , that .softImpacts );
133+ }
134+
135+ @ Override
136+ public int hashCode () {
137+ var hash = 1 ;
138+ hash = 31 * hash + ctx .hashCode ();
139+ hash = 31 * hash + Arrays .hashCode (hardImpacts );
140+ hash = 31 * hash + Arrays .hashCode (softImpacts );
141+ return hash ;
142+ }
143+
144+ @ Override
145+ public String toString () {
146+ return "Impact(hard: %s, soft: %s)"
147+ .formatted (Arrays .toString (hardImpacts ), Arrays .toString (softImpacts ));
148+ }
149+
119150 }
120151
121152}
Original file line number Diff line number Diff line change 11package ai .timefold .solver .core .impl .score .stream .common .inliner ;
22
3+ import java .util .Arrays ;
4+ import java .util .Objects ;
5+
36import ai .timefold .solver .core .api .score .buildin .bendablelong .BendableLongScore ;
47import ai .timefold .solver .core .impl .score .stream .common .AbstractConstraint ;
58
@@ -110,6 +113,35 @@ public void undo() {
110113 public BendableLongScore toScore () {
111114 return BendableLongScore .of (hardImpacts , softImpacts );
112115 }
116+
117+ @ Override
118+ public boolean equals (Object o ) {
119+ if (this == o ) {
120+ return true ;
121+ }
122+ if (!(o instanceof ComplexImpact that )) {
123+ return false ;
124+ }
125+ return Objects .equals (ctx , that .ctx ) &&
126+ Objects .deepEquals (hardImpacts , that .hardImpacts ) &&
127+ Objects .deepEquals (softImpacts , that .softImpacts );
128+ }
129+
130+ @ Override
131+ public int hashCode () {
132+ var hash = 1 ;
133+ hash = 31 * hash + ctx .hashCode ();
134+ hash = 31 * hash + Arrays .hashCode (hardImpacts );
135+ hash = 31 * hash + Arrays .hashCode (softImpacts );
136+ return hash ;
137+ }
138+
139+ @ Override
140+ public String toString () {
141+ return "Impact(hard: %s, soft: %s)"
142+ .formatted (Arrays .toString (hardImpacts ), Arrays .toString (softImpacts ));
143+ }
144+
113145 }
114146
115147}
Original file line number Diff line number Diff line change 11package ai .timefold .solver .core .impl .score .stream .common .inliner ;
22
3+ import java .util .Arrays ;
4+ import java .util .Objects ;
5+
36import ai .timefold .solver .core .api .score .buildin .bendable .BendableScore ;
47import ai .timefold .solver .core .impl .score .stream .common .AbstractConstraint ;
58
@@ -108,6 +111,35 @@ public void undo() {
108111 public BendableScore toScore () {
109112 return BendableScore .of (hardImpacts , softImpacts );
110113 }
114+
115+ @ Override
116+ public boolean equals (Object o ) {
117+ if (this == o ) {
118+ return true ;
119+ }
120+ if (!(o instanceof ComplexImpact that )) {
121+ return false ;
122+ }
123+ return Objects .equals (ctx , that .ctx ) &&
124+ Objects .deepEquals (hardImpacts , that .hardImpacts ) &&
125+ Objects .deepEquals (softImpacts , that .softImpacts );
126+ }
127+
128+ @ Override
129+ public int hashCode () {
130+ var hash = 1 ;
131+ hash = 31 * hash + ctx .hashCode ();
132+ hash = 31 * hash + Arrays .hashCode (hardImpacts );
133+ hash = 31 * hash + Arrays .hashCode (softImpacts );
134+ return hash ;
135+ }
136+
137+ @ Override
138+ public String toString () {
139+ return "Impact(hard: %s, soft: %s)"
140+ .formatted (Arrays .toString (hardImpacts ), Arrays .toString (softImpacts ));
141+ }
142+
111143 }
112144
113145}
You can’t perform that action at this time.
0 commit comments