@Test public void testIncludeResolution() throws Exception { String include1 = "namespace foo.inc1;\n$myV = 3;\nexport $myV to *;"; String include2 = "namespace foo.inc2;\n$myV = 3;\nexport $myV to *;"; String script = "namespace foo.script;\nimport foo.inc1;\nimport foo.inc2;\n $myV = $foo.inc1.myV + $foo.inc2.myV; export $myV to *;"; Model mo = new DefaultModel(); ScriptBuilder builder = new ScriptBuilder(10, mo); BasicIncludes bi = new BasicIncludes(); Script scr1 = builder.build(include1); Script scr2 = builder.build(include2); bi.add(scr1); bi.add(scr2); builder.setIncludes(bi); builder.build(script); }
public boolean add(Collection<BtrpElement> elems) { boolean ret = false; for (BtrpElement el : elems) { ret |= add(el); } return ret; }
Script { public boolean add(Collection<BtrpElement> elems) { boolean ret = false; for (BtrpElement el : elems) { ret |= add(el); } return ret; } }
Script { public boolean add(Collection<BtrpElement> elems) { boolean ret = false; for (BtrpElement el : elems) { ret |= add(el); } return ret; } Script(); }
Script { public boolean add(Collection<BtrpElement> elems) { boolean ret = false; for (BtrpElement el : elems) { ret |= add(el); } return ret; } Script(); void setFullyQualifiedName(String n); String getNamespace(); String getlocalName(); String id(); Set<VM> getVMs(); Set<Node> getNodes(); boolean addConstraint(SatConstraint c); Set<SatConstraint> getConstraints(); boolean add(Collection<BtrpElement> elems); boolean add(BtrpElement el); List<BtrpOperand> getImportables(String ns); BtrpOperand getImportable(String label, String namespace); BtrpOperand getImportable(String label); boolean canImport(String label, String namespace); void addExportable(String name, BtrpOperand e, Set<String> scopes); String fullyQualifiedSymbolName(String name); Set<String> getExported(); List<Script> getDependencies(); @Override String toString(); String prettyDependencies(); }
Script { public boolean add(Collection<BtrpElement> elems) { boolean ret = false; for (BtrpElement el : elems) { ret |= add(el); } return ret; } Script(); void setFullyQualifiedName(String n); String getNamespace(); String getlocalName(); String id(); Set<VM> getVMs(); Set<Node> getNodes(); boolean addConstraint(SatConstraint c); Set<SatConstraint> getConstraints(); boolean add(Collection<BtrpElement> elems); boolean add(BtrpElement el); List<BtrpOperand> getImportables(String ns); BtrpOperand getImportable(String label, String namespace); BtrpOperand getImportable(String label); boolean canImport(String label, String namespace); void addExportable(String name, BtrpOperand e, Set<String> scopes); String fullyQualifiedSymbolName(String name); Set<String> getExported(); List<Script> getDependencies(); @Override String toString(); String prettyDependencies(); static final String EXTENSION; }