/** * Returns a set of parent nodes which consist of the immediate * parent of the specified node and any of its parent which * share the same syntactic type. * @param node The node whose parents are to be returned. * @return a set of parent nodes. */ private Map<Parse, Integer> getNonAdjoinedParent(Parse node) { Map<Parse, Integer> parents = new HashMap<>(); Parse parent = node.getParent(); int index = indexOf(node,parent); parents.put(parent, index); while (parent.getType().equals(node.getType())) { node = parent; parent = parent.getParent(); index = indexOf(node,parent); parents.put(parent, index); } return parents; }
/** * Returns a set of parent nodes which consist of the immediate * parent of the specified node and any of its parent which * share the same syntactic type. * @param node The node whose parents are to be returned. * @return a set of parent nodes. */ private Map<Parse, Integer> getNonAdjoinedParent(Parse node) { Map<Parse, Integer> parents = new HashMap<>(); Parse parent = node.getParent(); int index = indexOf(node,parent); parents.put(parent, index); while (parent.getType().equals(node.getType())) { node = parent; parent = parent.getParent(); index = indexOf(node,parent); parents.put(parent, index); } return parents; }
/** * Returns a set of parent nodes which consist of the immediate * parent of the specified node and any of its parent which * share the same syntactic type. * @param node The node whose parents are to be returned. * @return a set of parent nodes. */ private Map<Parse, Integer> getNonAdjoinedParent(Parse node) { Map<Parse, Integer> parents = new HashMap<>(); Parse parent = node.getParent(); int index = indexOf(node,parent); parents.put(parent, index); while (parent.getType().equals(node.getType())) { node = parent; parent = parent.getParent(); index = indexOf(node,parent); parents.put(parent, index); } return parents; }