Example usage for javax.swing.tree TreeNode equals

List of usage examples for javax.swing.tree TreeNode equals

Introduction

In this page you can find the example usage for javax.swing.tree TreeNode equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:edu.emory.cci.aiw.i2b2etl.dest.metadata.Metadata.java

private void setI2B2PathsToConcepts() throws OntologyBuildException {
    Map<String, List<String>> result;
    if (this.metaConnectionSpec != null) {
        try (QueryExecutor qe = new QueryExecutor(this.metaConnectionSpec.getOrCreate(), ALL_CONCEPTS_QUERY,
                new TableAccessReader(this.metaConnectionSpec.getDatabaseProduct(),
                        this.settings.getMetaTableName()))) {
            result = qe.execute(new ResultSetReader<Map<String, List<String>>>() {

                @Override/*from  ww w. j  a  v a2 s  . c  o m*/
                public Map<String, List<String>> read(ResultSet rs) throws KnowledgeSourceReadException {
                    Map<String, List<String>> result = new HashMap<>();
                    if (rs != null) {
                        try {
                            while (rs.next()) {
                                Collections.putList(result, rs.getString(1), rs.getString(2));
                            }
                        } catch (SQLException ex) {
                            throw new KnowledgeSourceReadException(ex);
                        }
                    }
                    return result;
                }
            });
        } catch (KnowledgeSourceReadException | SQLException ex) {
            throw new OntologyBuildException(ex);
        }
    } else {
        result = new HashMap<>();
    }
    for (Concept c : getAllRoots()) {
        @SuppressWarnings("unchecked")
        Enumeration<Concept> emu = c.preorderEnumeration();
        boolean isInPhenotypes = false;
        while (emu.hasMoreElements()) {
            Concept concept = emu.nextElement();
            TreeNode parent = concept.getParent();
            if (parent != null && parent.equals(c)) {
                isInPhenotypes = false;
            }
            if (concept.getSymbol().equals("AIW|Phenotypes")) {
                isInPhenotypes = true;
            }
            Concept conceptFromCache = getFromIdCache(concept.getId());
            if (conceptFromCache != null
                    && (isInPhenotypes || !result.containsKey(conceptFromCache.getSymbol()))) {
                conceptFromCache.addHierarchyPath(concept.getFullName());
            }
            if (conceptFromCache != null) {
                List<String> get = result.get(concept.getSymbol());
                if (get != null) {
                    for (String hp : get) {
                        conceptFromCache.addHierarchyPath(hp);
                    }
                }
            }
        }
    }
}