use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class TemplateInterpreterIterator method lookahead.
public E lookahead() {
if (nextEntityIterator != null)
return nextEntityIterator.lookahead();
clearLookaheadScope();
getBindings().wEnterScope(lookaheadScope(), true);
IEntity selfEntity = getBindings().wGet("self");
if (selfEntity != resetEntity)
getBindings().wDef("self", resetEntity);
IBindingScope results = InterpreterOperation.interpret(pattern, getBindings(), true);
getBindings().wExitScope();
nextEntityIterator = results.getResultIterator();
if (results.hasResultIterator()) {
results.setResultIterator(null);
selfEntity = getBindings().wGet("self");
if (selfEntity != resetEntity)
getBindings().wDef("self", resetEntity);
nextEntityIterator.reset(resetEntity);
lookaheadScope = null;
}
return nextEntityIterator.lookahead();
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractSingleValuedRunnableIterator method add.
public void add(E entity) {
if (lastEntity == null)
throw new IllegalStateException();
if (EntityUtils.hasParent(lastEntity)) {
IEntity parent = lastEntity.wGetParent();
parent.wAdd(parent.wIndexOf(lastEntity), entity);
}
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class SharingChangeEventHandler method notifyAdded.
public void notifyAdded(IEntity source, FeatureDescriptor featureDesc, int index, IEntity newValue) {
if (sharingCycle)
return;
sharingCycle = true;
for (IEntity sharedEntity : sharingSet) if (sharedEntity != source)
sharedEntity.wAdd(index, EntityUtils.clone(newValue));
sharingCycle = false;
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class GenericNormalizer method beforeRemovingResolvers.
protected static void beforeRemovingResolvers(IEntity entity) {
if (EntityUtils.isComposite(entity)) {
IEntityIterator<IEntity> i = IteratorFactory.childIterator();
i.reset(entity);
for (IEntity child : i) if (EntityUtils.isResolver(child))
entity.wRemove(child);
}
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class CompoundResourceRegistry method getFunctionModel.
@SuppressWarnings("unchecked")
public <E extends IEntity> E getFunctionModel(String functionUri, boolean loadOnDemand, IBindingManager bm) {
IEntity functionModel = uriModelMap.get(functionUri);
if (functionModel == null && loadOnDemand && ResourceUtils.hasFragmentPart(functionUri)) {
String libraryUri = ResourceUtils.getResourcePart(functionUri);
getFunctionLibrary(libraryUri, loadOnDemand, bm);
functionModel = uriModelMap.get(functionUri);
}
return (E) functionModel;
}
Aggregations