Search in sources :

Example 31 with IEntity

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();
}
Also used : IEntity(org.whole.lang.model.IEntity) IBindingScope(org.whole.lang.bindings.IBindingScope)

Example 32 with IEntity

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);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity)

Example 33 with IEntity

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;
}
Also used : IEntity(org.whole.lang.model.IEntity)

Example 34 with IEntity

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);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity)

Example 35 with IEntity

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;
}
Also used : IEntity(org.whole.lang.model.IEntity)

Aggregations

IEntity (org.whole.lang.model.IEntity)1407 ArrayList (java.util.ArrayList)604 Test (org.junit.Test)241 IBindingManager (org.whole.lang.bindings.IBindingManager)141 PathExpression (org.whole.lang.queries.model.PathExpression)68 ITemplateManager (org.whole.lang.templates.ITemplateManager)61 Grammar (org.whole.lang.grammars.model.Grammar)50 TestXmlGrammar (org.whole.lang.grammars.util.TestXmlGrammar)46 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)43 Model (org.whole.lang.models.model.Model)40 InternalIEntity (org.whole.lang.model.InternalIEntity)38 VisitException (org.whole.lang.visitors.VisitException)35 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)30 ModelsModel (org.whole.lang.models.codebase.ModelsModel)27 WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)26 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)24 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)22 XmlModel (org.whole.lang.models.codebase.XmlModel)22 MissingVariableException (org.whole.lang.visitors.MissingVariableException)22 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)21