Skip to content

Commit 256b49f

Browse files
Option comparable
1 parent 3145a8c commit 256b49f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/network/aika/neuron/activation/Activation.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ public Activation getActivation() {
11711171
}
11721172

11731173

1174-
public class Option {
1174+
public class Option implements Comparable<Option> {
11751175
public int snId;
11761176
public State state;
11771177
public Decision decision;
@@ -1241,6 +1241,13 @@ public Activation getAct() {
12411241
public String toString() {
12421242
return " snId:" + snId + " d:" + decision + " cacheFactor:" + cacheFactor + " w:" + Utils.round(weight) + " p:" + p + " " + state;
12431243
}
1244+
1245+
@Override
1246+
public int compareTo(Option o) {
1247+
int r = Integer.compare(getAct().getId(), o.getAct().getId());
1248+
if(r != 0) return r;
1249+
return Integer.compare(snId, o.snId);
1250+
}
12441251
}
12451252

12461253

0 commit comments

Comments
 (0)