Class LongNode

java.lang.Object
uk.blankaspect.common.basictree.AbstractNode
uk.blankaspect.common.basictree.LongNode
All Implemented Interfaces:
Cloneable, ITreeNode<AbstractNode>

public class LongNode extends AbstractNode
This class implements a node that contains a long integer.
  • Field Details

    • TYPE

      public static final NodeType TYPE
      The type of a 'long' node.
  • Constructor Details

    • LongNode

      public LongNode(long value)
      Creates a new instance of a 'long' node that has no parent and has the specified value.
      Parameters:
      value - the value of the 'long' node.
    • LongNode

      public LongNode(AbstractNode parent, long value)
      Creates a new instance of a 'long' node that has the specified parent and value.
      Parameters:
      parent - the parent of the 'long' node.
      value - the value of the 'long' node.
  • Method Details

    • valuesToNodes

      public static List<LongNode> valuesToNodes(long... values)
      Creates a list of 'long' nodes for the specified values, preserving the order of the elements, and returns the list, which may be used to construct a list node.
      Parameters:
      values - the values for which 'long' nodes will be created.
      Returns:
      a list of 'long' nodes whose underlying values are values.
    • valuesToNodes

      public static List<LongNode> valuesToNodes(Iterable<Long> values)
      Creates a list of 'long' nodes for the specified values, preserving the order of the elements, and returns the list, which may be used to construct a list node.
      Parameters:
      values - the values for which 'long' nodes will be created.
      Returns:
      a list of 'long' nodes whose underlying values are values.
    • nodesToArray

      public static long[] nodesToArray(Collection<? extends LongNode> nodes)
      Returns an array whose elements are the values of the specified 'long' nodes, with the order of the elements preserved.
      Parameters:
      nodes - the 'long' nodes whose values will be extracted into an array.
      Returns:
      an array whose elements are the values of nodes.
    • nodesToList

      public static List<Long> nodesToList(Iterable<? extends LongNode> nodes)
      Returns a list whose elements are the values of the specified 'long' nodes, with the order of the elements preserved.
      Parameters:
      nodes - the 'long' nodes whose values will be extracted into a list.
      Returns:
      a list whose elements are the values of nodes.
    • getType

      public NodeType getType()
      Description copied from class: AbstractNode
      Returns the type of this node.
      Specified by:
      getType in class AbstractNode
      Returns:
      TYPE.
    • isContainer

      public boolean isContainer()
      Returns true if this node can contain other nodes. For a 'long' node, this method always returns false.
      Specified by:
      isContainer in class AbstractNode
      Returns:
      false.
    • equals

      public boolean equals(Object obj)
      Returns true if the specified object is an instance of LongNode and it has the same value as this 'long' node.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object with which this 'long' node will be compared.
      Returns:
      true if obj is an instance of LongNode and it has the same value as this 'long' node; false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash code of this 'long' node.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of this 'long' node.
    • clone

      public LongNode clone()
      Creates and returns a copy of this 'long' node that has no parent.
      Overrides:
      clone in class AbstractNode
      Returns:
      a copy of this 'long' node that has no parent.
    • toString

      public String toString()
      Returns a string representation of this 'long' node.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this 'long' node.
    • getValue

      public long getValue()
      Returns the value of this 'long' node.
      Returns:
      the value of this 'long' node.