Maps a static method to an EL function.
@param prefix The namespace of the functions, can be "".
@param function The name of the function.
@param meth The static method to be invoked when the function is used.
358331
public void mapFunction(String prefix, String function, Method meth) {
        getELContext().getFunctionMapper().mapFunction(prefix, function, meth);
    }
793890
def log(prefix = ''):
    '''

    '''

    function = None

    if inspect.isfunction(prefix):
        prefix, function = '', prefix

    def _(function):
        @functools.wraps(function, assigned = functools.WRAPPER_ASSIGNMENTS + ( '__file__', ))
        def wrapper(*args, **kwargs):
            name, my_args = function.__name__, args

            if inspect.ismethod(function):
                name = function.__self__.__class__.__name__ + '.' + function.__name__
            elif len(args):
                members = dict(inspect.getmembers(args[0], predicate = lambda _: inspect.ismethod(_) and _.__name__ == function.__name__))
                logger.debug('members.keys(): %s', members.keys())

                if len(members):
                    name, my_args = args[0].__class__.__name__ + '.' + function.__name__, args[1:]

            format_args = (
                prefix + name,
                ', '.join(list(map(str, my_args)) + [ ' = '.join(map(str, item)) for item in kwargs.items() ]),
            )

            logger.info('STARTING: %s(%s)', *format_args)

            try:
                return function(*args, **kwargs)
            except:
                logger.exception('EXCEPTION: %s(%s)', *format_args)
                raise
            finally:
                logger.info('STOPPING: %s(%s)', *format_args)

        return wrapper

    if function is not None:
        _ = _(function)

    return _
173225
public static <A, B> Mapper<A, B> fromFunction(final Function<A, B> function) {
    return new Mapper<A, B>() {
      @Override
      public B map(A item) {
        return function.apply(item);
      }
    };
  }
792415
def meth_once(f):
  ""
  attr = '__meth_once_'+f.__name__
  @functools.wraps(f)
  def f2(self,*args,**kwargs):
    if hasattr(self,attr): raise CallOnceError(f.__name__)
    setattr(self,attr,True)
    return f(self,*args,**kwargs)
  return f2
258663
@Override
    public Method resolveFunction(String prefix, String localName) {
        Function f = this.functions.get(prefix + ":" + localName);
        if (f == null) {
            return null;
        }
        return f.getMethod();
    }
1184385
public static FunctionMapper newFunctionMapper() {
        ServiceLoader<FunctionMapperSpi> loader = loadFunctionMapperSpi();

        // load FunctionMapperSpi instances
        ConcurrentMap<String, FunctionMapperSpi> functionMappers = new ConcurrentHashMap<>();
        for (FunctionMapperSpi functionMapperSpi : loader) {
            String prefixName = functionMapperSpi.getPrefixName();
            FunctionMapperSpi oldFunctionMapperSpi = functionMappers.putIfAbsent(prefixName, functionMapperSpi);
            if (oldFunctionMapperSpi != null) {
                throw new ELException(String.format("Duplicate prefix function mapper: %s", prefixName));
            }
        }

        return new FunctionMapper(functionMappers);
    }
450618
public void setFunction(String prefix, String localName, Method method) {
		if (functions == null) {
			functions = new Functions();
		}
		functions.setFunction(prefix, localName, method);
	}
68124
public void endPrefixMapping(String prefix) throws SAXException
  {

    if (DEBUG)
      System.out.println("TransformerHandlerImpl#endPrefixMapping: "
                         + prefix);

    if (m_contentHandler != null)
    {
      m_contentHandler.endPrefixMapping(prefix);
    }
  }
1272888
private static void removePrefixFromChildren(Element el, String prefix)
			throws MarshalException {

		NodeList nl = el.getChildNodes();
		String localPrefix = null;
		for (int i = 0; i < nl.getLength(); i++) {
			Node n = nl.item(i);

			if (n.getNodeType() != Node.ELEMENT_NODE) {
				continue;
			}

			localPrefix = n.getPrefix();

			if (localPrefix != null && localPrefix.length() > 0) {

				if (!localPrefix.equals(prefix)) {
					IfmapJLog.warn("Extended Identifier: Multiple namespaces in extended identifer used."
							+ "IfmapJ thinks this is not a wise idea. Sorry!");
					throw new MarshalException("Extended Identifier: Multiple namespaces in extended identifer used."
							+ "IfmapJ thinks this is not a wise idea. Sorry!");
				}

				n.setPrefix(null);
			}

			removePrefixFromChildren((Element) n, prefix);
			dropNamespaceDecls((Element) n);

		}
	}
898664
private void mergeMethodHandleStore(final int index, final MethodHandle methodHandle) {
        localVariables.merge(index, new MethodHandle(methodHandle), Element::merge);
    }
177941
@Deprecated
    static <T, R> Function<T, R> indexedd(final IndexedFunction<T, R> func) {
        return Functions.indexed(func);
    }
727672
public Method resolveFunction(String prefix, String localName)
    {
        if (_functions != null)
        {
            Function f = (Function) _functions.get(prefix + ":" + localName);
            return f.getMethod();
        }
        
        return null;
    }
844905
public static void exports(Xml root, CollisionFunction function)
    {
        Check.notNull(root);
        Check.notNull(function);

        final Xml node = root.createChild(FUNCTION);
        if (function instanceof CollisionFunctionLinear)
        {
            final CollisionFunctionLinear linear = (CollisionFunctionLinear) function;
            node.writeString(TYPE, CollisionFunctionType.LINEAR.name());
            node.writeDouble(A, linear.getA());
            node.writeDouble(B, linear.getB());
        }
        else
        {
            node.writeString(TYPE, String.valueOf(function.getType()));
        }
    }
332814
function _bindAll(methods, ctx) {
	var ret = {};
	for (var key in methods) {
		ret[key] = (typeof methods[key] !== "function" ? _bindAll(methods[key], ctx) : methods[key].bind(ctx));
	}
	return ret;
}
1080991
@SequentialOnly
    public static <T> Function<T, Indexed<T>> indexed() {
        return new Function<T, Indexed<T>>() {
            private final MutableLong idx = new MutableLong(0);

            @Override
            public Indexed<T> apply(T t) {
                return Indexed.of(t, idx.getAndIncrement());
            }
        };
    }
1222291
function dispatch(methodName, inDocument, xpath, contextNode, namespaceResolver) {
        xpath = preprocess(xpath);

        if (! contextNode) {
            contextNode = inDocument;
        }

        var result = getEngineFor(inDocument)
            .setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue)
            [methodName](xpath, contextNode, namespaceResolver);

        return result;
    }
180919
@Override
    public Method resolveFunction(String prefix, String localName) {
        if (this.memento == null) {
            this.memento = new FunctionMapperImpl();
        }
        Method m = this.target.resolveFunction(prefix, localName);
        if (m != null) {
            this.memento.mapFunction(prefix, localName, m);
        }
        return m;
    }