Package net.sourceforge.processdash.data.compiler

Examples of net.sourceforge.processdash.data.compiler.ListStack


    }

    public SimpleData evaluate(CompiledScript script, String prefix)
      throws ExecutionException
    {
      ListStack stack = new ListStack();
      ExpressionContext context = new SimpleExpressionContext(prefix);
      script.run(stack, context);
      SimpleData value = (SimpleData) stack.pop();
      if (value != null)
        value = (SimpleData) value.getEditable(false);
      return value;
    }
View Full Code Here


            result = arguments.get(2);

        if (result instanceof CompiledScript) {
            try {
                CompiledScript script = (CompiledScript) result;
                ListStack stack = new ListStack();
                script.run(stack, context);
                result = stack.pop();
            } catch (Exception e) {}
        }

        return result;
    }
View Full Code Here

        // be more than generous - even one retry should be rare.)
        int retryCount = 10
        while (retryCount-- > 0 && extChanges.isDirty()) {
            context = new SubscribingExpressionContext(data, prefix, this,
                    name, currentSubscriptions);
            ListStack stack = new ListStack();
            int changeCount = -1;

            try {
                calcNameSet.add(name);
                changeCount = extChanges.getUnhandledChangeCount();
                script.run(stack, context);
                newAlias = (String) stack.peekDescriptor();
                newValue = (SimpleData) stack.pop();
                if (newValue != null && newAlias == null)
                    newValue = (SimpleData) newValue.getEditable(false);
            } catch (ExecutionException e) {
                logger.warning("Error executing " + name + ": " + e);
                newValue = null;
View Full Code Here

        } catch (ClassCastException cce) { }
        if (script == null) return null;

        ListData result = new ListData();
        LocalExpressionContext lContext = new LocalExpressionContext(context);
        ListStack stack = new ListStack();
        Iterator i = collapseLists(arguments, 1).iterator();
        Object item;
        while (i.hasNext()) try {
            lContext.setLocalValue(item = i.next());
            stack.clear();
            script.run(stack, lContext);
            handleItem(result, item, stack.pop());
        } catch (Exception e) {}
        return result;
    }
View Full Code Here

     *
     * This method <b>must</b> be thread-safe.
     */
    public Object call(List arguments, ExpressionContext context)
    {
        ListStack stack = null;
        for (Iterator iter = arguments.iterator(); iter.hasNext();) {
            Object arg = iter.next();

            if (arg instanceof CompiledScript) {
                try {
                    CompiledScript script = (CompiledScript) arg;
                    if (stack == null)
                        stack = new ListStack();
                    else
                        stack.clear();
                    script.run(stack, context);
                    arg = stack.pop();
                } catch (Exception e) {}
            }

            if (arg instanceof SimpleData
                    && !isBadValue((SimpleData) arg))
View Full Code Here

        String prefix = asString(getArg(arguments, 1));

        CompiledScript script = Compiler.compile(expression);

        try {
            Stack stack = new ListStack();
            if (prefix != null)
                context = new RelativeExpressionContext(context, prefix);
            script.run(stack, context);
            return stack.pop();
        } catch (ExecutionException ee) {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.compiler.ListStack

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.