Class ElementItem

java.lang.Object
org.rumbledb.items.xml.ElementItem
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, Item

public class ElementItem extends Object implements Item
See Also:
  • Constructor Details

    • ElementItem

      public ElementItem()
    • ElementItem

      public ElementItem(String nodeName, List<Item> children, List<Item> attributes)
      Constructor for an element item.
      Parameters:
      nodeName - The name of the element
      children - The children items of the element
      attributes - The attributes items of the element
    • ElementItem

      public ElementItem(Node elementNode, List<Item> children, List<Item> attributes)
  • Method Details

    • setXmlDocumentPosition

      public int setXmlDocumentPosition(String path, int current)
      Description copied from interface: Item
      Set the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness
      Specified by:
      setXmlDocumentPosition in interface Item
      Parameters:
      path - the path of the XML document
      current - the current position
      Returns:
      the new position
    • getXmlDocumentPosition

      public XMLDocumentPosition getXmlDocumentPosition()
      Description copied from interface: Item
      Get the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness
      Specified by:
      getXmlDocumentPosition in interface Item
      Returns:
      the XML document position
    • addParentToDescendants

      public void addParentToDescendants()
      Description copied from interface: Item
      Method sets the parent item for all descendents of the current item.
      Specified by:
      addParentToDescendants in interface Item
    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • isNode

      public boolean isNode()
      Description copied from interface: Item
      Tests whether the item is an XML node.
      Specified by:
      isNode in interface Item
      Returns:
      true if it is an XML node, false otherwise.
    • isElementNode

      public boolean isElementNode()
      Description copied from interface: Item
      Tests whether the item is an XML Element node.
      Specified by:
      isElementNode in interface Item
      Returns:
      true if it is an XML Element node, false otherwise.
    • equals

      public boolean equals(Object other)
      Description copied from interface: Item
      Tests for logical equality. The semantics are that of the eq operator.
      Specified by:
      equals in interface Item
      Overrides:
      equals in class Object
      Parameters:
      other - another item.
      Returns:
      true it is equal to other, false otherwise.
    • attributes

      public List<Item> attributes()
      Specified by:
      attributes in interface Item
    • children

      public List<Item> children()
      Specified by:
      children in interface Item
    • nodeName

      public String nodeName()
      Specified by:
      nodeName in interface Item
    • parent

      public Item parent()
      Specified by:
      parent in interface Item
    • getStringValue

      public String getStringValue()
      Description copied from interface: Item
      Returns the string value of the item, if it is an atomic item.
      Specified by:
      getStringValue in interface Item
      Returns:
      the string value.
    • getDynamicType

      public ItemType getDynamicType()
      Description copied from interface: Item
      Returns the dynamic type of the item (only for error message purposes).
      Specified by:
      getDynamicType in interface Item
      Returns:
      the dynamic type as an item type.
    • setParent

      public void setParent(Item parent)
      Specified by:
      setParent in interface Item
    • hashCode

      public int hashCode()
      Description copied from interface: Item
      Computes a hash code.
      Specified by:
      hashCode in interface Item
      Overrides:
      hashCode in class Object
      Returns:
      a hash code as an int.
    • atomizedValue

      public List<Item> atomizedValue()
      Specified by:
      atomizedValue in interface Item
    • getEffectiveBooleanValue

      public boolean getEffectiveBooleanValue()
      Description copied from interface: Item
      Returns the effective boolean value of the item, if atomic.
      Specified by:
      getEffectiveBooleanValue in interface Item
      Returns:
      the effective boolean value.