Ejemplo n.º 1
0
 public FeelEngineImpl(IFeelToJuelTransform transform, ExpressionFactory expressionFactory, IElContextFactory elContextFactory, ICache <TransformExpressionCacheKey, string> transformExpressionCache)
 {
     this.transform                = transform;
     this.expressionFactory        = expressionFactory;
     this.elContextFactory         = elContextFactory;
     this.transformExpressionCache = transformExpressionCache;
 }
Ejemplo n.º 2
0
        public virtual string Transform(IFeelToJuelTransform transform, string feelExpression, string inputName)
        {
            string simplePositiveUnaryTests = this.ExtractInnerExpression(feelExpression);
            string juelExpression           = transform.TransformSimplePositiveUnaryTests(simplePositiveUnaryTests, inputName);

            return("not(" + juelExpression + ")");
        }
Ejemplo n.º 3
0
        protected internal virtual IFeelEngine CreateFeelEngine()
        {
            IFeelToJuelTransform transform         = this.CreateFeelToJuelTransform();
            ExpressionFactory    expressionFactory = this.CreateExpressionFactory();
            IElContextFactory    elContextFactory  = this.CreateElContextFactory();
            ICache <TransformExpressionCacheKey, string> transformExpressionCache = this.CreateTransformExpressionCache();

            return(new FeelEngineImpl(transform, expressionFactory, elContextFactory, transformExpressionCache));
        }
Ejemplo n.º 4
0
        public String TransformInterval(IFeelToJuelTransform transform, String startIntervalSymbol, String lowerEndpoint, String upperEndpoint, String stopIntervalSymbol, String inputName)
        {
            String juelLowerEndpoint       = transform.TransformEndpoint(lowerEndpoint, inputName);
            String juelUpperEndpoint       = transform.TransformEndpoint(upperEndpoint, inputName);
            String lowerEndpointComparator = this.transformLowerEndpointComparator(startIntervalSymbol);
            String upperEndpointComparator = this.transformUpperEndpointComparator(stopIntervalSymbol);

            return(String.Format("{0} {1} {2} && {3} {4} {5}", inputName, lowerEndpointComparator, juelLowerEndpoint, inputName, upperEndpointComparator, juelUpperEndpoint));
        }
Ejemplo n.º 5
0
        public String Transform(IFeelToJuelTransform transform, String feelExpression, String inputName)
        {
            //Matcher matcher = INTERVAL_PATTERN.matcher(feelExpression);
            var matcher = INTERVAL_PATTERN.Match(feelExpression);

            if (matcher.Success)
            {
                return(this.TransformInterval(transform, matcher.Groups[1].Value, matcher.Groups[2].Value, matcher.Groups[3].Value, matcher.Groups[4].Value, inputName));
            }
            else
            {
                throw LOG.invalidIntervalExpression(feelExpression);
            }
        }
Ejemplo n.º 6
0
        public String Transform(IFeelToJuelTransform transform, String feelExpression, String inputName)
        {
            //Matcher matcher = COMPARISON_PATTERN.matcher(feelExpression);
            var matcher = COMPARISON_PATTERN.Match(feelExpression);

            if (matcher.Success)
            {
                return(this.TransformComparison(transform, matcher.Groups[1].Value, matcher.Groups[2].Value, inputName));
            }
            else
            {
                throw LOG.invalidComparisonExpression(feelExpression);
            }
        }
Ejemplo n.º 7
0
        protected List <String> TransformExpressions(IFeelToJuelTransform transform, String feelExpression, String inputName)
        {
            List <String> expressions     = this.CollectExpressions(feelExpression);
            List <String> juelExpressions = new List <string>();
            //Iterator i$ = expressions.iterator();
            var i = expressions.GetEnumerator();

            while (i.MoveNext())                             // hasNext()) {
            {
                String expression = (String)i.Current;       //.next();
                if (string.IsNullOrEmpty(expression.Trim())) //.IsEmpty())
                {
                    throw LOG.invalidListExpression(feelExpression);
                }

                String juelExpression = transform.TransformSimplePositiveUnaryTest(expression, inputName);
                juelExpressions.Add(juelExpression);
            }

            return(juelExpressions);
        }
Ejemplo n.º 8
0
        public String Transform(IFeelToJuelTransform transform, String feelExpression, String inputName)
        {
            var matcher = DATE_AND_TIME_PATTERN.Match(feelExpression);

            return(matcher.Success ? "dateAndTime(" + matcher.Groups[1].Value + ")" : feelExpression);
        }
Ejemplo n.º 9
0
        public String Transform(IFeelToJuelTransform transform, String feelExpression, String inputName)
        {
            String juelEndpoint = transform.TransformEndpoint(feelExpression, inputName);

            return(String.Format("{0} == {1}", inputName, juelEndpoint));
        }
Ejemplo n.º 10
0
        public string Transform(IFeelToJuelTransform transform, string feelExpression, string inputName)
        {
            List <string> juelExpressions = this.TransformExpressions(transform, feelExpression, inputName);

            return(this.JoinExpressions(juelExpressions));
        }
Ejemplo n.º 11
0
        protected String TransformComparison(IFeelToJuelTransform transform, String op, String endpoint, String inputName)
        {
            String juelEndpoint = transform.TransformEndpoint(endpoint, inputName);

            return(String.Format("{0} {1} {2}", inputName, op, juelEndpoint));
        }
Ejemplo n.º 12
0
 public string Transform(IFeelToJuelTransform transform, string feelExpression, string inputName)
 {
     return("true");
 }