IDs for MatchAction objects using block allocation
Modified MatchActionId and MatchActionOperationsId to
use longs as IDs and to use ID block allocation to
create them.
Change-Id: I757b353a94a498f624df345cbc16975714db15b3
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchActionId.java b/src/main/java/net/onrc/onos/core/matchaction/MatchActionId.java
index b520439..3dcb64c 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchActionId.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchActionId.java
@@ -2,36 +2,38 @@
import net.onrc.onos.api.batchoperation.BatchOperationTarget;
+import java.util.Objects;
+
/**
* A unique identifier for a MatchAction. Objects of this class are immutable.
*/
public final class MatchActionId implements BatchOperationTarget {
- private final String value;
+ private final long value;
/**
* Creates a new Match Action Identifier based on the given id string.
*
* @param id unique id string
*/
- public MatchActionId(String id) {
+ public MatchActionId(long id) {
value = id;
}
@Override
public String toString() {
- return value;
+ return Long.toString(value);
}
@Override
public int hashCode() {
- return value.hashCode();
+ return Objects.hashCode(value);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof MatchActionId) {
- MatchActionId other = (MatchActionId) obj;
- return (value.equals(other.value));
+ final MatchActionId that = (MatchActionId) obj;
+ return this.value == that.value;
}
return false;
}