Brian O'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.matchaction; |
| 2 | |
| 3 | import net.onrc.onos.api.batchoperation.BatchOperation; |
| 4 | |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 5 | import 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'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 13 | public final class MatchActionOperations |
| 14 | extends BatchOperation<MatchActionOperationEntry> { |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 15 | |
| 16 | private final MatchActionOperationsId id; |
Brian O'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 17 | /** |
| 18 | * The MatchAction operators. |
| 19 | */ |
| 20 | public enum Operator { |
| 21 | ADD, |
| 22 | REMOVE, |
| 23 | } |
| 24 | |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 25 | /** |
| 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 Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame] | 31 | public MatchActionOperations(final MatchActionOperationsId newId) { |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 32 | id = checkNotNull(newId); |
| 33 | } |
| 34 | |
| 35 | /** |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 36 | * 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'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 57 | } |