tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.link; |
2 | |||||
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 3 | import org.onlab.onos.net.AbstractDescription; |
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 4 | import org.onlab.onos.net.ConnectPoint; |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.Link; |
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.SparseAnnotations; |
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 7 | |
8 | /** | ||||
9 | * Default implementation of immutable link description entity. | ||||
10 | */ | ||||
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 11 | public class DefaultLinkDescription extends AbstractDescription |
12 | implements LinkDescription { | ||||
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 13 | |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 14 | private final ConnectPoint src; |
15 | private final ConnectPoint dst; | ||||
16 | private final Link.Type type; | ||||
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 17 | |
18 | /** | ||||
19 | * Creates a link description using the supplied information. | ||||
20 | * | ||||
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 21 | * @param src link source |
22 | * @param dst link destination | ||||
23 | * @param type link type | ||||
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 24 | * @param annotations optional key/value annotations |
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 25 | */ |
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 26 | public DefaultLinkDescription(ConnectPoint src, ConnectPoint dst, |
27 | Link.Type type, SparseAnnotations... annotations) { | ||||
28 | super(annotations); | ||||
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 29 | this.src = src; |
30 | this.dst = dst; | ||||
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 31 | this.type = type; |
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 32 | } |
33 | |||||
34 | @Override | ||||
35 | public ConnectPoint src() { | ||||
36 | return src; | ||||
37 | } | ||||
38 | |||||
39 | @Override | ||||
40 | public ConnectPoint dst() { | ||||
41 | return dst; | ||||
42 | } | ||||
43 | |||||
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 44 | @Override |
45 | public Link.Type type() { | ||||
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 46 | return type; |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 47 | } |
48 | |||||
tom | 4c6606f | 2014-09-07 11:11:21 -0700 | [diff] [blame] | 49 | } |