Skip to content

Commit 7016151

Browse files
committed
Minor cleanup.
1 parent 32895df commit 7016151

File tree

1 file changed

+3
-3
lines changed
  • aima-core/src/main/java/aima/core/logic/planning

1 file changed

+3
-3
lines changed

aima-core/src/main/java/aima/core/logic/planning/State.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class State {
2424

2525
public State(List<Literal> fluents) {
2626
this.fluents = fluents;
27+
fluents.sort(Comparator.comparing(Literal::toString));
2728
}
2829

2930
public State(String fluents) {
@@ -98,10 +99,9 @@ public List<Literal> getFluents() {
9899

99100
@Override
100101
public boolean equals(Object obj) {
101-
if (getClass() != obj.getClass())
102+
if (obj == null || getClass() != obj.getClass())
102103
return false;
103-
return this.fluents.containsAll(((State) obj).getFluents())
104-
&& ((State) obj).getFluents().containsAll(this.getFluents());
104+
return fluents.equals(((State) obj).getFluents());
105105
}
106106

107107
@Override

0 commit comments

Comments
 (0)