Examples of Function

  • net.sf.jpluck.plucker.functions.Function
  • net.sf.jsqlparser.expression.Function
    A function as MAX,COUNT...
  • net.sf.minuteProject.configuration.bean.model.data.Function
  • net.sourceforge.htmlunit.corejs.javascript.Function
    This is interface that all functions in JavaScript must implement. The interface provides for calling functions and constructors. @see net.sourceforge.htmlunit.corejs.javascript.Scriptable @author Norris Boyd
  • net.sourceforge.marathon.api.module.Function
  • nexj.core.scripting.Function
    Interface for invoking a function.
  • nodebox.function.Function
    Function wraps any kind of callable.
  • noop.model.Function
    @author alexeagle@google.com (Alex Eagle)
  • org.apache.cassandra.cql3.functions.Function
  • org.apache.commons.jxpath.Function
    Extension function interface. Extension functions are grouped into {@link Functions Functions} objects, which are installed onJXPathContexts using the {@link JXPathContext#setFunctions JXPathContext.setFunctions()}call.

    The Function interface can be implemented directly. However, most of the time JXPath's built-in implementations should suffice. See {@link ClassFunctions ClassFunctions} and {@link PackageFunctions PackageFunctions}. @author Dmitri Plotnikov @version $Revision: 1.5 $ $Date: 2003/03/11 00:59:12 $

  • org.apache.felix.service.command.Function
    A Function is a a block of code that can be executed with a set of arguments, it returns the result object of executing the script.
  • org.apache.hadoop.hive.metastore.api.Function
  • org.apache.jmeter.functions.Function
    Methods that a function must implement
  • org.apache.poi.hssf.record.formula.functions.Function
    @author Amol S. Deshmukh < amolweb at ya hoo dot com >Function serves as a marker interface.
  • org.apache.poi.ss.formula.functions.Function
    Common interface for all implementations of Excel built-in functions. @author Amol S. Deshmukh < amolweb at ya hoo dot com >
  • org.apache.tajo.catalog.function.Function
  • org.apache.vxquery.functions.Function
  • org.apache.ws.jaxme.sqls.Function
    @author Jochen Wiedmann
  • org.apache.xpath.functions.Function
    This is a superclass of all XPath functions. This allows two ways for the class to be called. One method is that the super class processes the arguments and hands the results to the derived class, the other method is that the derived class may process it's own arguments, which is faster since the arguments don't have to be added to an array, but causes a larger code footprint.
  • org.asturlinux.frade.currin.program.Function
  • org.atmosphere.wasync.Function
    A function is asynchronously invoked when a response is received, complete or not.

    This library supports predefined life cycle's events (@link Event} that can be used. For example, a Function can be defined for handling IOException:

     

    class Function<IOException>() { public void on(IOEXception ex) { } }

    This function can be registered using the {@link Socket#on(Function)} as
     

    socket.on(new Function<IOEXception>() { .... }

    This is the equivalent of doing
     

    socket.on(Event.ERROR, new Function<IOEXception>() { .... }

    Anonymous functions call also be invoked if a {@link Decoder} match its type
     

    socket.decoder(new Decoder<String, POJO>(){ @Override public POJO decode(Event e, String message) { return new POJO(message); } }

    .on(new Function<POJO>() { .... }

    @param < T> @author Jeanfrancois Arcand
  • org.auraframework.impl.expression.functions.Function
    the thing that actually executes some function in the formula engine
  • org.cfeclipse.cfml.dictionary.Function
    This is a function. Functions are like tags except they have a return type. A function derives from the Procedure class but as mentioned a moment ago, it has a return value. @author Rob
  • org.cfeclipse.cfmledit.dictionary.Function
  • org.drools.clips.Function
  • org.drools.core.rule.Function
  • org.drools.eclipse.core.Function
    This represents a function.
  • org.drools.rule.Function
  • org.eclipse.sapphire.modeling.el.Function
    @author Konstantin Komissarchik
  • org.fenixedu.academic.domain.organizationalStructure.Function
  • org.foray.fotree.value.Function
    Abstract superclass for all XSL-FO functions.
  • org.formulacompiler.compiler.Function
  • org.gdbms.engine.function.Function
    Interface to be implemented to create a function. The name will be the string used in the SQL to refeer the function. A function will be created once for each instruction execution.
  • org.gephi.appearance.api.Function
    @author mbastian
  • org.h2.expression.Function
    This class implements most built-in functions of this database.
  • org.hisrc.jscm.codemodel.expression.JSFunctionExpression.Function
  • org.jaxen.Function
    Interface for the extensible function framework.

    NOTE: This class is not typically used directly, but is exposed for writers of extended XPath packages.

    Implementations of Function are functors which are used to evaluate a function-call within an XPath expression.

    @see FunctionContext @author bob mcwhirter
  • org.jboss.gwt.flow.client.Function
    An execution delegate able to control the outcome. @author Heiko Braun @date 3/8/13
  • org.jboss.security.xacml.sunxacml.cond.Function
    Interface that all functions in the system must implement. @since 1.0 @author Seth Proctor
  • org.jenetics.util.Function
    A function of 1 parameter. @author Franz Wilhelmstötter @since 1.0 @version 1.0 — $Date$
  • org.jfree.report.expressions.Function
    The interface for report functions. A report function separates the business logic from presentation of the result.

    Since JFreeReport 0.9 functions are considered immutable. During the advancement process, the function returns a new instance with the updated state. @author Thomas Morgner

  • org.jitterbit.integration.data.function.Function
    TODO: Write this. @author Torgil Zethson
  • org.jitterbit.integration.data.script.Function
    Defines a function in the Formula Builder. @author Torgil Zethson @since 1.2
  • org.lealone.expression.Function
    This class implements most built-in functions of this database.
  • org.maltparserx.core.feature.function.Function
    @author Johan Hall
  • org.mozilla.javascript.Function
    This is interface that all functions in JavaScript must implement. The interface provides for calling functions and constructors. @see org.mozilla.javascript.Scriptable @author Norris Boyd
  • org.mvel2.ast.Function
  • org.openbel.bel.xbel.model.Function
  • org.openbel.framework.common.lang.Function
    The base class of the immutable BEL function model.

    TODO: The function model currently lacks unit tests

  • org.opengis.filter.expression.Function
    is.org/docs/02-059.pdf">Implementation specification 1.0 @version Symbology Encoding Implementation Specification 1.1.0 @author Chris Dillard (SYS Technologies) @since GeoAPI 2.0
  • org.openiaml.model.model.Function
  • org.openquark.cal.compiler.Function
    Provides an implementation of FunctionalAgent suitable for use in the type checker with functions or pattern bound variables.

    Creation date: (6/6/01 2:00:01 PM) @author Bo Ilic

  • org.openrdf.query.algebra.evaluation.function.Function
    @author Arjohn Kampman
  • org.osgi.service.command.Function
    A Function is a a block of code that can be executed with a set of arguments, it returns the result object of executing the script. TODO The javadoc in this class need a good scrub before release. @ThreadSafe @version $Revision: 5654 $
  • org.pentaho.reporting.engine.classic.core.function.Function
    The interface for report functions. A report function separates the business logic from presentation of the result. The function is called whenever JFreeReport changes its state while generating the report. The working model for the functions is based on cloning the state of the function on certain checkpoints to support the ReportState implementation of JFreeReport.

    Although functions support the ReportListener interface, they are not directly added to a report. A report FunctionCollection is used to control the functions. Functions are required to be cloneable.

    @author Thomas Morgner

  • org.pirkaengine.core.expression.Function
    関数クラス. @author shuji.w6e @since 0.1.0
  • org.qi4j.functional.Function
    Generic function interface to map from one type to another. This can be used with the Iterables methods to transform lists of objects. @param < From> @param < To>
  • org.rendersnake.js.Function
  • org.sf.feeling.swt.win32.extension.function.Function
    Win32 dll function utility class. @author cnfree
  • org.sonar.api.issue.action.Function
    @since 3.6
  • org.springframework.data.repository.query.spi.Function
    Value object to represent a function. Can either be backed by a static {@link Method} invocation (see{@link #Function(Method)}) or a method invocation on an instance (see {@link #Function(Method,Object)}. @author Thomas Darimont @author Oliver Gierke @since 1.9
  • org.springframework.data.solr.core.query.Function
    @author Christoph Strobl @since 1.1
  • org.springmodules.validation.valang.functions.Function

    A function is an implementation that returns a value based on one of more arguments. A function instance is created for each occurrence of the function in the validation language. @author Steven Devijver @since Apr 23, 2005

  • org.syrup.Function
    The function of a Task that is executed by a Worker. A concrete implementation must be a stateless (pure) Function; the Result after execution must solely depend on the Context. @author Robbert van Dalen
  • org.teiid.language.Function
    Represents a function. A function has a name and 0..n Expressions that are parameters.
  • org.teiid.query.sql.symbol.Function
    Represents a function in a sql statement. A function is a type of expression. Functions have a name and some arguments (0..n). Each argument is also an expression. After resolution, a function should have a type and a function descriptor.
  • org.zkoss.openlayers.util.Function
    A Javascript Object @author jumperchen
  • org.zkoss.xel.Function
    Represents a XEL function. @author tomyeh @since 3.0.0
  • our.apache.commons.jxpath.Function
  • prefuse.data.expression.Function
    rg">jeffrey heer
  • ptolemy.data.Function
    The interface for functions contained by function tokens. @author Xiaojun Liu, Steve Neuendorffer @version $Id: Function.java,v 1.14 2007/12/07 06:31:17 cxh Exp $ @since Ptolemy II 4.0 @Pt.ProposedRating Yellow (liuxj) @Pt.AcceptedRating Red (liuxj)
  • r.nodes.ast.Function
  • railo.transformer.bytecode.statement.udf.Function
  • swifu.main.Function
  • term02.m04_d27.functions.Function
  • tree.Function
    The Class FunctionNode. @author Anatoly Kondratyev
  • util.Function
  • webit.script.Function
    Exported function. @since 1.5.0 @author zqq
  • xbird.xquery.func.Function
    @author Makoto YUI (yuin405+xbird@gmail.com)

  • Examples of abstrasy.Function

            if (res == null)
                return Node.createNothing();


            Function fx = (Function) res.getExternal();


            if (!fx.isOverrided())
                return Node.createNothing();


            res = fx.getSuperFx();
            if (res == null)
                return Node.createNothing();

            else
                return res;
    View Full Code Here

    Examples of aima.core.logic.fol.parsing.ast.Function

          // ((consp x) (or (occurs-in? var (first x) subst) (occurs-in? var
          // (rest x) subst)))
        } else if (x instanceof Function) {
          // (or (occurs-in? var (first x) subst) (occurs-in? var (rest x)
          // subst)))
          Function fx = (Function) x;
          for (Term fxt : fx.getArgs()) {
            if (occurCheck(theta, var, fxt)) {
              return true;
            }
          }
        }
    View Full Code Here

    Examples of anvil.script.Function

      {
        switch(_typecode) {
        case Type.CLASS:
          {
            ClassType type = (ClassType)_type;
            Function ctor = type.getConstructor();
            if (ctor != null) {
              return ctor.execute(context, parameters);
            }
            throw context.InstantiationError("No constructor for "+type);
          }
         
    View Full Code Here

    Examples of at.salzburgresearch.nodekeeper.eca.function.Function

                                        String name  = bindingElement.getAttribute("name");
                                        String type  = bindingElement.getAttribute("type");

                                        if(type==null || type.equals("")) {
                                            Function f = new StaticValueFunction();
                                            f.init(bindingElement.getTextContent().trim());
                                            rule.bindings.add(new Binding(name,f));
                                        } else {
                                            Function f = createFunction(type,bindingElement.getChildNodes());
                                            rule.bindings.add(new Binding(name,f));
                                        }
                                    }
                                }
                            }
    View Full Code Here

    Examples of ca.nengo.math.Function

         *      Creates the function through reflection of its constructor and
         *      passing the user parameters to it
         */
        public void completeConfiguration(ConfigResult props) throws ConfigException {
            try {
                Function function = createFunction(props);
                setFunction(function);
            } catch (Exception e) {
                throw new ConfigException("Error creating function");
            }
        }
    View Full Code Here

    Examples of caltrop.interpreter.Function

                public int arity() {
                    return 1;
                }
            }));

            env.bind("SOP", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        System.out.println(args[0]);
                        return args[0];
                    } catch (Exception ex) {
                        throw new FunctionCallException("SOP", args[0], ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("logValue", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        PrintStream output = new PrintStream(new FileOutputStream(
                                _theContext.stringValue(args[0]), true));
                        output.println(args[1].toString());
                        output.close();
                        return args[1];
                    } catch (Exception ex) {
                        throw new FunctionCallException("logValue", args[0], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("Integers", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        int a = _theContext.intValue(args[0]);
                        int b = _theContext.intValue(args[1]);
                        List res = (b < a) ? Collections.EMPTY_LIST
                                : new IntegerList(_theContext, a, b);
                        return _theContext.createList(res);
                    } catch (Exception ex) {
                        throw new FunctionCallException("Integers", args[0],
                                args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$not", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        BooleanToken b = (BooleanToken) args[0];
                        return b.not();
                    } catch (Exception ex) {
                        throw new FunctionCallException("$not", args[0], ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("$and", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        BooleanToken a = (BooleanToken) args[0];
                        BooleanToken b = (BooleanToken) args[1];
                        return a.and(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$and", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$or", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        BooleanToken a = (BooleanToken) args[0];
                        BooleanToken b = (BooleanToken) args[1];
                        return a.or(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$or", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$eq", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];
                        return a.isEqualTo(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$eq", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$ne", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];
                        return a.isEqualTo(b).not();
                    } catch (Exception ex) {
                        throw new FunctionCallException("$ne", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$lt", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        ScalarToken a = (ScalarToken) args[0];
                        ScalarToken b = (ScalarToken) args[1];
                        return a.isLessThan(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$lt", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$le", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        ScalarToken a = (ScalarToken) args[0];
                        ScalarToken b = (ScalarToken) args[1];
                        return a.isGreaterThan(b).not();
                    } catch (Exception ex) {
                        throw new FunctionCallException("$le", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$gt", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        ScalarToken a = (ScalarToken) args[0];
                        ScalarToken b = (ScalarToken) args[1];
                        return a.isGreaterThan(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$gt", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$ge", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        ScalarToken a = (ScalarToken) args[0];
                        ScalarToken b = (ScalarToken) args[1];
                        return a.isLessThan(b).not();
                    } catch (Exception ex) {
                        throw new FunctionCallException("$ge", args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$negate", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        ScalarToken a = (ScalarToken) args[0];

                        return a.zero().subtract(a);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$negate", args[0], ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("$add", _theContext.createFunction(new Function() {
                // Compute the add operation on scalar arguments, the
                // list concatenation operation on lists, or the set
                // union on sets.
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];

                        if (a instanceof ObjectToken && b instanceof ObjectToken) {
                            Object oa = ((ObjectToken) a).getValue();
                            Object ob = ((ObjectToken) b).getValue();

                            if (oa instanceof Collection
                                    && ob instanceof Collection) {
                                Collection result;

                                if (oa instanceof Set) {
                                    result = new HashSet((Set) oa);
                                } else if (oa instanceof List) {
                                    result = new ArrayList((List) oa);
                                } else {
                                    throw new Exception(
                                            "Unknown object type: expected Set or List.");
                                }

                                result.addAll((Collection) ob);
                                return new ObjectToken(result);
                            } else {
                                throw new Exception(
                                        "Unknown object types: expected Collection.");
                            }
                        } else {
                            return a.add(b);
                        }
                    } catch (Exception ex) {
                        throw new FunctionCallException("$add", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$mul", _theContext.createFunction(new Function() {
                // Compute the multiply operation on scalar arguments,
                // or the set intersection operation on sets.
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];

                        if (a instanceof ObjectToken && b instanceof ObjectToken) {
                            Object oa = ((ObjectToken) a).getValue();
                            Object ob = ((ObjectToken) b).getValue();

                            if (oa instanceof Set && ob instanceof Collection) {
                                Set result = new HashSet((Set) oa);
                                result.retainAll((Collection) ob);
                                return new ObjectToken(result);
                            } else {
                                throw new InterpreterException(
                                        "Unknown object types: expected Set and Collection.");
                            }
                        } else {
                            return a.multiply(b);
                        }
                    } catch (Exception ex) {
                        throw new FunctionCallException("$mul", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$sub", _theContext.createFunction(new Function() {
                // Compute the subtraction operation on scalar arguments,
                // or the set subtraction operation on sets.
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];

                        if (a instanceof ObjectToken && b instanceof ObjectToken) {
                            Object oa = ((ObjectToken) a).getValue();
                            Object ob = ((ObjectToken) b).getValue();

                            if (oa instanceof Collection
                                    && ob instanceof Collection) {
                                Collection result;

                                if (oa instanceof Set) {
                                    result = new HashSet((Set) oa);
                                } else if (oa instanceof List) {
                                    result = new ArrayList((List) oa);
                                } else {
                                    throw new Exception(
                                            "Unknown object type: expected Set or List.");
                                }

                                result.removeAll((Collection) ob);
                                return new ObjectToken(result);
                            } else {
                                throw new InterpreterException(
                                        "Unknown object types: expected Collection.");
                            }
                        } else {
                            return a.subtract(b);
                        }
                    } catch (Exception ex) {
                        throw new FunctionCallException("$sub", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$div", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];
                        return a.divide(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$div", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$mod", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];
                        Token b = (Token) args[1];
                        return a.modulo(b);
                    } catch (Exception ex) {
                        throw new FunctionCallException("$mod", args[0], args[1],
                                ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$size", _theContext.createFunction(new Function() {
                // Compute the number of elements in the given set,
                // list, or array.
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];

                        if (a instanceof ObjectToken) {
                            Object oa = ((ObjectToken) a).getValue();

                            if (oa instanceof Collection) {
                                return new IntToken(((Collection) oa).size());
                            } else {
                                throw new InterpreterException(
                                        "Unknown object type: expected Collection.");
                            }
                        } else if (a instanceof ArrayToken) {
                            return _theContext.createInteger(((ArrayToken) a)
                                    .length());
                        } else {
                            throw new InterpreterException(
                                    "Unknown type: expected Array, Set, or List");
                        }
                    } catch (Exception ex) {
                        throw new FunctionCallException("$size", args[0], ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("$createList", _theContext.createFunction(new Function() {
                // Create a list that contains the results of applying
                // the second argument (a one argument function) to
                // every element in the first argument (a collection).
                public Object apply(Object[] args) {
                    try {
                        Collection c = _theContext.getCollection(args[0]);
                        FunctionToken f = (FunctionToken) args[1];
                        Object[] argument = new Object[1];
                        List res = new ArrayList();

                        for (Iterator i = c.iterator(); i.hasNext();) {
                            argument[0] = i.next();

                            Object listFragment = _theContext.applyFunction(f,
                                    argument);
                            res.addAll(_theContext.getCollection(listFragment));
                        }

                        return _theContext.createList(res);
                    } catch (Exception ex) {
                        throw new FunctionCallException("Failed to create list.",
                                args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$createSet", _theContext.createFunction(new Function() {
                // Create a set that contains the results of applying
                // the second argument (a one argument function) to
                // every element in the first argument (a collection).
                public Object apply(Object[] args) {
                    try {
                        Collection c = _theContext.getCollection(args[0]);
                        FunctionToken f = (FunctionToken) args[1];
                        Object[] argument = new Object[1];
                        Set res = new HashSet();

                        for (Iterator i = c.iterator(); i.hasNext();) {
                            argument[0] = i.next();

                            Object setFragment = _theContext.applyFunction(f,
                                    argument);
                            res.addAll(_theContext.getCollection(setFragment));
                        }

                        return _theContext.createSet(res);
                    } catch (Exception ex) {
                        throw new FunctionCallException("Failed to create set.",
                                args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$createMap", _theContext.createFunction(new Function() {
                // Create a map that contains the results of applying
                // the second argument (a one argument function) to
                // every element in the first argument (a collection).
                public Object apply(Object[] args) {
                    try {
                        Collection c = _theContext.getCollection(args[0]);
                        FunctionToken f = (FunctionToken) args[1];
                        Object[] argument = new Object[1];
                        Map res = new HashMap();

                        for (Iterator i = c.iterator(); i.hasNext();) {
                            argument[0] = i.next();

                            Object mapFragment = _theContext.applyFunction(f,
                                    argument);
                            res.putAll(_theContext.getMap(mapFragment));
                        }

                        return _theContext.createMap(res);
                    } catch (Exception ex) {
                        throw new FunctionCallException("Failed to create map.",
                                args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("$iterate", _theContext.createProcedure(new Procedure() {
                // Invoke the second argument (a one argument
                // procedure) on every element of the first argument
                // (a collection).
                public void call(Object[] args) {
                    try {
                        Collection c = _theContext.getCollection(args[0]);
                        Object proc = args[1];
                        Object[] argument = new Object[1];

                        for (Iterator i = c.iterator(); i.hasNext();) {
                            argument[0] = i.next();
                            _theContext.callProcedure(proc, argument);
                        }
                    } catch (Exception ex) {
                        throw new FunctionCallException("Iteration failed.",
                                args[0], args[1], ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("listToArray", _theContext.createFunction(new Function() {
                // Convert the given list to an array.
                public Object apply(Object[] args) {
                    try {
                        ObjectToken input = (ObjectToken) args[0];
                        List inputList = (List) input.getValue();
                        Token[] tokens = new Token[inputList.size()];
                        tokens = (Token[]) inputList.toArray(tokens);
                        return new ArrayToken(tokens);
                    } catch (Exception ex) {
                        throw new FunctionCallException("listToArray", args[0], ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("listToMatrix", _theContext.createFunction(new Function() {
                // Convert the given list to an array.
                public Object apply(Object[] args) {
                    try {
                        ObjectToken input = (ObjectToken) args[0];
                        List inputList = (List) input.getValue();
                        Token[] tokens = new Token[inputList.size()];
                        tokens = (Token[]) inputList.toArray(tokens);

                        int rows = _theContext.intValue(args[1]);
                        int columns = _theContext.intValue(args[2]);
                        return MatrixToken.arrayToMatrix(tokens, rows, columns);
                    } catch (Exception ex) {
                        throw new FunctionCallException("listToArray", args[0], ex);
                    }
                }

                public int arity() {
                    return 3;
                }
            }));

            //
            // Xilinx SystemBuilder
            //
            //        constant YSCALE:   INT19 := conv_signed( integer( 1.164 * 256), 19 );
            //        constant RSCALE:   INT19 := conv_signed( integer( 1.596 * 256), 19 );
            //        constant GUSCALE:  INT19 := conv_signed( integer(-0.392 * 256), 19 );
            //        constant GVSCALE:  INT19 := conv_signed( integer(-0.813 * 256), 19 );
            //        constant BSCALE:   INT19 := conv_signed( integer( 2.017 * 256), 19 );
            //        constant YOFFSET:  INT19 := conv_signed(                    16, 19 );
            //        constant UVOFFSET: INT19 := conv_signed(                   128, 19 );
            //
            //        constant UINT9_zero: UINT9 := (others => '0' );
            //
            //        function INT19_mul( a: INT19; b: INT19 ) return INT19;
            //        function RGBCLIP( a: INT19 ) return UINT8;
            env.bind("UINT9_zero", _theContext.createInteger(0));
            env.bind("YSCALE", _theContext.createInteger((int) (1.164 * 256)));
            env.bind("RSCALE", _theContext.createInteger((int) (1.596 * 256)));
            env.bind("GUSCALE", _theContext.createInteger((int) (-0.392 * 256)));
            env.bind("GVSCALE", _theContext.createInteger((int) (-0.813 * 256)));
            env.bind("BSCALE", _theContext.createInteger((int) (2.017 * 256)));

            env.bind("YOFFSET", _theContext.createInteger(16));
            env.bind("UVOFFSET", _theContext.createInteger(128));

            env.bind("INT19_mul", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        IntToken a = (IntToken) args[0];
                        IntToken b = (IntToken) args[1];
                        int res = (a.intValue() * b.intValue()); // & 0x7ffff;
                        return _theContext.createInteger(res);
                    } catch (Exception ex) {
                        throw new InterpreterException(
                                "Function 'RGBCLIP': Cannot apply.", ex);
                    }
                }

                public int arity() {
                    return 2;
                }
            }));

            env.bind("RGBCLIP", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];

                        if (a instanceof IntToken) {
                            int n = ((IntToken) a).intValue() / 256;
                            int res = (n > 255) ? 255 : ((n < 0) ? 0 : n);
                            return _theContext.createInteger(res);
                        } else {
                            throw new InterpreterException(
                                    "RGBCLIP needs an IntToken.");
                        }
                    } catch (Exception ex) {
                        throw new InterpreterException(
                                "Function 'RGBCLIP': Cannot apply.", ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("readByte", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];

                        if (a instanceof ObjectToken) {
                            InputStream s = (InputStream) ((ObjectToken) a)
                                    .getValue();
                            return _theContext.createInteger(s.read());
                        } else {
                            throw new InterpreterException("readByte needs a file.");
                        }
                    } catch (Exception ex) {
                        throw new InterpreterException(
                                "Function 'readByte': Cannot apply.", ex);
                    }
                }

                public int arity() {
                    return 1;
                }
            }));

            env.bind("openFile", _theContext.createFunction(new Function() {
                public Object apply(Object[] args) {
                    try {
                        Token a = (Token) args[0];

                        if (a instanceof StringToken) {
    View Full Code Here

    Examples of cascading.operation.Function

        sources.put( "lower", sourceLower );
        sources.put( "upper", sourceUpper );

        Tap sink = getPlatform().getTextFile( new Fields( "line" ), getOutputPath( "cogroup" ), SinkMode.REPLACE );

        Function splitter = new RegexSplitter( new Fields( "num", "char" ), " " );

        Pipe pipeLower = new Each( new Pipe( "lower" ), new Fields( "line" ), splitter );
        Pipe pipeUpper = new Each( new Pipe( "upper" ), new Fields( "line" ), splitter );

        Pipe splice = new CoGroup( pipeLower, new Fields( "num" ), pipeUpper, new Fields( "num" ), new InnerJoin( Fields.size( 4 ) ) );
    View Full Code Here

    Examples of chunmap.util.Function

        text.setLineWrap(true);
        text.setAutoscrolls(true);
       
        frame.add(text);
       
        tool.onSelectChange.add(new Function(){
          @SuppressWarnings("unchecked")
          @Override
          public Object call(Object... args) {
            List<Feature> fs=(List<Feature>)args[0];
            if(fs.size()==0){
    View Full Code Here

    Examples of co.nubetech.crux.model.Function

        ValueType valueType1 = new ValueType();
        valueType1.setId(1001);
        ValueType valueType2 = new ValueType();
        valueType2.setId(1002);
     
        Function function1 = new Function(1,"FirstFunction", "classFirstFunction", false, valueType1, valueType1);
        Function function2 = new Function(2, "SecondFunction", "classSecondFunction", true, valueType1, valueType2);
        Function function3 = new Function(3,"ThirdFunction", "classThirdFunction", false, valueType1, valueType2);
       
        List<Function> functions = new ArrayList<Function>();
        functions.add(function1);
        functions.add(function2);
        functions.add(function3);
    View Full Code Here

    Examples of com.alibaba.druid.sql.visitor.functions.Function

        }

        public static boolean visit(SQLEvalVisitor visitor, SQLMethodInvokeExpr x) {
            String methodName = x.getMethodName().toLowerCase();

            Function function = visitor.getFunction(methodName);

            if (function == null) {
                function = functions.get(methodName);
            }

            if (function != null) {
                Object result = function.eval(visitor, x);

                if (result != SQLEvalVisitor.EVAL_ERROR) {
                    x.getAttributes().put(EVAL_VALUE, result);
                }
                return false;
    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.