blob: 1f0de83abd86b0f00f311af31e38d202d8c4cdf8 [file] [log] [blame]
Brian O'Connorb876bf12014-10-02 14:59:37 -07001package org.onlab.onos.net.intent;
Brian O'Connorf3d06162014-10-02 15:54:12 -07002//TODO is this the right package?
Brian O'Connorb876bf12014-10-02 14:59:37 -07003
4import java.util.Objects;
5
6import com.google.common.base.MoreObjects;
7
8/**
9 * A super class for batch operation entry classes.
10 * <p>
11 * This is the interface to classes which are maintained by BatchOperation as
12 * its entries.
13 */
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070014@Deprecated
Brian O'Connorb876bf12014-10-02 14:59:37 -070015public class BatchOperationEntry<T extends Enum<?>, U extends BatchOperationTarget> {
16 private final T operator;
17 private final U target;
18
alshabib902d41b2014-10-07 16:52:05 -070019
Brian O'Connorb876bf12014-10-02 14:59:37 -070020
21 /**
22 * Constructs new instance for the entry of the BatchOperation.
23 *
24 * @param operator the operator of this operation
25 * @param target the target object of this operation
26 */
27 public BatchOperationEntry(T operator, U target) {
28 this.operator = operator;
29 this.target = target;
30 }
31
32 /**
33 * Gets the target object of this operation.
34 *
35 * @return the target object of this operation
36 */
37 public U getTarget() {
38 return target;
39 }
40
41 /**
42 * Gets the operator of this operation.
43 *
44 * @return the operator of this operation
45 */
46 public T getOperator() {
47 return operator;
48 }
49
50 @Override
51 public boolean equals(Object o) {
52 if (this == o) {
53 return true;
54 }
55 if (o == null || getClass() != o.getClass()) {
56 return false;
57 }
58
59 BatchOperationEntry<?, ?> other = (BatchOperationEntry<?, ?>) o;
60 return (this.operator == other.operator) &&
61 Objects.equals(this.target, other.target);
62 }
63
64 @Override
65 public int hashCode() {
66 return Objects.hash(operator, target);
67 }
68
69 @Override
70 public String toString() {
71 return MoreObjects.toStringHelper(this)
72 .add("operator", operator)
73 .add("target", target)
74 .toString();
75 }
76}