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

au.csiro.ontology.Node Maven / Gradle / Ivy

The newest version!
/**
 * Copyright CSIRO Australian e-Health Research Centre (http://aehrc.com).
 * All rights reserved. Use is subject to license terms and conditions. 
 */
package au.csiro.ontology;

import java.io.Serializable;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Represents a node in the taxonomy generated after classifying an ontology.
 * 
 * @author Alejandro Metke
 * 
 */
public class Node implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * Set of equivalent concepts in this node.
     */
    protected final Set equivalentConcepts = Collections.newSetFromMap(
            new ConcurrentHashMap());
    
    /**
     * Set of parents nodes.
     */
    protected final Set parents = Collections.newSetFromMap(
            new ConcurrentHashMap());
    
    /**
     * Set of child nodes.
     */
    protected final Set children = Collections.newSetFromMap(
            new ConcurrentHashMap());

    /**
     * @return the equivalentConcepts
     */
    public Set getEquivalentConcepts() {
        return equivalentConcepts;
    }

    /**
     * @return the parents
     */
    public Set getParents() {
        return parents;
    }

    /**
     * @return the children
     */
    public Set getChildren() {
        return children;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        int size = equivalentConcepts.size();
        int i = 0;
        sb.append("{");
        for (String equiv : equivalentConcepts) {
            sb.append(equiv);
            if (++i < size)
                sb.append(", ");
        }
        sb.append("}");
        return sb.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy