Debian Codegraph @

net/sf/saxon/s9api/XdmEmptySequence.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.s9api;
9
10 import net.sf.saxon.value.EmptySequence;
11
12 /**
13 * The class <tt>XdmEmptySequence</tt> represents an empty sequence in the XDM Data Model.
14 * <p>This is a singleton class: there is only one instance, which may be obtained
15 * using the {@link #getInstance} method.</p>
16 * <p>An empty sequence may also be represented by an {@link XdmValue} whose length happens to be zero.
17 * Applications should therefore not test to see whether an object is an instance of this class
18 * in order to decide whether it is empty.</p>
19 * <p>Note: in interfaces that expect an {@link XdmItem}, an empty sequence is represented by a
20 * Java null value.</p>
21 */
22
23 public class XdmEmptySequence extends XdmValue {
24
25 private static XdmEmptySequence THE_INSTANCE = new XdmEmptySequence();
26
27 /**
28 * Return the singleton instance of this class
29 *
30 * @return an XdmValue representing an empty sequence
31 */
32
33 /*@NotNull*/
34 public static XdmEmptySequence getInstance() {
35 return THE_INSTANCE;
36 }
37
38 private XdmEmptySequence() {
39 super(EmptySequence.getInstance());
40 }
41
42 /**
43 * Get the number of items in the sequence
44 *
45 * @return the number of items in the value - always zero
46 */
47
48 @Override
49 public int size() {
50 return 0;
51 }
52 }