Class DescendantBoxSpliterator

  • All Implemented Interfaces:
    java.util.Spliterator<Box>

    public class DescendantBoxSpliterator
    extends java.lang.Object
    implements java.util.Spliterator<Box>
    A spliterator that can be used to create a stream of descendant boxes in breadth first order.

    NOTE: This is likely slower than simply creating a box list recursively for small number of descendants but gets relatively faster (and uses less memory) as the list of descendants increases in size.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  DescendantBoxSpliterator.State  
      • Nested classes/interfaces inherited from interface java.util.Spliterator

        java.util.Spliterator.OfDouble, java.util.Spliterator.OfInt, java.util.Spliterator.OfLong, java.util.Spliterator.OfPrimitive<T extends java.lang.Object,​T_CONS extends java.lang.Object,​T_SPLITR extends java.util.Spliterator.OfPrimitive<T,​T_CONS,​T_SPLITR>>
    • Constructor Detail

      • DescendantBoxSpliterator

        public DescendantBoxSpliterator​(Box parent)
    • Method Detail

      • hasChildren

        private boolean hasChildren​(Box bx)
      • add

        private void add​(Box bx)
      • next

        private void next()
      • hasNext

        private boolean hasNext()
      • current

        private Box current()
      • getNext

        private Box getNext()
      • getNextInlineChild

        private Box getNextInlineChild​(java.util.List<? extends java.lang.Object> inlineChilds)
      • tryAdvance

        public boolean tryAdvance​(java.util.function.Consumer<? super Box> action)
        Specified by:
        tryAdvance in interface java.util.Spliterator<Box>
      • trySplit

        public java.util.Spliterator<Box> trySplit()
        Specified by:
        trySplit in interface java.util.Spliterator<Box>
      • estimateSize

        public long estimateSize()
        Specified by:
        estimateSize in interface java.util.Spliterator<Box>
      • characteristics

        public int characteristics()
        Specified by:
        characteristics in interface java.util.Spliterator<Box>