Browse Source

imported patch rewardcounter-ProductState-int.patch

tud-infrastructure-2018-10-12
Joachim Klein 7 years ago
parent
commit
ae9f852162
  1. 22
      prism/src/explicit/ProductState.java

22
prism/src/explicit/ProductState.java

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