Search in sources :

Example 1 with MathInterpreterVisitor

use of org.whole.lang.math.visitors.MathInterpreterVisitor in project whole by wholeplatform.

the class MathLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new MathLanguageKit());
    platform.addOperationFactory(MathLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MathGenericBuilderAdapter((IMathBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(MathLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MathSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(MathLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new MathInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) MathInterpreterVisitor(org.whole.lang.math.visitors.MathInterpreterVisitor) IMathBuilder(org.whole.lang.math.builders.IMathBuilder) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) MathGenericBuilderAdapter(org.whole.lang.math.builders.MathGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) MathSpecificBuilderAdapter(org.whole.lang.math.builders.MathSpecificBuilderAdapter)

Aggregations

IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IMathBuilder (org.whole.lang.math.builders.IMathBuilder)1 MathGenericBuilderAdapter (org.whole.lang.math.builders.MathGenericBuilderAdapter)1 MathSpecificBuilderAdapter (org.whole.lang.math.builders.MathSpecificBuilderAdapter)1 MathInterpreterVisitor (org.whole.lang.math.visitors.MathInterpreterVisitor)1 IOperation (org.whole.lang.operations.IOperation)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1