tom | d1900f3 | 2014-09-03 14:08:16 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.device; |
| 2 | |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame^] | 3 | import com.google.common.collect.ImmutableSet; |
| 4 | import org.onlab.onos.net.Port; |
| 5 | import org.onlab.onos.net.PortNumber; |
| 6 | |
| 7 | import java.util.Set; |
| 8 | |
tom | d1900f3 | 2014-09-03 14:08:16 -0700 | [diff] [blame] | 9 | /** |
| 10 | * Default implementation of immutable port description. |
| 11 | */ |
| 12 | public class DefaultPortDescription implements PortDescription { |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame^] | 13 | |
| 14 | private final PortNumber number; |
| 15 | private final Set<Port.State> state; |
| 16 | |
| 17 | public DefaultPortDescription(PortNumber number, Set<Port.State> state) { |
| 18 | this.number = number; |
| 19 | this.state = ImmutableSet.copyOf(state); |
| 20 | } |
| 21 | |
| 22 | @Override |
| 23 | public PortNumber portNumber() { |
| 24 | return number; |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public Set<Port.State> portState() { |
| 29 | return state; |
| 30 | } |
| 31 | |
tom | d1900f3 | 2014-09-03 14:08:16 -0700 | [diff] [blame] | 32 | } |