3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
13 * @brief Describe an edge in network made of multiple SDN technologies
15 * Class that describe an Edge connecting two NodeConnector, the edge
16 * is directed because there is the head and the tail concept which
17 * implies a direction.
19 package org.opendaylight.controller.sal.core;
21 import java.io.Serializable;
22 import org.apache.commons.lang3.builder.HashCodeBuilder;
23 import org.apache.commons.lang3.builder.EqualsBuilder;
25 import javax.xml.bind.annotation.XmlRootElement;
26 import javax.xml.bind.annotation.XmlAccessType;
27 import javax.xml.bind.annotation.XmlAccessorType;
28 import javax.xml.bind.annotation.XmlElement;
32 * Class that describe an Edge connecting two NodeConnector, the edge
33 * is directed because there is the tail and the head concept which
34 * implies a direction.
38 @XmlAccessorType(XmlAccessType.NONE)
39 public class Edge implements Serializable {
40 private static final long serialVersionUID = 1L;
42 private NodeConnector tailNodeConnector;
44 private NodeConnector headNodeConnector;
47 * Private constructor used for JAXB mapping
50 this.tailNodeConnector = null;
51 this.headNodeConnector = null;
57 * @param tailNodeConnector Tail Node output connector
58 * @param headNodeConnector Head Node input connector
61 public Edge(NodeConnector tailNodeConnector, NodeConnector headNodeConnector)
62 throws ConstructionException {
63 if (tailNodeConnector == null || headNodeConnector == null) {
64 throw new ConstructionException(
65 "Null tail or head NodeConnector supplied");
67 this.tailNodeConnector = tailNodeConnector;
68 this.headNodeConnector = headNodeConnector;
73 * Copy Construct the Edge
75 * @param src Edge to copy from
78 public Edge(Edge src) throws ConstructionException {
80 this.tailNodeConnector = new NodeConnector(src
81 .getTailNodeConnector());
82 this.headNodeConnector = new NodeConnector(src
83 .getHeadNodeConnector());
85 throw new ConstructionException("src supplied was null");
93 * @return tail NodeConnector of the edge
95 public NodeConnector getTailNodeConnector() {
96 return tailNodeConnector;
102 * @param tailNodeConnector NodeConnector to set the tail
104 public void setTailNodeConnector(NodeConnector tailNodeConnector) {
105 this.tailNodeConnector = tailNodeConnector;
112 * @return head NodeConnector of the edge
114 public NodeConnector getHeadNodeConnector() {
115 return headNodeConnector;
121 * @param headNodeConnector NodeConnector to set the head
123 public void setHeadNodeConnector(NodeConnector headNodeConnector) {
124 this.headNodeConnector = headNodeConnector;
128 public int hashCode() {
129 return HashCodeBuilder.reflectionHashCode(this);
133 public boolean equals(Object obj) {
134 return EqualsBuilder.reflectionEquals(this, obj);
138 public String toString() {
139 return "(" + this.tailNodeConnector + "->" + this.headNodeConnector