blob: a17d0f20a89faca4604281b84ccce5edc1e62bfa [file] [log] [blame]
Brian O'Connordee2e6b2014-08-12 11:34:51 -07001package net.onrc.onos.core.matchaction;
2
3import net.onrc.onos.api.batchoperation.BatchOperation;
4
Ray Milkeyc127a5a2014-08-20 11:22:12 -07005import static com.google.common.base.Preconditions.checkNotNull;
6
7/**
8 * The MatchActionOperations class holds a list of MatchActionOperationEntry
9 * objects to be executed together as one set.
10 * <p/>
11 * Objects of this class are immutable.
12 */
Brian O'Connordee2e6b2014-08-12 11:34:51 -070013public final class MatchActionOperations
14 extends BatchOperation<MatchActionOperationEntry> {
Ray Milkeyc127a5a2014-08-20 11:22:12 -070015
16 private final MatchActionOperationsId id;
Brian O'Connordee2e6b2014-08-12 11:34:51 -070017 /**
18 * The MatchAction operators.
19 */
20 public enum Operator {
21 ADD,
22 REMOVE,
23 }
24
Ray Milkeyc127a5a2014-08-20 11:22:12 -070025 /**
26 * Constructs a MatchActionOperations object from an id. Internal
27 * constructor called by a public factory method.
28 *
29 * @param newId match action operations identifier for this instance
30 */
31 private MatchActionOperations(final MatchActionOperationsId newId) {
32 id = checkNotNull(newId);
33 }
34
35 /**
36 * Creates a MatchActionOperations object from an id.
37 *
38 * @param newId match action operations identifier to use for the new object
39 * @return Match Action Operations object
40 */
41 public static MatchActionOperations createMatchActionsOperations(
42 final MatchActionOperationsId newId) {
43 return new MatchActionOperations(newId);
44 }
45
46 /**
47 * Gets the identifier for the Match Action Operations object.
48 *
49 * @return identifier for the Opertions object
50 */
51 public MatchActionOperationsId getOperationsId() {
52 return id;
53 }
54
55 @Override
56 public int hashCode() {
57 return id.hashCode();
58 }
59
60 @Override
61 public boolean equals(Object obj) {
62 if (obj instanceof MatchActionOperations) {
63 final MatchActionOperations other = (MatchActionOperations) obj;
64 return (id.equals(other.id));
65 }
66 return false;
67 }
Brian O'Connordee2e6b2014-08-12 11:34:51 -070068}