package org.opennaas.extensions.vcpe.model;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlIDREF;
@XmlAccessorType(XmlAccessType.FIELD)
public class Link extends VCPENetworkElement {
/**
* lt, autobahn link, eth, etc.
*/
private String type;
/**
* used to store Autobahn id
*/
private String id;
@XmlIDREF
private List<Link> implementedBy;
@XmlIDREF
private Interface source;
@XmlIDREF
private Interface sink;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<Link> getImplementedBy() {
return implementedBy;
}
public void setImplementedBy(List<Link> implementedBy) {
this.implementedBy = implementedBy;
}
public Interface getSource() {
return source;
}
public void setSource(Interface source) {
this.source = source;
}
public Interface getSink() {
return sink;
}
public void setSink(Interface sink) {
this.sink = sink;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((implementedBy == null) ? 0 : implementedBy.hashCode());
result = prime * result + ((sink == null) ? 0 : sink.hashCode());
result = prime * result + ((source == null) ? 0 : source.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
Link other = (Link) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (templateName == null) {
if (other.templateName != null)
return false;
} else if (!templateName.equals(other.templateName))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (implementedBy == null) {
if (other.implementedBy != null)
return false;
} else if (!implementedBy.equals(other.implementedBy))
return false;
if (sink == null) {
if (other.sink != null)
return false;
} else if (!sink.equals(other.sink))
return false;
if (source == null) {
if (other.source != null)
return false;
} else if (!source.equals(other.source))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
}