Examples of FunctionInformation


Examples of org.boris.jxll.FunctionInformation

    public static void main(String[] args) throws Exception {
        // Load the addin
        Addin a = JXLL.load(ADDIN);

        // Register the double arg function
        a.registerFunction(new FunctionInformation("DoubleArg", "BB"));

        // Call the double arg function
        XLOper res = a.invoke("DoubleArg", new Double(2.));

        // Display the result
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

    }

    public static FunctionInformation fromArray(String[] sa) {
        if (sa == null || sa.length == 0)
            return null;
        FunctionInformation fi = new FunctionInformation(sa[0]);
        if (sa.length > 1)
            fi.setFunctionHelp(sa[1]);
        if (sa.length > 2)
            fi.setCategory(sa[2]);
        if (sa.length > 3)
            fi.setShortcutText(sa[3]);
        if (sa.length > 4)
            fi.setHelpTopic(sa[4]);
        if (sa.length > 5)
            fi.setVolatile(Boolean.valueOf(sa[5]).booleanValue());
        for (int i = 6; i < sa.length; i += 2) {
            String name = sa[i];
            if (name == null || name.trim().length() == 0)
                continue;
            String help = null;
            if (sa.length > i + 1)
                help = sa[i + 1];
            fi.addArgument(name, help);
        }
        return fi;
    }
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

    public boolean hasFunction(String name) {
        return name.equals("Eval");
    }

    public FunctionInformation getInformation() {
        FunctionInformation fi = new FunctionInformation("Eval");
        fi.addArgument("args", "The arguments...");
        fi.setFunctionHelp("Evaluates a list of arguments as a lisp expression");
        return fi;
    }
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

        if (xf == null)
            return null;
        String fn = xf.name();
        if (hasValue(fn))
            name = fn;
        FunctionInformation fi = new FunctionInformation(name);
        if (xf.isVolatile())
            fi.setVolatile(true);
        if (hasValue(xf.category()))
            fi.setCategory(xf.category());
        if (hasValue(xf.help()))
            fi.setFunctionHelp(xf.help());
        String[] args = xf.args();
        String[] argHelp = xf.argHelp();
        if (args != null && args.length > 0) {
            for (int i = 0; i < args.length; i++) {
                String arg = args[i];
                String help = null;
                if (argHelp != null && argHelp.length > i)
                    help = argHelp[i];
                if (hasValue(arg))
                    fi.addArgument(arg, help);
            }
        }
        return fi;
    }
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

    public void addMethod(String name, Class c, Object instance, Method m) {
        if (!m.getDeclaringClass().equals(c))
            return;
        XLFunction xf = m.getAnnotation(XLFunction.class);
        FunctionInformation fi = AnnotationHelper.extract(name, xf);
        if (fi != null) {
            name = fi.getName();
            information.put(name, fi);
        }
        IFunction f = (IFunction) methods.get(name);
        if (f instanceof InstanceMethod) {
            OverloadedMethod om = new OverloadedMethod();
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

    public FunctionInformation[] getFunctions() {
        ArrayList functions = new ArrayList();
        for (Iterator i = methods.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();
            FunctionInformation fi = (FunctionInformation) information.get(key);
            if (fi != null) {
                functions.add(fi);
                continue;
            }
            IFunction f = (IFunction) methods.get(key);
            fi = new FunctionInformation(key);
            if (f instanceof InstanceMethod) {
                try {
                    InstanceMethod im = (InstanceMethod) f;
                    ParameterNameExtractor pne = new ParameterNameExtractor(im.clazz);
                    String[] names = pne.getParameterNames(im.method);
                    for (int j = 0; j < names.length; j++) {
                        fi.addArgument(names[j], im.args[j].getSimpleName());
                    }
                } catch (Exception e) {
                }
            } else if (f instanceof OverloadedMethod) {
                try {
                    OverloadedMethod om = (OverloadedMethod) f;
                    InstanceMethod im = om.getFirstMethod();
                    ParameterNameExtractor pne = new ParameterNameExtractor(im.clazz);
                    String[] names = pne.getParameterNames(im.method);
                    for (int j = 0; j < names.length; j++) {
                        fi.addArgument(names[j], im.args[j].getSimpleName());
                    }
                } catch (Exception e) {
                }
            }
            functions.add(fi);
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

    }

    private void add(String name, Method m) {
        XLFunction xf = m.getAnnotation(XLFunction.class);
        FunctionInformation fi = AnnotationHelper.extract(name, xf);
        if (fi != null) {
            name = fi.getName();
            functions.add(fi);
        }

        add(name, new DelegateFunction(null, m));
    }
View Full Code Here

Examples of org.boris.xlloop.handler.FunctionInformation

import org.boris.xlloop.handler.FunctionInformation;

public class FunctionInformationTest
{
    public static void main(String[] args) {
        FunctionInformation fi = new FunctionInformation("Math.pow");
        fi.setFunctionHelp("Raises the first value to the power of the second");
        fi.setCategory("Maths");
        fi.addArgument("value", "The first value");
        fi.addArgument("power", "The power value");
        System.out.println(fi.encode());
    }
View Full Code Here

Examples of org.pentaho.openformula.ui.model2.FunctionInformation

    {
      return true;
    }

    final FormulaElement mainFormulaElement = editorModel.getFormulaElementAt(1);
    final FunctionInformation currentFunction = editorModel.getCurrentFunction();
    if ((mainFormulaElement != null) && (currentFunction != null) && (currentFunction.getFunctionOffset() == 1) &&
        (mainFormulaElement.getText().equals(currentFunction.getCanonicalName())))
    {
      return true;
    }
    else
    {
View Full Code Here

Examples of org.pentaho.openformula.ui.model2.FunctionInformation

    if (formulaContext == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
    final FunctionInformation fnInfo = editorModel.getCurrentFunction();
    if (fnInfo == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
    final FunctionDescription fnDesc = formulaContext.getFunctionRegistry().getMetaData(fnInfo.getCanonicalName());
    if (fnDesc == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.