blob: fcd20d6db7573fe100f2bbe4a171e56bfc4e1efa [file] [log] [blame]
xinwuc1b011d2013-09-18 15:24:04 -07001package org.projectfloodlight.openflow.types;
2
xinwu32034432013-09-18 17:17:50 -07003import javax.annotation.concurrent.Immutable;
xinwuc1b011d2013-09-18 15:24:04 -07004
5@Immutable
xinwu32034432013-09-18 17:17:50 -07006public class L2MulticastId {
xinwuc1b011d2013-09-18 15:24:04 -07007 static final int LENGTH = 4;
8 private final int rawValue;
9
xinwuc1b011d2013-09-18 15:24:04 -070010 private L2MulticastId(final int rawValue) {
11 this.rawValue = rawValue;
12 }
13
14 public static L2MulticastId of(final int raw) {
15 return new L2MulticastId(raw);
16 }
17
18 public int getInt() {
19 return rawValue;
20 }
21
xinwuc1b011d2013-09-18 15:24:04 -070022 public int getLength() {
23 return LENGTH;
24 }
25
26 @Override
27 public int hashCode() {
28 final int prime = 31;
29 int result = 1;
30 result = prime * result + rawValue;
31 return result;
32 }
33
34 @Override
35 public boolean equals(Object obj) {
36 if (this == obj)
37 return true;
38 if (obj == null)
39 return false;
40 if (getClass() != obj.getClass())
41 return false;
42 L2MulticastId other = (L2MulticastId) obj;
43 if (rawValue != other.rawValue)
44 return false;
45 return true;
46 }
47
48 @Override
49 public String toString() {
50 return Integer.toString(rawValue);
51 }
xinwuc1b011d2013-09-18 15:24:04 -070052}