blob: c8652037faf673e035f3960ee930a85176463724 [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 */
Ray Milkey9ed4b962014-08-20 15:43:40 -070031 public MatchActionOperations(final MatchActionOperationsId newId) {
Ray Milkeyc127a5a2014-08-20 11:22:12 -070032 id = checkNotNull(newId);
33 }
34
35 /**
Ray Milkeyc127a5a2014-08-20 11:22:12 -070036 * Gets the identifier for the Match Action Operations object.
37 *
38 * @return identifier for the Opertions object
39 */
40 public MatchActionOperationsId getOperationsId() {
41 return id;
42 }
43
44 @Override
45 public int hashCode() {
46 return id.hashCode();
47 }
48
49 @Override
50 public boolean equals(Object obj) {
51 if (obj instanceof MatchActionOperations) {
52 final MatchActionOperations other = (MatchActionOperations) obj;
53 return (id.equals(other.id));
54 }
55 return false;
56 }
Brian O'Connordee2e6b2014-08-12 11:34:51 -070057}