Sho SHIMIZU | 15ed4fd | 2014-08-05 14:40:42 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.newintent; |
| 2 | |
| 3 | /** |
| 4 | * Base intent implementation. |
| 5 | */ |
| 6 | public 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 | } |