public OclRoot getFeature(String name) { if (name.equals("boundNames")) { HashSet boundNames = tree.getBoundNames(node); HashSet result = new HashSet(); Iterator iter = boundNames.iterator(); while (iter.hasNext()) { String s = (String) iter.next(); result.add(new OclString((String) s)); } return new OclSet(result); } else if (name.equals("subnodes")) { SubnodeCollector sc = new SubnodeCollector(node); node.apply(sc); return new OclSet(sc.subnodes); } else if (name.equals("supernodes")) { HashSet result = new HashSet(); Node parent = node.parent(); while (parent != null) { result.add(new SableOclAnyImpl(parent, tree)); parent = parent.parent(); } return new OclSet(result); } else { return super.getFeature(name); } }
public void defaultIn(Node n) { if (node != n) { subnodes.add(Ocl.getOclRepresentationFor(n)); } }