protected Node findOverridingNode(final Node superNode, final Node[] nodes, final String nodeType, final Map<String, String> idAttributes) { // get the name of the attribute that identify the one sub node of // type 'nodeType' among others. final String nameAttr = idAttributes.get(nodeType); if (nameAttr != null) { // get the value of attribute 'nameAttr' of node 'superNode' final String superName = superNode.astGetAttributes().get(nameAttr); // Check that the value is not null if (superName != null) { // for each node in 'Nodes' for (final Node node : nodes) { // get the value of attribute 'nameAttr' of node 'node' final String name = node.astGetAttributes().get(nameAttr); // Check that the value is not null if (name == null) continue; if (name.equals(superName)) { return node; } } } } return null; }
protected void interpolate(final Node node) { final Map<String, String> attributes = node.astGetAttributes(); for (final Map.Entry<String, String> attribute : attributes.entrySet()) { if (attribute.getValue() != null) attribute.setValue(interpolate(node, attribute.getValue())); } node.astSetAttributes(attributes); for (final String subNodeType : node.astGetNodeTypes()) { for (final Node subNode : node.astGetNodes(subNodeType)) { if (subNode != null) interpolate(subNode); } } }
w.write('<'); w.write(node.astGetType()); final Map attrs = node.astGetAttributes(); final Iterator i = attrs.keySet().iterator(); while (i.hasNext()) {
final Map<String, String> resultAttrs = elem.astGetAttributes(); for (final Map.Entry<String, String> entry : superNode.astGetAttributes() .entrySet()) { final String name = entry.getKey();
newNode.astSetAttributes(node.astGetAttributes());
@SuppressWarnings("unchecked") private static <T extends Node> T cloneNodeState(final T node) { // first create a new node instance final T newNode = (T) node.astNewInstance(); // copy node attributes newNode.astSetAttributes(node.astGetAttributes()); // copy node decoration newNode.astSetDecorations(node.astGetDecorations()); // copy source newNode.astSetSource(node.astGetSource()); return newNode; }