blob: 3dcb64c3733e94b472a68a2b66e6b49731356630 [file] [log] [blame]
Toshio Koide025a9152014-07-21 11:00:34 -07001package net.onrc.onos.core.matchaction;
2
Toshio Koidefad1cd52014-08-07 17:10:07 -07003import net.onrc.onos.api.batchoperation.BatchOperationTarget;
Toshio Koide025a9152014-07-21 11:00:34 -07004
Ray Milkey9ed4b962014-08-20 15:43:40 -07005import java.util.Objects;
6
Ray Milkeyc127a5a2014-08-20 11:22:12 -07007/**
8 * A unique identifier for a MatchAction. Objects of this class are immutable.
9 */
Brian O'Connordee2e6b2014-08-12 11:34:51 -070010public final class MatchActionId implements BatchOperationTarget {
Ray Milkey9ed4b962014-08-20 15:43:40 -070011 private final long value;
Toshio Koide025a9152014-07-21 11:00:34 -070012
Ray Milkeyc127a5a2014-08-20 11:22:12 -070013 /**
14 * Creates a new Match Action Identifier based on the given id string.
15 *
16 * @param id unique id string
17 */
Ray Milkey9ed4b962014-08-20 15:43:40 -070018 public MatchActionId(long id) {
Toshio Koide025a9152014-07-21 11:00:34 -070019 value = id;
20 }
21
22 @Override
23 public String toString() {
Ray Milkey9ed4b962014-08-20 15:43:40 -070024 return Long.toString(value);
Toshio Koide025a9152014-07-21 11:00:34 -070025 }
26
27 @Override
28 public int hashCode() {
Ray Milkey9ed4b962014-08-20 15:43:40 -070029 return Objects.hashCode(value);
Toshio Koide025a9152014-07-21 11:00:34 -070030 }
31
32 @Override
33 public boolean equals(Object obj) {
34 if (obj instanceof MatchActionId) {
Ray Milkey9ed4b962014-08-20 15:43:40 -070035 final MatchActionId that = (MatchActionId) obj;
36 return this.value == that.value;
Toshio Koide025a9152014-07-21 11:00:34 -070037 }
38 return false;
39 }
40
41}