Пример #1
0
 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);
   }
 }
Пример #2
0
 public OclRoot getFeature(String name, Object[] params) {
   if (name.equals("toString") && (params == null || params.length == 0)) {
     return new OclString(node.toString().trim());
   }
   return super.getFeature(name, params);
 }