blob: 68774e3f9e6ba006351e1757ee081bb3c94921be [file] [log] [blame]
Ayaka Koshibe04a1a4e2014-09-11 14:31:29 -07001package org.onlab.packet;
2
3/**
4 * Representation of a VLAN ID.
5 */
6public class VLANID {
7 // A VLAN ID is 12 bits, short is close
8 private final short value;
9
10 public VLANID(short value) {
11 this.value = value;
12 }
13
14 public short toShort() {
15 return this.value;
16 }
17
18 @Override
19 public boolean equals(Object obj) {
20 if (this == obj) {
21 return true;
22 }
23
24 if (obj instanceof VLANID) {
25 return true;
26 }
27
28 VLANID other = (VLANID) obj;
29 if (this.value == other.value) {
30 return true;
31 }
32
33 return false;
34 }
35
36 @Override
37 public int hashCode() {
38 return this.value;
39 }
40}
41