Committed by
Gerrit Code Review
Add method to create LinkKey for LinkDescription
Change-Id: Iaf8854d349ecd89ae901b76a38f173512eaacb63
Showing
1 changed file
with
12 additions
and
0 deletions
| ... | @@ -19,6 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -19,6 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | 19 | ||
| 20 | import java.util.Objects; | 20 | import java.util.Objects; |
| 21 | 21 | ||
| 22 | +import org.onosproject.net.link.LinkDescription; | ||
| 23 | + | ||
| 22 | import com.google.common.base.MoreObjects; | 24 | import com.google.common.base.MoreObjects; |
| 23 | 25 | ||
| 24 | // TODO Consider renaming. | 26 | // TODO Consider renaming. |
| ... | @@ -82,6 +84,16 @@ public final class LinkKey { | ... | @@ -82,6 +84,16 @@ public final class LinkKey { |
| 82 | return new LinkKey(link.src(), link.dst()); | 84 | return new LinkKey(link.src(), link.dst()); |
| 83 | } | 85 | } |
| 84 | 86 | ||
| 87 | + /** | ||
| 88 | + * Creates a link identifier for the specified link. | ||
| 89 | + * | ||
| 90 | + * @param link {@link Description} | ||
| 91 | + * @return a link identifier | ||
| 92 | + */ | ||
| 93 | + public static LinkKey linkKey(LinkDescription link) { | ||
| 94 | + return new LinkKey(link.src(), link.dst()); | ||
| 95 | + } | ||
| 96 | + | ||
| 85 | @Override | 97 | @Override |
| 86 | public int hashCode() { | 98 | public int hashCode() { |
| 87 | return Objects.hash(src, dst); | 99 | return Objects.hash(src, dst); | ... | ... |
-
Please register or login to post a comment