Class LabelledChunkFinder

  • All Implemented Interfaces:
    ChunkFinder

    public class LabelledChunkFinder
    extends Object
    implements ChunkFinder
    Splits a flow execution into FlowChunks whenever you have a label. This works for labelled blocks or single-step labels. Useful for collecting stages and parallel branches.
    Author:
    Sam Van Oort
    • Constructor Detail

      • LabelledChunkFinder

        public LabelledChunkFinder()
    • Method Detail

      • isStartInsideChunk

        public boolean isStartInsideChunk()
        Description copied from interface: ChunkFinder
        If true, a chunk is implicitly created whenever we begin.

        If you are matching the start/end of a block, should always return false.

        If you are trying to match markers (such as single-node labels or milestones), should always be true.

        Specified by:
        isStartInsideChunk in interface ChunkFinder
      • isChunkStart

        public boolean isChunkStart​(@NonNull
                                    FlowNode current,
                                    @CheckForNull
                                    FlowNode previous)
        Start is anywhere with a LabelAction
        Specified by:
        isChunkStart in interface ChunkFinder
        Parameters:
        current - Node to test for being a start, it will begin the chunk and be included
        previous - Previous node, to use in testing chunk
        Returns:
        True if current node is the beginning of chunk
      • isChunkEnd

        public boolean isChunkEnd​(@NonNull
                                  FlowNode current,
                                  @CheckForNull
                                  FlowNode previous)
        End is where the previous node is a chunk start or this is a BlockEndNode whose BlockStartNode has a label action
        Specified by:
        isChunkEnd in interface ChunkFinder
        Parameters:
        current - Node to test for being end

        For a block, the BlockEndNode

        For a legacy stage or marker, this will be first node of new stage (previous is the marker)

        previous - Previous node, to use in testing chunk
        Returns:
        True if current is the end of a chunk (inclusive)