Class: Saxon::XDM::EmptySequence

Inherits:
Object
  • Object
show all
Includes:
SequenceLike
Defined in:
lib/saxon/xdm/empty_sequence.rb

Overview

Represents the empty sequence in XDM

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SequenceLike

#append

Class Method Details

.createEmptySequence

Returns an instance. Effectively a Singleton because the EmptySequence is immutable, and empty. An instance is completely interchangeable with another. The instance is cached, but multiple instances may exist across threads. We don’t prevent that because it’s immaterial.

Returns:



13
14
15
# File 'lib/saxon/xdm/empty_sequence.rb', line 13

def self.create
  @instance ||= new
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

All instances of Saxon::XDM::EmptySequence are equal to each other.

Parameters:

  • other (Object)

    the object to compare self against

Returns:

  • (Boolean)

    Whether this object is equal to the other



33
34
35
# File 'lib/saxon/xdm/empty_sequence.rb', line 33

def ==(other)
  other.class == self.class
end

#hashInteger

Returns the hash code. All instances have the same hash code.

Returns:

  • (Integer)

    the hash code. All instances have the same hash code.



40
41
42
# File 'lib/saxon/xdm/empty_sequence.rb', line 40

def hash
  [].hash
end

#sequence_enumEnumerator

Returns an enumerator over an empty Array.

Returns:

  • (Enumerator)

    an enumerator over an empty Array



20
21
22
# File 'lib/saxon/xdm/empty_sequence.rb', line 20

def sequence_enum
  [].to_enum
end

#sequence_sizeInteger

Returns the size of the sequence (always 0).

Returns:

  • (Integer)

    the size of the sequence (always 0)



25
26
27
# File 'lib/saxon/xdm/empty_sequence.rb', line 25

def sequence_size
  0
end

#to_javanet.sf.saxon.s9api.XDMEmptySequence

Returns the underlying Java empty sequence.

Returns:

  • (net.sf.saxon.s9api.XDMEmptySequence)

    the underlying Java empty sequence



45
46
47
# File 'lib/saxon/xdm/empty_sequence.rb', line 45

def to_java
  @s9_xdm_empty_sequence ||= Saxon::S9API::XdmEmptySequence.getInstance
end