Search in sources :

Example 1 with NoopTreeVisitor

use of com.b2international.commons.tree.NoopTreeVisitor in project snow-owl by b2ihealthcare.

the class SnomedEclLabelerRequest method expand.

private void expand(ExpressionConstraint constraint, final Map<String, String> labels) {
    EObjectWalker.createContainmentWalker(new NoopTreeVisitor<EObjectTreeNode>() {

        @Override
        protected void doVisit(EObjectTreeNode node) {
            if (node.getEObject() instanceof EclConceptReference) {
                EclConceptReference ref = (EclConceptReference) node.getEObject();
                String label = labels.get(ref.getId());
                // if the given label is not the concept's ID then set the label
                if (!Objects.equals(ref.getId(), label)) {
                    ref.setTerm(label);
                }
            // TODO report missing labels?
            }
        }
    }).walk(constraint);
}
Also used : EclConceptReference(com.b2international.snomed.ecl.ecl.EclConceptReference) EObjectTreeNode(com.b2international.snowowl.core.emf.EObjectTreeNode) NoopTreeVisitor(com.b2international.commons.tree.NoopTreeVisitor)

Example 2 with NoopTreeVisitor

use of com.b2international.commons.tree.NoopTreeVisitor in project snow-owl by b2ihealthcare.

the class SnomedEclLabelerRequest method collect.

private Set<String> collect(ExpressionConstraint constraint) {
    final Set<String> conceptIds = Sets.newHashSet();
    EObjectWalker.createContainmentWalker(new NoopTreeVisitor<EObjectTreeNode>() {

        @Override
        protected void doVisit(EObjectTreeNode node) {
            if (node.getEObject() instanceof EclConceptReference) {
                EclConceptReference ref = (EclConceptReference) node.getEObject();
                conceptIds.add(ref.getId());
            }
        }
    }).walk(constraint);
    return conceptIds;
}
Also used : EclConceptReference(com.b2international.snomed.ecl.ecl.EclConceptReference) EObjectTreeNode(com.b2international.snowowl.core.emf.EObjectTreeNode) NoopTreeVisitor(com.b2international.commons.tree.NoopTreeVisitor)

Aggregations

NoopTreeVisitor (com.b2international.commons.tree.NoopTreeVisitor)2 EclConceptReference (com.b2international.snomed.ecl.ecl.EclConceptReference)2 EObjectTreeNode (com.b2international.snowowl.core.emf.EObjectTreeNode)2