Debian Codegraph @

net/sf/saxon/functions/Adjust_1.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.functions;
9
10 import net.sf.saxon.expr.XPathContext;
11 import net.sf.saxon.om.Sequence;
12 import net.sf.saxon.om.ZeroOrOne;
13 import net.sf.saxon.trans.XPathException;
14 import net.sf.saxon.value.CalendarValue;
15
16 /**
17 * This class implements the XPath 2.0 functions
18 * adjust-date-to-timezone(), adjust-time-timezone(), and adjust-dateTime-timezone(),
19 * with a single argument
20 */
21
22
23 public class Adjust_1 extends SystemFunction {
24
25 /**
26 * Evaluate the expression
27 *
28 * @param context the dynamic evaluation context
29 * @param arguments the values of the arguments, supplied as Sequences
30 * @return the result of the evaluation, in the form of a Sequence
31 * @throws net.sf.saxon.trans.XPathException
32 * if a dynamic error occurs during the evaluation of the expression
33 */
34 public ZeroOrOne<CalendarValue> call(XPathContext context, Sequence[] arguments) throws XPathException {
35 CalendarValue in = (CalendarValue) arguments[0].head();
36 if (in == null) {
37 return ZeroOrOne.empty();
38 } else {
39 return new ZeroOrOne<>(in.adjustTimezone(context.getImplicitTimezone()));
40 }
41 }
42 }
43