All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.obolibrary.oboformat.model.QualifierValue Maven / Gradle / Ivy

Go to download

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/.

There is a newer version: 5.5.1
Show newest version
package org.obolibrary.oboformat.model;

import javax.annotation.Nullable;

/**
 * Qualifier value.
 */
public class QualifierValue implements Comparable {

    protected String qualifier;
    protected String value;

    /**
     * @param q qualifier
     * @param v value
     */
    public QualifierValue(String q, String v) {
        qualifier = q;
        value = v;
    }

    /**
     * @return qualifier
     */
    public String getQualifier() {
        return qualifier;
    }

    /**
     * @param qualifier qualifier
     */
    public void setQualifier(String qualifier) {
        this.qualifier = qualifier;
    }

    /**
     * @return value
     */
    public String getValue() {
        return value;
    }

    /**
     * @param value value
     */
    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return '{' + qualifier + '=' + value + '}';
    }

    @Override
    public int hashCode() {
        int prime = 31;
        int result = 1;
        result = prime * result + qualifier.hashCode();
        result = prime * result + value.hashCode();
        return result;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof QualifierValue)) {
            return false;
        }
        QualifierValue other = (QualifierValue) obj;
        if (!qualifier.equals(other.qualifier)) {
            return false;
        }
        if (!value.equals(other.value)) {
            return false;
        }
        return true;
    }

    @Override
    public int compareTo(@Nullable QualifierValue o) {
        if (o == null) {
            return 1;
        }
        // use toString representation
        return toString().compareTo(o.toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy