Search in sources :

Example 1 with ModelsSpecificBuilderAdapter

use of org.whole.lang.models.builders.ModelsSpecificBuilderAdapter in project whole by wholeplatform.

the class ModelsLanguageDeployer method deploy.

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

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ModelsGenericBuilderAdapter((IModelsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ModelsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, ExportTexOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new TeXGeneratorVisitor((ExportTexOperation) operation);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ModelsPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, ValidatorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ModelsValidatorVisitor();
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ModelsInterpreterVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, NormalizerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ModelsNormalizerVisitor();
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) TeXGeneratorVisitor(org.whole.lang.models.visitors.TeXGeneratorVisitor) IModelsBuilder(org.whole.lang.models.builders.IModelsBuilder) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ModelsSpecificBuilderAdapter(org.whole.lang.models.builders.ModelsSpecificBuilderAdapter) ModelsPrettyPrinterVisitor(org.whole.lang.models.visitors.ModelsPrettyPrinterVisitor) ExportTexOperation(org.whole.lang.operations.ExportTexOperation) ModelsGenericBuilderAdapter(org.whole.lang.models.builders.ModelsGenericBuilderAdapter) ModelsInterpreterVisitor(org.whole.lang.models.visitors.ModelsInterpreterVisitor) ModelsNormalizerVisitor(org.whole.lang.models.visitors.ModelsNormalizerVisitor) ModelsValidatorVisitor(org.whole.lang.models.visitors.ModelsValidatorVisitor)

Aggregations

IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IModelsBuilder (org.whole.lang.models.builders.IModelsBuilder)1 ModelsGenericBuilderAdapter (org.whole.lang.models.builders.ModelsGenericBuilderAdapter)1 ModelsSpecificBuilderAdapter (org.whole.lang.models.builders.ModelsSpecificBuilderAdapter)1 ModelsInterpreterVisitor (org.whole.lang.models.visitors.ModelsInterpreterVisitor)1 ModelsNormalizerVisitor (org.whole.lang.models.visitors.ModelsNormalizerVisitor)1 ModelsPrettyPrinterVisitor (org.whole.lang.models.visitors.ModelsPrettyPrinterVisitor)1 ModelsValidatorVisitor (org.whole.lang.models.visitors.ModelsValidatorVisitor)1 TeXGeneratorVisitor (org.whole.lang.models.visitors.TeXGeneratorVisitor)1 ExportTexOperation (org.whole.lang.operations.ExportTexOperation)1 IOperation (org.whole.lang.operations.IOperation)1 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1