Saxon.Api

 

 

Saxon.Api

Class XdmArray


public class XdmArray
extends XdmFunctionItem

The class XdmArray represents an array item in an XDM 3.1 sequence: this is a new kind of item in the XDM data model. An array is a list of zero or more members, each of which is an arbitrary XDM value. An array is also a function: it maps a positive integer to the array member found at that position in the array.

Constructor Summary

XdmArray ()

Constructor to create an empty XdmArray

XdmArray (XdmValue value)

Create an XdmArray whose members are single items, corresponding one-to-one with the items making up a supplied sequence.

XdmArray (XdmValue[] members)

Create an XdmArray supplying the members as an array of XdmValue objects.

XdmArray (List<XdmValue> members)

Create an XdmArray supplying the members as a list of XdmValue objects

 

Method Summary

 XdmArray AppendMember (XdmValue value)

Append a new member to an array

 int ArrayLength ()

Get the number of members in the array

 List<XdmValue> AsList ()

Get the members of the array in the form of a list.

 XdmArray Concat (XdmArray value)

Concatenate another array

 XdmValue Get (int n)

Get the n'th member in the array, counting from zero.

static XdmArray MakeArray (object[] objectArray)

Make an XDM array from an object array. Each member of the supplied array is converted to a single member in the result array using the method XdmValue.MakeValue(Object)

static XdmArray MakeArray (bool[] booleanArray)

Make an XdmArray whose members are xs:boolean values

static XdmArray MakeArray (long[] longArray)

Make an XdmArray whose members are xs:integer values

static XdmArray MakeArray (int[] intArray)

Make an XdmArray whose members are xs:integer values

static XdmArray MakeArray (Byte[] byteArray)

Make an XdmArray whose members are xs:integer values

 XdmArray Put (int n, XdmValue valuei)

Create a new array in which one member is replaced with a new value.

 

Constructor Detail

XdmArray

public XdmArray()

Constructor to create an empty XdmArray

XdmArray

public XdmArray(XdmValue value)

Create an XdmArray whose members are single items, corresponding one-to-one with the items making up a supplied sequence.

Parameters:

value - A sequence of items; each item becomes a member of the array.

XdmArray

public XdmArray(XdmValue[] members)

Create an XdmArray supplying the members as an array of XdmValue objects.

Parameters:

members - An array of XdmValue objects. Note that subsequent changes to the array will have no effect on the XdmArray.

XdmArray

public XdmArray(List<XdmValue> members)

Create an XdmArray supplying the members as a list of XdmValue objects

Note that the argument can be a single XdmValue representing a sequence, in which case the constructed array will have one member for each item in the supplied sequence.

Parameters:

members - A sequence of XdmValue objects. Note that if this is supplied as a list or similar collection, subsequent changes to the list/collection will have no effect on the XdmValue.

Method Detail

AppendMember

public XdmArray AppendMember(XdmValue value)

Append a new member to an array

Parameters:

value - the new member

Returns:

a new array, one item longer than the original

ArrayLength

public int ArrayLength()

Get the number of members in the array

(Note that the XdmValue.Count property returns 1 (one), because an XDM array is an item.)

Returns:

the number of members in the array.

AsList

public List<XdmValue> AsList()

Get the members of the array in the form of a list.

Returns:

A list of the members of this array.

Concat

public XdmArray Concat(XdmArray value)

Concatenate another array

Parameters:

value - the other array

Returns:

a new array, containing the members of this array followed by the members of the other array

Get

public XdmValue Get(int n)

Get the n'th member in the array, counting from zero.

Parameters:

n - the position of the member that is required, counting the first member in the array as member zero

Returns:

the n'th member in the sequence making up the array, counting from zero

MakeArray

public static XdmArray MakeArray(object[] objectArray)

Make an XDM array from an object array. Each member of the supplied array is converted to a single member in the result array using the method XdmValue.MakeValue(Object)

Parameters:

objectArray - the array of objects

Returns:

the result of the conversion if successful

MakeArray

public static XdmArray MakeArray(bool[] booleanArray)

Make an XdmArray whose members are xs:boolean values

Parameters:

booleanArray - the input array of booleans

Returns:

an XdmArray whose members are xs:boolean values corresponding one-to-one with the input

MakeArray

public static XdmArray MakeArray(long[] longArray)

Make an XdmArray whose members are xs:integer values

Parameters:

longArray - the input array of long values

Returns:

an XdmArray whose members are xs:integer values corresponding one-to-one with the input

MakeArray

public static XdmArray MakeArray(int[] intArray)

Make an XdmArray whose members are xs:integer values

Parameters:

intArray - the input array of int values

Returns:

an XdmArray whose members are xs:integer values corresponding one-to-one with the input

MakeArray

public static XdmArray MakeArray(Byte[] byteArray)

Make an XdmArray whose members are xs:integer values

Parameters:

byteArray - the input array of byte values

Returns:

an XdmArray whose members are xs:integer values corresponding one-to-one with the input

Put

public XdmArray Put(int n,
XdmValue valuei)

Create a new array in which one member is replaced with a new value.

Parameters:

n - the position of the member that is to be replaced, counting the first member in the array as member zero
valuei - the new value

Returns:

the new array