Class: Saxon::XDM::EmptySequence
- Inherits:
-
Object
- Object
- Saxon::XDM::EmptySequence
- Includes:
- SequenceLike
- Defined in:
- lib/saxon/xdm/empty_sequence.rb
Overview
Represents the empty sequence in XDM
Class Method Summary collapse
-
.create ⇒ EmptySequence
Returns an instance.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
All instances of EmptySequence are equal to each other.
-
#hash ⇒ Integer
The hash code.
-
#sequence_enum ⇒ Enumerator
An enumerator over an empty Array.
-
#sequence_size ⇒ Integer
The size of the sequence (always 0).
-
#to_java ⇒ net.sf.saxon.s9api.XDMEmptySequence
The underlying Java empty sequence.
Methods included from SequenceLike
Class Method Details
.create ⇒ EmptySequence
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.
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.
33 34 35 |
# File 'lib/saxon/xdm/empty_sequence.rb', line 33 def ==(other) other.class == self.class end |
#hash ⇒ Integer
Returns 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_enum ⇒ Enumerator
Returns 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_size ⇒ Integer
Returns the size of the sequence (always 0).
25 26 27 |
# File 'lib/saxon/xdm/empty_sequence.rb', line 25 def sequence_size 0 end |