org.erasmusmc.data_mining.ontology.common.TermIdImpl Maven / Gradle / Ivy
The newest version!
/**
* Peregrine is an indexing engine that can recognize concepts in human readable
* text, based on a database (thesaurus) of known terms.
*
* Copyright 2005-2011 Erasmus University Medical Centre (EMC)
* Copyright 2009-2011 Netherlands Bioinformatics Centre (NBIC)
*
* Contact us at: [email protected]
*
* This file is part of Peregrine. Peregrine is free software: you can
* redistribute it and/or modify it under the terms of the GNU Affero General
* Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.erasmusmc.data_mining.ontology.common;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.erasmusmc.data_mining.ontology.api.Term.Id;
/**
* Java class for termId complex type.
*
* The following schema fragment specifies the expected content contained
* within this class.
*
* <complexType name="termId">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="termId" use="required"
* type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="conceptId" use="required"
* type="{http://www.w3.org/2001/XMLSchema}int" />
* </restriction>
* </complexContent>
* </complexType>
*
*
* NOTE: this class was generated once and then excluded from the
* generation process.
*/
// TODO find out why this class cannot be generated.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "termId",
namespace = "http://ontology.biosemantic.erasmusmc.org/")
public final class TermIdImpl
implements Id, Comparable, Serializable {
/**
* Version of this class for serialization purposes.
*/
private static final long serialVersionUID = 1L;
/**
* The identifier of the term that is linked to this Id.
*/
@XmlAttribute(required = true)
private int termId;
/**
* The identifier of the concept that is linked to this Id.
*/
@XmlAttribute(required = true)
private int conceptId;
/**
* Default constructor.
*/
public TermIdImpl() {
super();
}
/**
* Constructor.
*
* @param term The identifier of the term that is linked to this Id.
* @param concept The identifier of the concept that is linked to this Id.
*/
public TermIdImpl(final int term, final int concept) {
this.termId = term;
this.conceptId = concept;
}
/**
* Get the identifier of the term that is linked to this Id.
*
* @return the identifer of the term.
*/
public int getTermId() {
return termId;
}
/**
* Set the identifier of the term that is lined to this Id.
*
* @param value the identifier of the term.
*/
public void setTermId(final int value) {
this.termId = value;
}
@Override
public Integer getConceptId() {
return conceptId;
}
/**
* Set the identifier of the concept that is linked to this Id.
*
* @param value The identifier of the concept.
*/
public void setConceptId(final int value) {
this.conceptId = value;
}
/**
* Fluent API builder method to get an instance with the term identifier
* set.
*
* @param value The identifier of the term.
* @return The instance with the identifier of the term set.
*/
public TermIdImpl withTermId(final int value) {
setTermId(value);
return this;
}
/**
* Fluent API builder method to get an instance with the concept identifier
* set.
*
* @param value The identifier of the concept.
* @return The instance with the identifier of the concept set.
*/
public TermIdImpl withConceptId(final int value) {
setConceptId(value);
return this;
}
@Override
public int compareTo(final TermIdImpl id) {
int diff = conceptId - id.conceptId;
if (diff != 0) {
return diff;
}
return termId - id.termId;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this,
ToStringStyle.SHORT_PREFIX_STYLE);
}
@Override
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
public boolean equals(final Object that) {
return EqualsBuilder.reflectionEquals(this, that);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy