blob: f2e3d8a45e717cf69d1aaa3d2add1643924269c9 [file] [log] [blame]
Sho SHIMIZU15ed4fd2014-08-05 14:40:42 -07001package net.onrc.onos.api.newintent;
2
3/**
4 * Base intent implementation.
5 */
6public abstract class AbstractIntent implements Intent {
7
8 private final IntentId id;
9
10 /**
11 * Creates a base intent with the specified identifier.
12 *
13 * @param id intent identifier
14 */
15 protected AbstractIntent(IntentId id) {
16 this.id = id;
17 }
18
19 @Override
20 public IntentId getId() {
21 return id;
22 }
23
24 @Override
25 public boolean equals(Object o) {
26 if (this == o) {
27 return true;
28 }
29 if (o == null || getClass() != o.getClass()) {
30 return false;
31 }
32
33 AbstractIntent that = (AbstractIntent) o;
34 return id.equals(that.id);
35 }
36
37 @Override
38 public int hashCode() {
39 return id.hashCode();
40 }
41
42}