Search in sources :

Example 21 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class AbstractContentPaneManagerPart method getModelSpecificChildren.

@Override
protected List<IEntity> getModelSpecificChildren() {
    IEntity entity = getModelEntity();
    int size = entity.wSize();
    List<IEntity> list = new ArrayList<IEntity>(size);
    for (int i = 0; i < size; i++) list.add(entity.wGet(i));
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 22 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class MoveGuideCommand method execute.

public void execute() {
    guide.setPosition(guide.getPosition() + pDelta);
    Iterator iter = guide.getParts().iterator();
    while (iter.hasNext()) {
        IEntity part = (IEntity) iter.next();
    // Point location = part.getLocation().getCopy();
    // if (guide.isHorizontal()) {
    // location.y += pDelta;
    // } else {
    // location.x += pDelta;
    // }
    // part.setLocation(location);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) Iterator(java.util.Iterator)

Example 23 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class FollowingIterator method pushInitialIterators.

@Override
protected void pushInitialIterators(IEntity entity) {
    if (entity == null || !EntityUtils.hasParent(entity))
        pushIterator(IteratorFactory.<E>emptyIterator(), entity);
    else {
        IEntity parent = entity.wGetParent();
        pushInitialIterators(parent);
        pushIterator(createChildIterator(), entity);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity)

Example 24 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class GenericMatcher method match.

public void match(IEntity pattern, IEntity model) {
    IEntity patternAdaptee = pattern.wGetAdaptee(false);
    IMatchStrategy matchStrategy = matchStrategyMap.get(patternAdaptee.wGetEntityDescriptor());
    if (matchStrategy != null)
        matchStrategy.apply(patternAdaptee, model, this);
    else
        switch(pattern.wGetEntityKind()) {
            case SIMPLE:
                matchSimpleEntity(pattern, model);
                break;
            case COMPOSITE:
                matchCompositeEntity(pattern, model);
                break;
            case DATA:
                matchDataEntity(pattern, model);
                break;
        }
}
Also used : IEntity(org.whole.lang.model.IEntity)

Example 25 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class Matcher method removeVars.

public static boolean removeVars(IEntity pattern, boolean force) {
    boolean allVarsAreOptional = true;
    AbstractPatternFilterIterator<IEntity> variableIterator = IteratorFactory.descendantOrSelfMatcherIterator().withPattern(GenericMatcherFactory.instance.isVariableMatcher());
    variableIterator.reset(pattern);
    for (IEntity variableAdapter : variableIterator) {
        Variable variable = (Variable) variableAdapter.wGetAdaptee(false);
        boolean isOptional = variable.getQuantifier().getValue().isOptional();
        allVarsAreOptional &= isOptional;
        if (force || isOptional)
            variableIterator.remove();
    }
    return allVarsAreOptional;
}
Also used : Variable(org.whole.lang.commons.model.Variable) 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