address.setAddress(null);
} else {
// try {
// a.getAddressClass().asSubclass(org.maltparser.core.syntaxgraph.node.DependencyNode.class);
final DependencyNode node = (DependencyNode)a.getAddress();
if (subFunction == DGraphSubFunction.HEAD && !node.isRoot()) {
address.setAddress(node.getHead());
} else if (subFunction == DGraphSubFunction.LDEP) {
address.setAddress(node.getLeftmostDependent());
} else if (subFunction == DGraphSubFunction.RDEP) {
address.setAddress(node.getRightmostDependent());
} else if (subFunction == DGraphSubFunction.RDEP2) {
// To emulate the behavior of MaltParser 0.4 (bug)
if (!node.isRoot()) {
address.setAddress(node.getRightmostDependent());
} else {
address.setAddress(null);
}
} else if (subFunction == DGraphSubFunction.LSIB) {
address.setAddress(node.getSameSideLeftSibling());
} else if (subFunction == DGraphSubFunction.RSIB) {
address.setAddress(node.getSameSideRightSibling());
} else if ((subFunction == DGraphSubFunction.PRED || subFunction == DGraphSubFunction.SUCC) && node instanceof TokenNode) {
final TokenNode tokenNode = (TokenNode)node;
if (subFunction == DGraphSubFunction.PRED) {
address.setAddress(tokenNode.getPredecessor());
} else if (subFunction == DGraphSubFunction.SUCC) {
address.setAddress(tokenNode.getSuccessor());
}
} else if (subFunction == DGraphSubFunction.ANC) {
address.setAddress(node.getAncestor());
} else if (subFunction == DGraphSubFunction.PANC) {
address.setAddress(node.getProperAncestor());
} else if (subFunction == DGraphSubFunction.LDESC) {
address.setAddress(node.getLeftmostDescendant());
} else if (subFunction == DGraphSubFunction.PLDESC) {
address.setAddress(node.getLeftmostProperDescendant());
} else if (subFunction == DGraphSubFunction.RDESC) {
address.setAddress(node.getRightmostDescendant());
} else if (subFunction == DGraphSubFunction.PRDESC) {
address.setAddress(node.getRightmostProperDescendant());
} else {
address.setAddress(null);
}
// } catch (ClassCastException e) {
// address.setAddress(null);