use of org.whole.lang.visitors.VisitException in project whole by wholeplatform.
the class GenericMatcherFactory method isPlatformSubtypeOfMatcher.
@Deprecated
public IVisitor isPlatformSubtypeOfMatcher(String edUri) {
return new AbstractEntityDescriptorBasedMatcher(edUri) {
public void visit(IEntity entity) {
EntityDescriptor<?> ed = entity.wGetEntityDescriptor();
EntityDescriptor<?> otherEd = getOtherEntityDescriptor(ed);
if (otherEd == null || !otherEd.isPlatformSupertypeOf(ed))
throw new VisitException();
}
protected String predicateName() {
return "isPlatformSubtypeOf";
}
};
}
use of org.whole.lang.visitors.VisitException in project whole by wholeplatform.
the class GenericMatcherFactory method isLanguageSupertypeOfMatcher.
public IVisitor isLanguageSupertypeOfMatcher(String edUri) {
return new AbstractEntityDescriptorBasedMatcher(edUri) {
public void visit(IEntity entity) {
EntityDescriptor<?> entityEd = entity.wGetEntityDescriptor();
EntityDescriptor<?> ed = getOtherEntityDescriptor(entityEd);
if (ed == null || !entityEd.isLanguageSupertypeOf(ed))
throw new VisitException();
}
protected String predicateName() {
return "isLanguageSupertypeOf";
}
};
}
use of org.whole.lang.visitors.VisitException in project whole by wholeplatform.
the class GenericMatcherFactory method hasKindMatcher.
public IVisitor hasKindMatcher(final EntityKinds kind) {
return new AbstractVisitor() {
public void visit(IEntity entity) {
if (!kind.equals(entity.wGetEntityKind()))
throw new VisitException();
}
public void toString(StringBuilder sb) {
sb.append("hasKind(");
sb.append(kind);
sb.append(")");
}
};
}
use of org.whole.lang.visitors.VisitException in project whole by wholeplatform.
the class SchemeInterpreterVisitor method visit.
public void visit(AndExpression entity) {
IEntity exprs = entity.getExpressions();
if (!exprs.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.SchemeExpressions))
throw new VisitException("expected a " + SchemeEntityDescriptorEnum.SchemeExpressions);
boolean result = true;
for (int i = 0; i < exprs.wSize(); i++) result = result && booleanValue(((SchemeExpression) exprs.wGet(i)));
setResult(SchemeEntityFactory.instance.createBooleanValue(result));
}
use of org.whole.lang.visitors.VisitException in project whole by wholeplatform.
the class SchemeInterpreterVisitor method visit.
public void visit(LocalExpression entity) {
getBindings().wEnterScope();
Definitions defs = entity.getDefinitions();
if (!defs.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.Definitions))
throw new VisitException("expected a " + SchemeEntityDescriptorEnum.Definitions);
for (int i = 0; i < defs.wSize(); i++) {
IEntity e = defs.wGet(i);
if (e.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.Definition)) {
Definition def = ((Definition) e);
getBindings().wDef(def.getName().wStringValue(), def.getExpression());
}
}
entity.getBody().accept(this);
getBindings().wExitScope();
}
Aggregations