org.jaxen.Context - java examples

Here are the examples of the java api org.jaxen.Context taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

102 Examples 7

19 View Complete Implementation : NoNodeTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    return false;
}

19 View Complete Implementation : UnionPattern.java
Copyright GNU General Public License v3.0
Author : apicloudcom
// Pattern interface
// -------------------------------------------------------------------------
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) throws JaxenException {
    return lhs.matches(node, context) || rhs.matches(node, context);
}

19 View Complete Implementation : PositionFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the position of the context node in the context node-set.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 *
 * @return a <code>Double</code> containing the context position
 *
 * @see Context#getPosition()
 */
public static Double evaluate(Context context) {
    return new Double(context.getPosition());
}

19 View Complete Implementation : LastFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the number of nodes in the context node-set.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 *
 * @return the context size
 *
 * @see Context#getSize()
 */
public static Double evaluate(Context context) {
    return new Double(context.getSize());
}

19 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
// current() function, as per http://tools.ietf.org/html/rfc6020#section-6.4.1
private static NormalizedNodeContext current(final Context context, final List<?> args) throws FunctionCallException {
    if (!args.isEmpty()) {
        throw new FunctionCallException("current() takes no arguments.");
    }
    return verifyContext(context);
}

19 View Complete Implementation : DefaultNumberExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) {
    return getNumber();
}

19 View Complete Implementation : Pattern.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @param node ????
 * @param context ????
 * @return true if the pattern matches the given node
 * @throws JaxenException  if ????
 */
public abstract boolean matches(Object node, Context context) throws JaxenException;

19 View Complete Implementation : NodeTypeTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    return nodeType == context.getNavigator().getNodeType(node);
}

19 View Complete Implementation : NormalizedNodeContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
static NormalizedNodeContext cast(@Nullable final Context context) {
    verify(context instanceof NormalizedNodeContext);
    return (@NonNull NormalizedNodeContext) context;
}

19 View Complete Implementation : DefaultLiteralExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) {
    return getLiteral();
}

19 View Complete Implementation : AnyChildNodeTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    short type = context.getNavigator().getNodeType(node);
    return type == ELEMENT_NODE || type == TEXT_NODE || type == COMMENT_NODE || type == PROCESSING_INSTRUCTION_NODE;
}

19 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
// re-match(string subject, string pattern) function as per https://tools.ietf.org/html/rfc7950#section-10.2.1
private static boolean reMatch(final Context context, final List<?> args) throws FunctionCallException {
    if (args == null || args.size() != 2) {
        throw new FunctionCallException("re-match() takes two arguments: string subject, string pattern.");
    }
    final Object subject = args.get(0);
    if (!(subject instanceof String)) {
        throw new FunctionCallException("First argument of re-match() should be a String.");
    }
    final Object pattern = args.get(1);
    if (!(pattern instanceof String)) {
        throw new FunctionCallException("Second argument of re-match() should be a String.");
    }
    return ((String) subject).matches(RegexUtils.getJavaRegexFromXSD((String) pattern));
}

19 View Complete Implementation : DefaultPredicate.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    return getExpr().evaluate(context);
}

19 View Complete Implementation : AnyNodeTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    return true;
}

18 View Complete Implementation : DefaultFunctionCallExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public List evaluateParams(Context context) throws JaxenException {
    List paramExprs = getParameters();
    int paramSize = paramExprs.size();
    List paramValues = new ArrayList(paramSize);
    for (int i = 0; i < paramSize; ++i) {
        Expr eachParam = (Expr) paramExprs.get(i);
        Object eachValue = eachParam.evaluate(context);
        paramValues.add(eachValue);
    }
    return paramValues;
}

18 View Complete Implementation : DefaultPathExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Object results = null;
    Context pathContext = null;
    if (getFilterExpr() != null) {
        results = getFilterExpr().evaluate(context);
        pathContext = new Context(context.getContextSupport());
        pathContext.setNodeSet(convertToList(results));
    }
    if (getLocationPath() != null) {
        return getLocationPath().evaluate(pathContext);
    }
    return results;
}

18 View Complete Implementation : DefaultRelationalExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Object lhsValue = getLHS().evaluate(context);
    Object rhsValue = getRHS().evaluate(context);
    Navigator nav = context.getNavigator();
    if (bothAreSets(lhsValue, rhsValue)) {
        return evaluateSetSet((List) lhsValue, (List) rhsValue, nav);
    }
    if (eitherIsSet(lhsValue, rhsValue)) {
        if (isSet(lhsValue)) {
            return evaluateSetSet((List) lhsValue, convertToList(rhsValue), nav);
        } else {
            return evaluateSetSet(convertToList(lhsValue), (List) rhsValue, nav);
        }
    }
    return evaluateObjectObject(lhsValue, rhsValue, nav) ? Boolean.TRUE : Boolean.FALSE;
}

18 View Complete Implementation : DefaultVariableReferenceExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws UnresolvableException {
    String namespaceURI = context.translateNamespacePrefixToUri(getPrefix());
    return context.getVariableValue(namespaceURI, prefix, localName);
}

18 View Complete Implementation : DefaultXPathExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public List asList(Context context) throws JaxenException {
    Expr expr = getRootExpr();
    Object value = expr.evaluate(context);
    List result = DefaultExpr.convertToList(value);
    return result;
}

18 View Complete Implementation : EvaluateFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 1) {
        return evaluate(context, args.get(0));
    }
    throw new FunctionCallException("evaluate() requires one argument");
}

18 View Complete Implementation : FalseFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns <code>Boolean.FALSE</code>
 *
 * @param context the context at the point in the
 *         expression when the function is called
 * @param args an empty list
 *
 * @return <code>Boolean.FALSE</code>
 *
 * @throws FunctionCallException if <code>args</code> is not empty
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate();
    }
    throw new FunctionCallException("false() requires no arguments.");
}

18 View Complete Implementation : LastFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the number of nodes in the context node-set.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 * @param args an empty list
 *
 * @return a <code>Double</code> containing the context size
 *
 * @throws FunctionCallException if <code>args</code> is not empty
 *
 * @see Context#getSize()
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate(context);
    }
    throw new FunctionCallException("last() requires no arguments.");
}

18 View Complete Implementation : PositionFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the position of the context node in the context node-set.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 * @param args an empty list
 *
 * @return a <code>Double</code> containing the context position
 *
 * @throws FunctionCallException if <code>args</code> is not empty
 *
 * @see Context#getSize()
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate(context);
    }
    throw new FunctionCallException("position() does not take any arguments.");
}

18 View Complete Implementation : TrueFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns <code>Boolean.TRUE</code>
 *
 * @param context ignored
 * @param args an empty list
 *
 * @return <code>Boolean.TRUE</code>
 *
 * @throws FunctionCallException if <code>args</code> is not empty
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate();
    }
    throw new FunctionCallException("true() requires no arguments.");
}

18 View Complete Implementation : NamespaceTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    Navigator navigator = context.getNavigator();
    String uri = getURI(node, context);
    if (nodeType == Pattern.ELEMENT_NODE) {
        return navigator.isElement(node) && uri.equals(navigator.getElementNamespaceUri(node));
    } else if (nodeType == Pattern.ATTRIBUTE_NODE) {
        return navigator.isAttribute(node) && uri.equals(navigator.getAttributeNamespaceUri(node));
    }
    return false;
}

18 View Complete Implementation : NamespaceTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the URI of the current prefix or "" if no URI can be found
 */
protected String getURI(Object node, Context context) {
    String uri = context.getNavigator().translateNamespacePrefixToUri(prefix, node);
    if (uri == null) {
        uri = context.getContextSupport().translateNamespacePrefixToUri(prefix);
    }
    if (uri == null) {
        uri = "";
    }
    return uri;
}

18 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
// derived-from(node-set nodes, string idenreplacedy) function as per https://tools.ietf.org/html/rfc7950#section-10.4.1
private static boolean derivedFrom(final Context context, final List<?> args) throws FunctionCallException {
    final Entry<IdenreplacedySchemaNode, IdenreplacedySchemaNode> ids = commonDerivedFrom("derived-from", context, args);
    return ids != null && isAncestorOf(ids.getKey(), ids.getValue());
}

18 View Complete Implementation : TextNodeTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * @return true if the pattern matches the given node
 */
public boolean matches(Object node, Context context) {
    return context.getNavigator().isText(node);
}

18 View Complete Implementation : DefaultRelationalExpr.java
Copyright Apache License 2.0
Author : dkmfbk
@Override
public Object evaluate(final Context context) throws JaxenException {
    final Object lhsValue = getLHS().evaluate(context);
    final Object rhsValue = getRHS().evaluate(context);
    final Navigator nav = context.getNavigator();
    if (bothAreSets(lhsValue, rhsValue)) {
        return evaluateSetSet((List) lhsValue, (List) rhsValue, nav);
    }
    if (eitherIsSet(lhsValue, rhsValue)) {
        if (isSet(lhsValue)) {
            return evaluateSetSet((List) lhsValue, convertToList(rhsValue), nav);
        } else {
            return evaluateSetSet(convertToList(lhsValue), (List) rhsValue, nav);
        }
    }
    return evaluateObjectObject(lhsValue, rhsValue, nav) ? Boolean.TRUE : Boolean.FALSE;
}

18 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
// derived-from-or-self(node-set nodes, string idenreplacedy) function as per
// https://tools.ietf.org/html/rfc7950#section-10.4.2
private static boolean derivedFromOrSelf(final Context context, final List<?> args) throws FunctionCallException {
    final Entry<IdenreplacedySchemaNode, IdenreplacedySchemaNode> ids = commonDerivedFrom("derived-from-or-self", context, args);
    return ids != null && (ids.getValue().equals(ids.getKey()) || isAncestorOf(ids.getKey(), ids.getValue()));
}

18 View Complete Implementation : DefaultFilterExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Object results = getExpr().evaluate(context);
    if (results instanceof List) {
        List newresults = getPredicateSet().evaluatePredicates((List) results, context.getContextSupport());
        results = newresults;
    }
    return results;
}

18 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
private static NormalizedNodeContext verifyContext(final Context context) {
    verify(context instanceof NormalizedNodeContext, "Unhandled context %s", context.getClreplaced());
    return (NormalizedNodeContext) context;
}

17 View Complete Implementation : DefaultDivExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number lhsValue = NumberFunction.evaluate(getLHS().evaluate(context), context.getNavigator());
    Number rhsValue = NumberFunction.evaluate(getRHS().evaluate(context), context.getNavigator());
    double result = lhsValue.doubleValue() / rhsValue.doubleValue();
    return new Double(result);
}

17 View Complete Implementation : DefaultEqualityExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Object lhsValue = getLHS().evaluate(context);
    Object rhsValue = getRHS().evaluate(context);
    if (lhsValue == null || rhsValue == null) {
        return Boolean.FALSE;
    }
    Navigator nav = context.getNavigator();
    if (bothAreSets(lhsValue, rhsValue)) {
        return evaluateSetSet((List) lhsValue, (List) rhsValue, nav);
    } else if (isSet(lhsValue) && isBoolean(rhsValue)) {
        Boolean lhsBoolean = ((List) lhsValue).isEmpty() ? Boolean.FALSE : Boolean.TRUE;
        Boolean rhsBoolean = (Boolean) rhsValue;
        return Boolean.valueOf(evaluateObjectObject(lhsBoolean, rhsBoolean, nav));
    } else if (isBoolean(lhsValue) && isSet(rhsValue)) {
        Boolean lhsBoolean = (Boolean) lhsValue;
        Boolean rhsBoolean = ((List) rhsValue).isEmpty() ? Boolean.FALSE : Boolean.TRUE;
        return Boolean.valueOf(evaluateObjectObject(lhsBoolean, rhsBoolean, nav));
    } else if (eitherIsSet(lhsValue, rhsValue)) {
        if (isSet(lhsValue)) {
            return evaluateSetSet((List) lhsValue, convertToList(rhsValue), nav);
        } else {
            return evaluateSetSet(convertToList(lhsValue), (List) rhsValue, nav);
        }
    } else {
        return Boolean.valueOf(evaluateObjectObject(lhsValue, rhsValue, nav));
    }
}

17 View Complete Implementation : DefaultFilterExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns true if the current filter matches at least one of the context nodes
 */
public boolean asBoolean(Context context) throws JaxenException {
    Object results = null;
    if (expr != null) {
        results = expr.evaluate(context);
    } else {
        List nodeSet = context.getNodeSet();
        ArrayList list = new ArrayList(nodeSet.size());
        list.addAll(nodeSet);
        results = list;
    }
    if (results instanceof Boolean) {
        Boolean b = (Boolean) results;
        return b.booleanValue();
    }
    if (results instanceof List) {
        return getPredicateSet().evaluateAsBoolean((List) results, context.getContextSupport());
    }
    return false;
}

