public Node createAndNode(final Set<Node> inputs) { if (inputs.isEmpty()) throw new IllegalArgumentException(); if (inputs.contains(getNullNode())) return getNullNode(); inputs.remove(getStartNode()); final int size = inputs.size(); if (size == 0) return getStartNode(); else if (size == 1) return inputs.iterator().next(); final AndNode andNode = new AndNode(_id++); for (final Node input : inputs) input.addOutput(andNode); return andNode; }
public Node createAndNode(final Set<Node> inputs) { if (inputs.isEmpty()) throw new IllegalArgumentException(); if (inputs.contains(getNullNode())) return getNullNode(); inputs.remove(getStartNode()); final int size = inputs.size(); if (size == 0) return getStartNode(); else if (size == 1) return inputs.iterator().next(); final AndNode andNode = new AndNode(_id++); for (final Node input : inputs) input.addOutput(andNode); return andNode; }
public Node createOrNode(final Set<Node> inputs) { if (inputs.isEmpty()) throw new IllegalArgumentException(); if (inputs.contains(getStartNode())) return getStartNode(); inputs.remove(getNullNode()); final int size = inputs.size(); if (size == 0) return getNullNode(); else if (size == 1) return inputs.iterator().next(); final OrNode orNode = new OrNode(_id++); for (final Node input : inputs) input.addOutput(orNode); return orNode; }
public Node createOrNode(final Set<Node> inputs) { if (inputs.isEmpty()) throw new IllegalArgumentException(); if (inputs.contains(getStartNode())) return getStartNode(); inputs.remove(getNullNode()); final int size = inputs.size(); if (size == 0) return getNullNode(); else if (size == 1) return inputs.iterator().next(); final OrNode orNode = new OrNode(_id++); for (final Node input : inputs) input.addOutput(orNode); return orNode; }
private class TopEvaluator implements OWLClassExpressionVisitor { private Node _node; public TopEvaluator() { } public Node evaluate(final OWLClassExpression desc) { // reset the result first _node = null; desc.accept(this); // a null value indicates error if (_node == null) throw new IllegalStateException("Evaluation returned null"); return _node; } @Override public void visit(final OWLClass desc) { _node = desc.equals(OWL.Thing) ? NULL_NODE : START_NODE; } @Override
private class TopEvaluator implements OWLClassExpressionVisitor { private Node _node; public TopEvaluator() { } public Node evaluate(final OWLClassExpression desc) { // reset the result first _node = null; desc.accept(this); // a null value indicates error if (_node == null) throw new IllegalStateException("Evaluation returned null"); return _node; } @Override public void visit(final OWLClass desc) { _node = desc.equals(OWL.Thing) ? NULL_NODE : START_NODE; } @Override