Class StateElement

  • All Implemented Interfaces:
    IState

    class StateElement
    extends java.lang.Object
    implements IState
    A wrapper class used to read from an XML document using the IState interface.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.w3c.dom.Element element  
      private static IState[] NO_CHILDREN  
    • Constructor Summary

      Constructors 
      Constructor Description
      StateElement​(org.w3c.dom.Element element)
      Create a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAttribute​(java.lang.String key)
      Gets a named attribute value.
      java.lang.String[] getAttributeKeys()
      Return an array with the attribute keys for this state.
      IState getChild​(java.lang.String type)
      Gets a child of the named type.
      IState[] getChildren()
      Gets all child nodes.
      IState[] getChildren​(java.lang.String type)
      Gets all child nodes of a named type.
      java.lang.String getType()
      Get the node type of this state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_CHILDREN

        private static final IState[] NO_CHILDREN
      • element

        private final org.w3c.dom.Element element
    • Constructor Detail

      • StateElement

        StateElement​(org.w3c.dom.Element element)
        Create a new instance.
        Parameters:
        element - XML element to wrap
    • Method Detail

      • getType

        public java.lang.String getType()
        Description copied from interface: IState
        Get the node type of this state.
        Specified by:
        getType in interface IState
        Returns:
        node type
      • getAttributeKeys

        public java.lang.String[] getAttributeKeys()
        Description copied from interface: IState
        Return an array with the attribute keys for this state.
        Specified by:
        getAttributeKeys in interface IState
        Returns:
        attribute keys
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key)
        Description copied from interface: IState
        Gets a named attribute value.
        Specified by:
        getAttribute in interface IState
        Parameters:
        key - attribute key
        Returns:
        attribute value
      • getChild

        public IState getChild​(java.lang.String type)
        Description copied from interface: IState
        Gets a child of the named type. If there are several child nodes of the same type then any of them may be returned.
        Specified by:
        getChild in interface IState
        Parameters:
        type - node type
        Returns:
        child node or null if no such child exists
      • getChildren

        public IState[] getChildren()
        Description copied from interface: IState
        Gets all child nodes.
        Specified by:
        getChildren in interface IState
        Returns:
        an array of child nodes
      • getChildren

        public IState[] getChildren​(java.lang.String type)
        Description copied from interface: IState
        Gets all child nodes of a named type.
        Specified by:
        getChildren in interface IState
        Parameters:
        type - node type
        Returns:
        an array of child nodes