blob: af1dfa7a509626a124c7520eb42097080b6ab255 [file] [log] [blame]
Simon Huntc13082f2016-08-03 21:20:23 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.ui.model.topo;
18
19import org.onosproject.net.region.RegionId;
20
21import static com.google.common.base.MoreObjects.toStringHelper;
22
23/**
24 * A synthetic link that encapsulates a UiLink instance and the region to
25 * which it belongs.
26 */
27public class UiSynthLink {
28
29 private final RegionId regionId;
30 private final UiLink link;
Simon Hunt0e161092017-05-08 17:41:38 -070031 private final UiLink original;
Simon Huntc13082f2016-08-03 21:20:23 -070032
33 /**
34 * Constructs a synthetic link with the given parameters.
35 *
36 * @param regionId the region to which the link belongs
37 * @param link the link instance
Simon Hunt0e161092017-05-08 17:41:38 -070038 * @param original the original link (device or edge)
39 * from which this was derived
Simon Huntc13082f2016-08-03 21:20:23 -070040 */
Simon Hunt0e161092017-05-08 17:41:38 -070041 public UiSynthLink(RegionId regionId, UiLink link, UiLink original) {
Simon Huntc13082f2016-08-03 21:20:23 -070042 this.regionId = regionId;
43 this.link = link;
Simon Hunt0e161092017-05-08 17:41:38 -070044 this.original = original;
Simon Huntc13082f2016-08-03 21:20:23 -070045 }
46
47 @Override
48 public String toString() {
49 return toStringHelper(this)
50 .add("region", regionId)
51 .add("link", link)
Simon Hunt0e161092017-05-08 17:41:38 -070052 .add("original", original)
Simon Huntc13082f2016-08-03 21:20:23 -070053 .toString();
54 }
55
56 /**
57 * Returns the region identifier.
58 *
59 * @return the region ID
60 */
61 public RegionId regionId() {
62 return regionId;
63 }
64
65 /**
66 * Returns the link.
67 *
68 * @return the link
69 */
70 public UiLink link() {
71 return link;
72 }
Simon Hunt0e161092017-05-08 17:41:38 -070073
74 /**
75 * Returns the original link from which this was derived.
76 *
77 * @return the original link
78 */
79 public UiLink original() {
80 return original;
81 }
Simon Huntc13082f2016-08-03 21:20:23 -070082}