17 View Complete Implementation : DefaultMinusExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number lhsValue = NumberFunction.evaluate(getLHS().evaluate(context), context.getNavigator());
    Number rhsValue = NumberFunction.evaluate(getRHS().evaluate(context), context.getNavigator());
    double result = lhsValue.doubleValue() - rhsValue.doubleValue();
    return new Double(result);
}

17 View Complete Implementation : DefaultModExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number lhsValue = NumberFunction.evaluate(getLHS().evaluate(context), context.getNavigator());
    Number rhsValue = NumberFunction.evaluate(getRHS().evaluate(context), context.getNavigator());
    double result = lhsValue.doubleValue() % rhsValue.doubleValue();
    return new Double(result);
}

17 View Complete Implementation : DefaultMultiplyExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number lhsValue = NumberFunction.evaluate(getLHS().evaluate(context), context.getNavigator());
    Number rhsValue = NumberFunction.evaluate(getRHS().evaluate(context), context.getNavigator());
    double result = lhsValue.doubleValue() * rhsValue.doubleValue();
    return new Double(result);
}

17 View Complete Implementation : DefaultPlusExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number lhsValue = NumberFunction.evaluate(getLHS().evaluate(context), context.getNavigator());
    Number rhsValue = NumberFunction.evaluate(getRHS().evaluate(context), context.getNavigator());
    double result = lhsValue.doubleValue() + rhsValue.doubleValue();
    return new Double(result);
}

17 View Complete Implementation : DefaultUnaryExpr.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public Object evaluate(Context context) throws JaxenException {
    Number number = NumberFunction.evaluate(getExpr().evaluate(context), context.getNavigator());
    return new Double(number.doubleValue() * -1);
}

17 View Complete Implementation : ConcatFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Concatenates the arguments and returns the resulting string.
 * Non-string items are first converted to strings as if by the
 * XPath <code>string()<code> function.
 *
 * @param context the context at the point in the
 *         expression when the function is called
 * @param args the list of strings to be concatenated
 *
 * @return a <code>String</code> containing the concatenation of the items
 *     of <code>args</code>
 *
 * @throws FunctionCallException if <code>args</code> has less than two items
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() >= 2) {
        return evaluate(args, context.getNavigator());
    }
    throw new FunctionCallException("concat() requires at least two arguments");
}

17 View Complete Implementation : CountFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * <p>
 * Returns the number of nodes in the specified node-set.
 * </p>
 * @param context ignored
 * @param args the function arguments
 *
 * @return a <code>Double</code> giving the integral number of items in the first argument
 *
 * @throws FunctionCallException if args does not have exactly one
 *     item; or that item is not a <code>List</code>
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 1) {
        return evaluate(args.get(0));
    }
    throw new FunctionCallException("count() requires one argument.");
}

17 View Complete Implementation : LocalNameFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the local-name of the specified node or the context node if
 * no arguments are provided.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 * @param args a <code>List</code> containing zero or one items
 *
 * @return a <code>String</code> containing the local-name
 *
 * @throws FunctionCallException if <code>args</code> has more than one item
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate(context.getNodeSet(), context.getNavigator());
    }
    if (args.size() == 1) {
        return evaluate(args, context.getNavigator());
    }
    throw new FunctionCallException("local-name() requires zero or one argument.");
}

17 View Complete Implementation : NameFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the name of the specified node or the name of the context node if
 * no arguments are provided.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 * @param args a <code>List</code> containing zero or one items
 *
 * @return a <code>String</code> containing the name
 *
 * @throws FunctionCallException if <code>args</code> has more than one item
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate(context.getNodeSet(), context.getNavigator());
    }
    if (args.size() == 1) {
        return evaluate(args, context.getNavigator());
    }
    throw new FunctionCallException("name() requires zero or one argument.");
}

17 View Complete Implementation : NamespaceUriFunction.java
Copyright GNU General Public License v3.0
Author : apicloudcom
/**
 * Returns the namespace URI of the specified node or the namespace URI of the context node if
 * no arguments are provided.
 *
 * @param context the context at the point in the
 *         expression where the function is called
 * @param args a <code>List</code> containing zero or one items
 *
 * @return a <code>String</code> containing the namespace URI
 *
 * @throws FunctionCallException if <code>args</code> has more than one item
 */
