Interface TreeSerializer

All Known Implementing Classes:
ConsoleTreeSerializer, HtmlTreeSerializer, TreeSerializerMock, TxtTreeSerializer

public interface TreeSerializer
Defines the operations to be defined so that a tree could be stored
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterTraversing(Node node, int depth, boolean hasBeenVisited)
    This method is called after one node is traversed
    void
    beforeTraversing(Node node, int depth, boolean hasBeenVisited)
    This method is called after the whole tree has been traversed
    void
    This method is called at the beginning of the tree traversal
    void
    This method is called after the whole tree has been traversed
    void
    traversing(Node node, int depth, boolean hasBeenVisited)
    This method is called when a node is being traversed
  • Method Details

    • beginTraverse

      void beginTraverse() throws IOException
      This method is called at the beginning of the tree traversal
      Throws:
      IOException - if there is an error writing the tree
    • endTraverse

      void endTraverse() throws IOException
      This method is called after the whole tree has been traversed
      Throws:
      IOException - if there is an error writing the tree
    • beforeTraversing

      void beforeTraversing(Node node, int depth, boolean hasBeenVisited) throws IOException
      This method is called after the whole tree has been traversed
      Parameters:
      node - the node that is up to be traversed
      depth - the depth of the node
      hasBeenVisited - if the node has already been visited in the current traversal (to detect cycles)
      Throws:
      IOException - if there is an error writing the tree
    • traversing

      void traversing(Node node, int depth, boolean hasBeenVisited) throws IOException
      This method is called when a node is being traversed
      Parameters:
      node - the node that is up being traversed
      depth - the depth of the node
      hasBeenVisited - if the node has already been visited in the current traversal (to detect cycles)
      Throws:
      IOException - if there is an error writing the tree
    • afterTraversing

      void afterTraversing(Node node, int depth, boolean hasBeenVisited) throws IOException
      This method is called after one node is traversed
      Parameters:
      node - the node that has just been traversed
      depth - the depth of the node
      hasBeenVisited - if the node has already been visited in the current traversal (to detect cycles)
      Throws:
      IOException - if there is an error writing the tree