Class Visit<R>

  • Type Parameters:
    R - type of object that should be returned by the visit/traversal
    All Implemented Interfaces:
    IVisit<R>

    public class Visit<R>
    extends Object
    implements IVisit<R>
    Implementation of IVisit used by traversal algorithms
    Author:
    igor.vaynberg
    • Constructor Detail

    • Method Detail

      • stop

        public void stop()
        Stops the visit/traversal
        Specified by:
        stop in interface IVisit<R>
      • stop

        public void stop​(R result)
        Stops the visit/traversal and returns result
        Specified by:
        stop in interface IVisit<R>
      • dontGoDeeper

        public void dontGoDeeper()
        Prevents the visitor from visiting any children of the object currently visited
        Specified by:
        dontGoDeeper in interface IVisit<R>
      • isStopped

        public boolean isStopped()
        Checks if the visit/traversal has been stopped
        Returns:
        true if the visit/traversal has been stopped
      • isContinue

        public boolean isContinue()
        Checks if the visit/traversal should continue
        Returns:
        true if the visit/traversal should continue
      • isDontGoDeeper

        public boolean isDontGoDeeper()
        Checks if the visit/traversal has been stopped from visiting children of the currently visited object
        Returns:
        true if the visit/traversal should not visit children of the currently visited object
      • getResult

        public R getResult()
        Gets the result of the visit/traversal. This value is set using stop(Object) or remains null if visit/traversal has ended in any other way
        Returns:
        value that should be returned to the method that initiated the visit/traversal