use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class RevisionPart method refreshVisuals.
@Override
protected void refreshVisuals() {
int index = 0, additions = 0, deletions = 0;
Revision entity = getModelEntity();
if (EntityUtils.hasParent(entity))
index = entity.wGetParent().wIndexOf(entity);
try {
IBindingManager bm = BindingManagerFactory.instance.createArguments();
IEntity result = BehaviorUtils.apply("whole:org.whole.lang.changes:RevisionsLibrarySemantics#revisionSummary", entity, bm);
additions = result.wGet(0).wIntValue();
deletions = result.wGet(1).wIntValue();
} catch (Exception e) {
}
getFigure().updateData(index, additions, deletions);
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class TestsHelpers method updateFilterBody.
public static IEntity updateFilterBody(IEntity pattern, IEntity model, Sequence sequence) {
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
boolean match = false;
while (!match) {
try {
bindings.wEnterScope();
// try to match
new GenericMatcher().withBindings(bindings).match(applyFilter(sequence, EntityUtils.clone(pattern), bindings), applyFilter(sequence, EntityUtils.clone(model), bindings));
// eventually matches
match = true;
} catch (MatchException e) {
// update normalization
sequence.wAdd(QueriesEntityFactory.instance.createDelete(QueriesUtils.createRootPath(e.pattern)));
} finally {
// clear scope
bindings.wExitScope();
}
}
return sequence;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ReusablesDynamicCompilerVisitor method visit.
@Override
public void visit(FileSystem entity) {
entity.getPersistence().accept(this);
IEntityIterator<?> persistenceIterator = getResultIterator();
entity.getContent().accept(this);
IEntityIterator<?> contentIterator = getResultIterator();
setResultIterator(IteratorFactory.composeIterator(IteratorFactory.singleValuedRunnableIterator(new ResourcePersistenceRunnable() {
protected IPersistenceProvider getPersistenceProvider(String path, IBindingManager bm) {
return new FilePersistenceProvider(new File(path), bm);
}
}, new int[] { 0 }, persistenceIterator).withSourceEntity(entity), contentIterator));
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class SemanticsInterpreterVisitor method visit.
@Override
public void visit(SemanticFunction entity) {
FunctionBody rules = entity.getRules();
if (Matcher.match(SemanticsEntityDescriptorEnum.InferenceRules, rules))
return;
FunctionLibraryRegistry.instance().putFunctionModel(getLibraryUri(entity) + "#" + entity.getName().getValue(), entity);
IBindingManager bm = getBindings();
if (!bm.wIsSet("LazyInterpretation") || !bm.wBooleanValue("LazyInterpretation"))
DynamicCompilerOperation.compile(entity, getBindings());
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class SemanticsInterpreterVisitor method visit.
@Override
public void visit(EnvironmentVariable entity) {
IEntity oldSematics = setFeature(SemanticsUtils.USE_IDENTIFIER_SEMANTICS, true);
try {
entity.getEnvironment().accept(this);
IBindingManager bm = getBindings().wGetEnvironmentManager().getEnvironment(getResult().wStringValue());
entity.getVariable().accept(this);
String varName = getResult().wStringValue();
IEntity varValue = bm.wGet(varName);
if (varValue == null)
throw new MissingVariableException(entity.getVariable().toString()).withSourceEntity(entity).withBindings(getBindings());
setResult(varValue);
} finally {
setFeature(SemanticsUtils.USE_IDENTIFIER_SEMANTICS, oldSematics);
}
}
Aggregations