blob: 6affab8a21e5a8380a7540d93628948acbd4ac5f [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001package org.projectfloodlight.openflow.types;
2
3/**
4 * Represents the speed of a port
5 */
6public enum PortSpeed {
7 /** no speed set */
8 SPEED_NONE(0),
9 SPEED_10MB(10),
10 SPEED_100MB(100),
11 SPEED_1GB(1_000),
12 SPEED_10GB(10_000),
13 SPEED_40GB(40_000),
14 SPEED_100GB(100_000),
15 SPEED_1TB(1_000_000);
16
17 private long speedInBps;
18 private PortSpeed(int speedInMbps) {
19 this.speedInBps = speedInMbps * 1000L*1000L;
20 }
21
22 public long getSpeedBps() {
23 return this.speedInBps;
24 }
25
26 public static PortSpeed max(PortSpeed s1, PortSpeed s2) {
27 return (s1.getSpeedBps() > s2.getSpeedBps()) ? s1 : s2;
28 }
29
30 public static PortSpeed min(PortSpeed s1, PortSpeed s2) {
31 return (s1.getSpeedBps() < s2.getSpeedBps()) ? s1 : s2;
32 }
33}