Class BooleanNode

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

public class BooleanNode extends AbstractNode
This class implements a node that contains a Boolean value.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final NodeType
    The type of a Boolean node.
    static final String
    The string representation of a Boolean node whose value is false.
    static final String
    The string representation of a Boolean node whose value is true.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BooleanNode(boolean value)
    Creates a new instance of a Boolean node that has no parent and has the specified value.
    BooleanNode(AbstractNode parent, boolean value)
    Creates a new instance of a Boolean node that has the specified parent and value.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of this Boolean node that has no parent.
    boolean
    Returns true if the specified object is an instance of BooleanNode and it has the same value as this Boolean node.
    Returns the type of this node.
    boolean
    Returns the value of this Boolean node.
    int
    Returns the hash code of this Boolean node.
    boolean
    Returns true if this node can contain other nodes.
    static boolean[]
    Returns an array whose elements are the values of the specified Boolean nodes, with the order of the elements preserved.
    static List<Boolean>
    nodesToList(Iterable<? extends BooleanNode> nodes)
    Returns a list whose elements are the values of the specified Boolean nodes, with the order of the elements preserved.
    Returns a string representation of this Boolean node.
    valuesToNodes(boolean... values)
    Creates a list of Boolean nodes for the specified values, preserving the order of the elements, and returns the list, which may be used to construct a list node.
    Creates a list of Boolean nodes for the specified values, preserving the order of the elements, and returns the list, which may be used to construct a list node.

    Methods inherited from class uk.blankaspect.common.basictree.AbstractNode

    getChildren, getListIndex, getMapKey, getParent, isRoot, setParent

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface uk.blankaspect.common.tree.ITreeNode

    isLeaf
  • Field Details

    • VALUE_FALSE

      public static final String VALUE_FALSE
      The string representation of a Boolean node whose value is false.
      See Also:
    • VALUE_TRUE

      public static final String VALUE_TRUE
      The string representation of a Boolean node whose value is true.
      See Also:
    • TYPE

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

    • BooleanNode

      public BooleanNode(boolean value)
      Creates a new instance of a Boolean node that has no parent and has the specified value.
      Parameters:
      value - the value of the Boolean node.
    • BooleanNode

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

    • valuesToNodes

      public static List<BooleanNode> valuesToNodes(boolean... values)
      Creates a list of Boolean 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 Boolean nodes will be created.
      Returns:
      a list of Boolean nodes whose underlying values are values.
    • valuesToNodes

      public static List<BooleanNode> valuesToNodes(Iterable<Boolean> values)
      Creates a list of Boolean 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 Boolean nodes will be created.
      Returns:
      a list of Boolean nodes whose underlying values are values.
    • nodesToArray

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

      public static List<Boolean> nodesToList(Iterable<? extends BooleanNode> nodes)
      Returns a list whose elements are the values of the specified Boolean nodes, with the order of the elements preserved.
      Parameters:
      nodes - the Boolean 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 Boolean 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 BooleanNode and it has the same value as this Boolean node.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object with which this Boolean node will be compared.
      Returns:
      true if obj is an instance of BooleanNode and it has the same value as this Boolean node ; false otherwise.
    • hashCode

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

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

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

      public boolean getValue()
      Returns the value of this Boolean node.
      Returns:
      the value of this Boolean node.