public Object call(Context context, List args) throws FunctionCallException {
    if (args.size() == 0) {
        return evaluate(context.getNodeSet(), context.getNavigator());
    }
    if (args.size() == 1) {
        return evaluate(args, context.getNavigator());
    }
    throw new FunctionCallException("namespace-uri() requires zero or one argument.");
}

17 View Complete Implementation : ContextTest.java
Copyright GNU General Public License v3.0
Author : apicloudcom
public void testSetNodeSet() {
    Context original = new Context(this.support);
    replacedertEquals(0, original.getNodeSet().size());
    original.setNodeSet(this.nodeSet);
    replacedertEquals(4, original.getNodeSet().size());
}

17 View Complete Implementation : ValueOf.java
Copyright GNU Lesser General Public License v2.1
Author : deegree
@SuppressWarnings("rawtypes")
@Override
public Object call(Context context, List args) throws FunctionCallException {
    List<Object> values = new ArrayList<Object>();
    for (Object arg : args) {
        if (arg instanceof List) {
            for (Object o : ((List) arg)) {
                if (o instanceof PropertyNode) {
                    Property prop = ((PropertyNode) o).getValue();
                    GMLObject gmlObject = (GMLObject) prop.getValue();
                    GMLObjectNode elNode = new GMLObjectNode(((PropertyNode) o), gmlObject);
                    values.add(elNode);
                } else {
                    throw new FunctionCallException("Arguments of valueOf() must be feature properties, but found: " + o.getClreplaced());
                }
            }
        } else if (arg instanceof PropertyNode) {
            Property prop = ((PropertyNode) arg).getValue();
            GMLObject gmlObject = (GMLObject) prop.getValue();
            GMLObjectNode elNode = new GMLObjectNode(((PropertyNode) arg), gmlObject);
            values.add(elNode);
        } else {
            throw new FunctionCallException("Arguments of valueOf() must be feature properties, but found: " + arg.getClreplaced());
        }
    }
    return values;
}

17 View Complete Implementation : MCRFunctionGenerateID.java
Copyright GNU General Public License v3.0
Author : MyCoRe-Org
@Override
public Object call(Context context, List args) throws FunctionCallException {
    try {
        Object targetNode = args.isEmpty() ? context.getNodeSet().get(0) : ((List) args.get(0)).get(0);
        return "n" + System.idenreplacedyHashCode(targetNode);
    } catch (Exception ex) {
        LOGGER.warn("Exception in call to generate-id", ex);
        return ex.getMessage();
    }
}

17 View Complete Implementation : MCRFunctionTranslate.java
Copyright GNU General Public License v3.0
Author : MyCoRe-Org
@Override
public Object call(Context context, List args) throws FunctionCallException {
    String i18nkey = (String) (args.get(0));
    if (args.size() == 1) {
        return MCRTranslation.translate(i18nkey);
    } else {
        return MCRTranslation.translate(i18nkey, args.subList(1, args.size()));
    }
}

17 View Complete Implementation : YangFunctionContext.java
Copyright Eclipse Public License 1.0
Author : opendaylight
@Nullable
private static Entry<IdenreplacedySchemaNode, IdenreplacedySchemaNode> commonDerivedFrom(final String functionName, final Context context, final List<?> args) throws FunctionCallException {
    if (args == null || args.size() != 1) {
        throw new FunctionCallException(functionName + "() takes two arguments: node-set nodes, string idenreplacedy");
    }
    if (!(args.get(0) instanceof String)) {
        throw new FunctionCallException("Argument 'idenreplacedy' of " + functionName + "() function should be a String.");
    }
    final NormalizedNodeContext currentNodeContext = verifyContext(context);
    final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
    final SchemaContext schemaContext = getSchemaContext(currentNodeContext);
    return correspondingSchemaNode.getType() instanceof IdenreplacedyrefTypeDefinition && currentNodeContext.getNode().getValue() instanceof QName ? new SimpleImmutableEntry<>(getIdenreplacedySchemaNodeFromString((String) args.get(0), schemaContext, correspondingSchemaNode), getIdenreplacedySchemaNodeFromQName((QName) currentNodeContext.getNode().getValue(), schemaContext)) : null;
}