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;
}
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);
}
}
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);
}
}
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;
}
}
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;
}
Aggregations