org.obolibrary.oboformat.model.Xref Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of owlapi-oboformat Show documentation
Show all versions of owlapi-oboformat Show documentation
A java library for converting obo format documents to OWL, and for converting (a subset of) OWL to obo format. This version has been slightly modified to be included directly in the OWL API.
The upstream code for this module and its authors can be found at https://code.google.com/p/oboformat/.
package org.obolibrary.oboformat.model;
import javax.annotation.Nullable;
/**
* Xref.
*/
public class Xref {
protected String idref;
@Nullable
protected String annotation;
/**
* @param idref idref
*/
public Xref(String idref) {
this.idref = idref;
}
/**
* @return idref
*/
public String getIdref() {
return idref;
}
/**
* @param idref idref
*/
public void setIdref(String idref) {
this.idref = idref;
}
/**
* @return annotation
*/
@Nullable
public String getAnnotation() {
return annotation;
}
/**
* @param annotation annotation
*/
public void setAnnotation(String annotation) {
this.annotation = annotation;
}
@Override
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof Xref)) {
return false;
}
if (obj == this) {
return true;
}
Xref other = (Xref) obj;
if (!idref.equals(other.idref)) {
return false;
}
// if (false) {
// // TODO: make this configurable?
// // xref comments are treated as semi-invisible
// if (annotation == null && other.annotation == null) {
// return true;
// }
// if (annotation == null || other.annotation == null) {
// return false;
// }
// return annotation.equals(other.annotation);
// }
return true;
}
@Override
public int hashCode() {
return idref.hashCode();
}
@Override
public String toString() {
if (annotation == null) {
return idref;
}
return '<' + idref + " \"" + annotation + "\">";
}
}