public Edge addSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null || source.getBelongsToGraph() != this || target.getBelongsToGraph() != this) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { Edge e = edgePool.checkOut(); e.setBelongsToGraph(this); e.setEdge((Node)source, (Node)target, Edge.SECONDARY_EDGE); graphEdges.add(e); return e; } return null; }
if (this.index < that.getCompareToIndex()) return BEFORE; if (this.index > that.getCompareToIndex()) return AFTER; return super.compareTo(that); try { final int thisLCorner = this.index; final int thatLCorner = that.getLeftmostProperDescendantIndex(); final int thisRCorner = this.index; final int thatRCorner = that.getRightmostProperDescendantIndex(); if (this.index < that.getCompareToIndex()) return BEFORE; if (this.index > that.getCompareToIndex()) return AFTER; return super.compareTo(that);
public void removeSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { final Iterator<Edge> ie = ((Node)target).getIncomingEdgeIterator(); while (ie.hasNext()) { Edge e = ie.next(); if (e.getSource() == source) { ie.remove(); graphEdges.remove(e); edgePool.checkIn(e); } } } }
try { final int thisLCorner = this.getLeftmostProperDescendantIndex(); final int thatLCorner = (o instanceof TokenNode)?o.getCompareToIndex():o.getLeftmostProperDescendantIndex(); final int thisRCorner = this.getRightmostProperDescendantIndex(); final int thatRCorner = (o instanceof TokenNode)?o.getCompareToIndex():o.getRightmostProperDescendantIndex(); if (0 < o.getCompareToIndex()) return BEFORE; if (0 > o.getCompareToIndex()) return AFTER; return super.compareTo(o);
public void removeSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { Iterator<Edge> ie = ((Node)target).getIncomingEdgeIterator(); while (ie.hasNext()) { Edge e = ie.next(); if (e.getSource() == source) { ie.remove(); graphEdges.remove(e); edgePool.checkIn(e); } } } }
try { final int thisLCorner = this.getLeftmostProperDescendantIndex(); final int thatLCorner = (o instanceof TokenNode)?o.getCompareToIndex():o.getLeftmostProperDescendantIndex(); final int thisRCorner = this.getRightmostProperDescendantIndex(); final int thatRCorner = (o instanceof TokenNode)?o.getCompareToIndex():o.getRightmostProperDescendantIndex(); if (this.getCompareToIndex() < o.getCompareToIndex()) return BEFORE; if (this.getCompareToIndex() > o.getCompareToIndex()) return AFTER; return super.compareTo(o);
@Override public int getRightmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getRightmostProperDescendant(); return (node != null)?node.getIndex():-1; }
public void removeSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null || source.getBelongsToGraph() != this || target.getBelongsToGraph() != this) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { Iterator<Edge> ie = ((Node)target).getIncomingEdgeIterator(); while (ie.hasNext()) { Edge e = ie.next(); if (e.getSource() == source) { ie.remove(); graphEdges.remove(e); edgePool.checkIn(e); } } } }
public Edge addSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { Edge e = edgePool.checkOut(); e.setBelongsToGraph(this); e.setEdge((Node)source, (Node)target, Edge.SECONDARY_EDGE); graphEdges.add(e); return e; } return null; }
@Override public int getLeftmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getLeftmostProperDescendant(); return (node != null)?node.getIndex():-1; } @Override
public Edge addSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target.isRoot()) { Edge e = edgePool.checkOut(); e.setBelongsToGraph(this); e.setEdge((Node)source, (Node)target, Edge.SECONDARY_EDGE); graphEdges.add(e); return e; } return null; }
public int getLeftmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getLeftmostProperDescendant(); return (node != null)?node.getIndex():-1; }
public int getRightmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getRightmostProperDescendant(); return (node != null)?node.getIndex():-1; }
@Override public ComparableNode getLeftmostProperDescendant() throws MaltChainedException { ComparableNode candidate = null; List<DependencyNode> dependents = graph.getListOfDependents(index); for (int i = 0; i < dependents.size(); i++) { final DependencyNode dep = dependents.get(i); if (candidate == null || dep.getIndex() < candidate.getIndex()) { candidate = dep; } final ComparableNode tmp = dep.getLeftmostProperDescendant(); if (tmp == null) { continue; } if (candidate == null || tmp.getIndex() < candidate.getIndex()) { candidate = tmp; } if (candidate.getIndex() == 1) { return candidate; } } return candidate; }
if (candidate == null) { candidate = ldep; } else if (ldep.getIndex() < candidate.getIndex() ) { candidate = ldep; } else if (tmp.getIndex() < candidate.getIndex() ) { candidate = tmp; if (candidate.getIndex() == 1) { return candidate; if (candidate == null) { candidate = rdep; } else if (rdep.getIndex() < candidate.getIndex() ) { candidate = rdep; } else if (tmp.getIndex() < candidate.getIndex() ) { candidate = tmp; if (candidate.getIndex() == 1) { return candidate;
if (candidate == null) { candidate = ldep; } else if (ldep.getIndex() < candidate.getIndex() ) { candidate = ldep; } else if (tmp.getIndex() < candidate.getIndex() ) { candidate = tmp; if (candidate.getIndex() == 1) { return candidate; if (candidate == null) { candidate = rdep; } else if (rdep.getIndex() < candidate.getIndex() ) { candidate = rdep; } else if (tmp.getIndex() < candidate.getIndex() ) { candidate = tmp; if (candidate.getIndex() == 1) { return candidate;
@Override public ComparableNode getLeftmostDescendant() throws MaltChainedException { ComparableNode candidate = this; List<DependencyNode> dependents = graph.getListOfDependents(index); for (int i = 0; i < dependents.size(); i++) { final DependencyNode dep = dependents.get(i); if (dep.getIndex() < candidate.getIndex()) { candidate = dep; } final ComparableNode tmp = dep.getLeftmostDescendant(); if (tmp == null) { continue; } if (tmp.getIndex() < candidate.getIndex()) { candidate = tmp; } if (candidate.getIndex() == 1) { return candidate; } } return candidate; }
if (candidate == null) { candidate = ldep; } else if (ldep.getIndex() > candidate.getIndex() ) { candidate = ldep; } else if (tmp.getIndex() > candidate.getIndex() ) { candidate = tmp; if (candidate == null) { candidate = rdep; } else if (rdep.getIndex() > candidate.getIndex() ) { candidate = rdep; } else if (tmp.getIndex() > candidate.getIndex() ) { candidate = tmp;
@Override public ComparableNode getRightmostDescendant() throws MaltChainedException { ComparableNode candidate = this; List<DependencyNode> dependents = graph.getListOfDependents(index); for (int i = 0; i < dependents.size(); i++) { final DependencyNode dep = dependents.get(i); if (dep.getIndex() > candidate.getIndex() ) { candidate = dep; } final ComparableNode tmp = dep.getRightmostDescendant(); if (tmp == null) { continue; } if (tmp.getIndex() > candidate.getIndex() ) { candidate = tmp; } } return candidate; }