1 package org.sat4j.minisat.orders;
2
3
4
5
6
7
8 class ValuedLit implements Comparable<ValuedLit> {
9 final int id;
10
11 final int count;
12
13 ValuedLit(int id,int count) {
14 this.id = id;
15 this.count = count;
16 }
17
18 public int compareTo(ValuedLit t) {
19 if (count == 0) {
20 return Integer.MAX_VALUE;
21 }
22 if (t.count == 0) {
23 return -1;
24 }
25 return count - t.count;
26 }
27
28 @Override
29 public boolean equals(Object o) {
30 if (o == null)
31 return false;
32 if (o instanceof ValuedLit) {
33 return ((ValuedLit) o).count == count;
34 }
35 return false;
36 }
37
38 @Override
39 public int hashCode() {
40 return id;
41 }
42
43 @Override
44 public String toString() {
45 return "" + id + "(" + count + ")";
46 }
47 }