|
|
|
@ -36,25 +36,25 @@ package explicit; |
|
|
|
public class ProductState implements Comparable<ProductState> |
|
|
|
{ |
|
|
|
/** The first state */ |
|
|
|
private Integer state_1; |
|
|
|
private int state_1; |
|
|
|
/** The second state */ |
|
|
|
private Integer state_2; |
|
|
|
private int state_2; |
|
|
|
|
|
|
|
/** Constructor */ |
|
|
|
public ProductState(Integer state_1, Integer state_2) |
|
|
|
public ProductState(int state_1, int state_2) |
|
|
|
{ |
|
|
|
this.state_1 = state_1; |
|
|
|
this.state_2 = state_2; |
|
|
|
} |
|
|
|
|
|
|
|
/** Get the first state */ |
|
|
|
public Integer getFirstState() |
|
|
|
public int getFirstState() |
|
|
|
{ |
|
|
|
return state_1; |
|
|
|
} |
|
|
|
|
|
|
|
/** Get the second state */ |
|
|
|
public Integer getSecondState() |
|
|
|
public int getSecondState() |
|
|
|
{ |
|
|
|
return state_2; |
|
|
|
} |
|
|
|
@ -68,9 +68,9 @@ public class ProductState implements Comparable<ProductState> |
|
|
|
@Override |
|
|
|
public int compareTo(ProductState other) |
|
|
|
{ |
|
|
|
int rv = state_1.compareTo(state_2); |
|
|
|
int rv = Integer.compare(state_1, state_2); |
|
|
|
if (rv == 0) { |
|
|
|
return state_2.compareTo(other.state_2); |
|
|
|
return Integer.compare(state_1, state_2); |
|
|
|
} else { |
|
|
|
return rv; |
|
|
|
} |
|
|
|
@ -81,8 +81,8 @@ public class ProductState implements Comparable<ProductState> |
|
|
|
{ |
|
|
|
final int prime = 31; |
|
|
|
int result = 1; |
|
|
|
result = prime * result + ((state_1 == null) ? 0 : state_1.hashCode()); |
|
|
|
result = prime * result + ((state_2 == null) ? 0 : state_2.hashCode()); |
|
|
|
result = prime * result + Integer.hashCode(state_1); |
|
|
|
result = prime * result + Integer.hashCode(state_2); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ public class ProductState implements Comparable<ProductState> |
|
|
|
if (getClass() != obj.getClass()) |
|
|
|
return false; |
|
|
|
ProductState other = (ProductState) obj; |
|
|
|
return state_1.equals(other.state_1) && |
|
|
|
state_2.equals(other.state_2); |
|
|
|
return state_1 == other.state_1 && |
|
|
|
state_2 == other.state_2; |
|
|
|
} |
|
|
|
} |