Package org.andromda.core.translation

Examples of org.andromda.core.translation.Expression


    /**
     * @see org.andromda.metafacades.uml.ConstraintFacade#getTranslation(java.lang.String)
     */
    protected java.lang.String handleGetTranslation(final java.lang.String language)
    {
        final Expression expression =
            ExpressionTranslator.instance().translate(
                language,
                this.getBody(),
                this.getContextElement());
        return expression == null ? null : expression.getTranslatedExpression();
    }
View Full Code Here


        try
        {
            Lexer lexer = new Lexer(new PushbackReader(new StringReader(expression)));
            OclParser parser = new OclParser(lexer);
            Start startNode = parser.parse();
            this.translatedExpression = new Expression(expression);
            startNode.apply(this);
        }
        catch (ParserException ex)
        {
            throw new OclParserException(ex.getMessage());
View Full Code Here

     * @see org.andromda.translation.ocl.BaseTranslator#postProcess()
     */
    public void postProcess()
    {
        super.postProcess();
        Expression expression = this.getExpression();
        if (expression != null)
        {
            String contextElementName = expression.getContextElement();
            this.contextElement = this.findModelElement(contextElementName.replaceAll("::", "\\."));
            if (this.contextElement != null)
            {
                logger.info("found context element --> '" + contextElementName + "'");
            }
View Full Code Here

        {
            logger.info("======================== Tracing Expression ========================");
            logger.info(TranslationUtils.removeExtraWhitespace(expression));
            logger.info("======================== ================== ========================");
        }
        Expression expressionObj = super.translate(translationName, expression, contextElement);
        if (logger.isInfoEnabled())
        {
            logger.info("========================  Tracing Complete  ========================");
        }
        return expressionObj;
View Full Code Here

                                "the expression you want to translate from");
                        }
                        continue;
                    }

                    Expression translated;
                    if (useTraceTranslator)
                    {
                        translated = TraceTranslator.getInstance().translate(
                                translation,
                                fromExpression,
                                null);
                    }
                    else
                    {
                        final ExpressionTest expressionConfig = (ExpressionTest)expressions.get(fromExpression);
                        String toExpression = expressionConfig.getTo();

                        Object modelElement = null;

                        // - only find the model element if we have a model
                        // defined in our AndroMDA configuration
                        final Repository[] repositories = this.configuration.getRepositories();
                        if (repositories != null && repositories.length > 0)
                        {
                            modelElement = this.findModelElement(
                                    translation,
                                    fromExpression);
                        }
                        else
                        {
                            logger.info("No repositories defined in configuration, not finding for model elements");
                        }

                        translated =
                            ExpressionTranslator.instance().translate(
                                translation,
                                fromExpression,
                                modelElement);

                        if (translated != null)
                        {
                            // remove the extra whitespace from both so as to
                            // have an accurrate comarison
                            toExpression = TranslationUtils.removeExtraWhitespace(toExpression);
                            if (logger.isInfoEnabled())
                            {
                                logger.info("translated: --> '" + translated.getTranslatedExpression() + "'");
                                logger.info("expected:   --> '" + toExpression + "'");
                            }
                            TestCase.assertEquals(
                                toExpression,
                                translated.getTranslatedExpression());
                        }
                    }
                }
            }
        }
View Full Code Here

    /**
     * @see org.andromda.metafacades.uml.ConstraintFacade#getTranslation(java.lang.String)
     */
    public String handleGetTranslation(String language)
    {
        final Expression expression =
            ExpressionTranslator.instance().translate(
                language,
                this.getBody(),
                this.getContextElement());
        return expression == null ? null : expression.getTranslatedExpression();
    }
View Full Code Here

TOP

Related Classes of org.andromda.core.translation.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.