use of org.whole.lang.bindings.IBindingScope in project whole by wholeplatform.
the class ArtifactsGeneratorTest method testGenerateArtifacts.
@Test
public void testGenerateArtifacts() {
IBindingManager env = BindingManagerFactory.instance.createArguments();
IEntity artifact = getMetadataPattern();
IBindingScope args = BindingManagerFactory.instance.createSimpleScope();
args.wDefValue("packageName", "artifact.test");
Matcher.substitute(artifact, args, false);
args.wClear();
args.wDefValue("templateManagerName", "MyTM");
Matcher.substitute(artifact, args, false);
ArtifactsGeneratorOperation.generate(artifact, env);
// String pn = env.wStringValue("packageName");
// String fn = env.wStringValue("fileName");
// String l = env.wStringValue("location");
// String n = env.wStringValue("name");
}
use of org.whole.lang.bindings.IBindingScope in project whole by wholeplatform.
the class IteratorFactory method oneIterator.
public static IEntityIterator<IEntity> oneIterator(IEntityIterator<IEntity> fromClause, IEntityIterator<IEntity> satisfiesClause) {
return new AbstractSingleValuedRunnableIterator<IEntity>(fromClause, satisfiesClause) {
protected void run(IEntity selfEntity, IBindingManager bm) {
IBindingScope laScope = null;
for (IEntity e : argsIterators[0]) {
if (!argsIterators[1].evaluate(e, bm).wBooleanValue())
continue;
if (laScope != null) {
bm.setResult(BindingManagerFactory.instance.createValue(false));
return;
} else {
laScope = BindingManagerFactory.instance.createSimpleScope();
laScope.wAddAll(argsIterators[0].lookaheadScope());
laScope.wAddAll(argsIterators[1].lookaheadScope());
}
}
if (laScope == null) {
bm.setResult(BindingManagerFactory.instance.createValue(false));
return;
}
bm.wAddAll(laScope);
bm.setResult(BindingManagerFactory.instance.createValue(true));
}
public void toString(StringBuilder sb) {
sb.append("one(");
// TODO startOf
argsIterators[0].toString(sb);
sb.append(" satisfies ");
// TODO startOf
argsIterators[1].toString(sb);
sb.append(")");
}
};
}
use of org.whole.lang.bindings.IBindingScope in project whole by wholeplatform.
the class ReusablesArtifactsGeneratorVisitor method visit.
public void visit(IReusablesEntity entity) {
IReusablesEntity entityClone = EntityUtils.clone(entity);
IBindingScope resultsScope = InterpreterOperation.interpret(entityClone);
for (IEntity result : resultsScope.getResultIterator()) {
IEntity adaptee = result.wGetAdaptee(false);
stagedVisit(adaptee);
}
}
use of org.whole.lang.bindings.IBindingScope in project whole by wholeplatform.
the class LaunchConfigurationUtils method loadBindingScope.
@SuppressWarnings("unchecked")
public static IBindingScope loadBindingScope(ILaunchConfiguration configuration) throws CoreException {
Map<String, String> environmentMap = configuration.getAttribute(ENVIRONMENT, (Map<String, String>) null);
IBindingScope scope = BindingManagerFactory.instance.createSimpleScope();
if (environmentMap == null)
return scope;
for (String name : environmentMap.keySet()) try {
IEntity entity = XmlBuilderPersistenceKit.instance().readModel(new StringPersistenceProvider(environmentMap.get(name)));
scope.wDef(name, entity);
} catch (Exception e) {
WholePlugin.log(e);
}
return scope;
}
use of org.whole.lang.bindings.IBindingScope in project whole by wholeplatform.
the class JavaCompilerOperation method getGenerator.
public JavaModelGenerator getGenerator() {
if (generator == null) {
setGenerator(createGenerator());
IBindingScope pe = getOperationEnvironment();
if (pe.wIsSet("author"))
generator.setAuthor(pe.wStringValue("author"));
if (pe.wIsSet("copyright"))
generator.setCopyright(pe.wStringValue("copyright"));
if (pe.wIsSet("license"))
generator.setLicense(pe.wStringValue("license"));
if (pe.wIsSet("packageName"))
generator.setBasePackagePrefix(pe.wStringValue("packageName"));
if (pe.wIsSet("URI"))
generator.setURI(pe.wStringValue("URI"));
}
return generator;
}
Aggregations