@SuppressWarnings("unchecked") public void visit() { Vertex<String> parent = getParent(this); Set<Vertex<String>> children = getChildren(this); if (log.isTraceEnabled()) log.trace("Structure visit, parent: " + parent + ", children: " + children); visit((T)parent, children); }
/** * Get previous from vertex param. * * @param vertex the vertex * @return previous vertex */ protected static Vertex<String> getPrevious(Vertex<String> vertex) { return getParent(vertex); }
/** * Get the last token. * * @return last token string */ protected String getLastToken() { if (lastToken == null) { String fullName = getName(); int p = fullName.lastIndexOf('.') + 1; lastToken = fullName.substring(p); } return lastToken; }
/** * Get the next vertex. * * @param vertex the vertex * @return next vertex */ protected static Vertex<String> getNext(Vertex<String> vertex) { Set<Vertex<String>> children = getChildren(vertex); if (children.isEmpty()) return null; if (children.size() > 1) throw new IllegalArgumentException("Multiple children: " + vertex); return children.iterator().next(); }