Class JNodeForMapEntry

All Implemented Interfaces:
GNode, GroundedValue, Item, Sequence, SiblingCountingNode

public class JNodeForMapEntry extends ChildJNode implements SiblingCountingNode
A child JNode that wraps an entry in a map
  • Constructor Details

    • JNodeForMapEntry

      public JNodeForMapEntry(JNode parent, int position, AtomicValue selector, GroundedValue value, int serialNr)
      Create a JNode wrapping an entry in a map
      Parameters:
      parent - the JNode whose content includes the containing map
      position - the 1-based position of the containing map within the content of the parent
      selector - the key of the relevant map entry within its containing map
      value - the value corresponding to this key
      serialNr - a sequential number representing the sibling position of this entry; may be -1 if not initially known
  • Method Details

    • getSiblingPosition

      public int getSiblingPosition()
      Get the index position of this node among its siblings (starting from 0)
      Specified by:
      getSiblingPosition in interface SiblingCountingNode
      Returns:
      0 for the first child, 1 for the second child, etc.
    • iterateFollowingSiblingAxis

      public SequenceIterator iterateFollowingSiblingAxis(NodePredicate predicate)
      Get an iterator over the following-sibling axis, starting at this node; the nodes will be in document order.
      Specified by:
      iterateFollowingSiblingAxis in interface GNode
      Specified by:
      iterateFollowingSiblingAxis in class ChildJNode
      Parameters:
      predicate - a condition that the nodes must satisfy, or null
      Returns:
      the required iterator
    • iteratePrecedingSiblingAxis

      public SequenceIterator iteratePrecedingSiblingAxis(NodePredicate predicate)
      Get an iterator over the preceding-sibling axis, starting at this node; the nodes will be in reverse document order.
      Specified by:
      iteratePrecedingSiblingAxis in interface GNode
      Specified by:
      iteratePrecedingSiblingAxis in class ChildJNode
      Parameters:
      predicate - a condition that the nodes must satisfy, or null
      Returns:
      the required iterator
    • compareOrder

      public int compareOrder(GNode other)
      Compare document order of this node against another node.

      The other node must always be in the same tree; the effect of calling this method when the two nodes are in different trees is undefined. To obtain a global ordering of nodes, the application should first compare the result of getDocumentNumber(), and only if the document number is the same should compareOrder() be called.

      Specified by:
      compareOrder in interface GNode
      Parameters:
      other - the other node
      Returns:
      -1 if this node precedes the other, 0 if they are the same node, +1 if this node follows the other
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • allocateSerialNr

      protected void allocateSerialNr()
    • generateId

      public void generateId(StringBuilder buffer)
      Construct a character string that uniquely identifies this node. Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
      Specified by:
      generateId in interface GNode
      Parameters:
      buffer - a buffer which will be updated to hold a string that uniquely identifies this node, across all documents.
      Since:
      8.7

      Changed in Saxon 8.7 to generate the ID value in a client-supplied buffer