Class TreeListImpl


  • public class TreeListImpl
    extends Object
    Реализация Tree с использованием List
    • Constructor Detail

      • TreeListImpl

        public TreeListImpl()
    • Method Detail

      • nodesCount

        public static int nodesCount​(Collection<? extends Object> nodeList)
        Возвращает кол-во узлов в списке
        Parameters:
        nodeList - список узлов
        Returns:
        кол-во узлов в списке
      • node

        public static <A> A node​(List<? extends A> nodeList,
                                 int index)
        Возвращает n-ый дочерний узел
        Type Parameters:
        A - тип узла
        Parameters:
        nodeList - список узлов
        index - индекс
        Returns:
        дочерний узел
      • set

        public static <A> void set​(List<A> nodeList,
                                   int index,
                                   Iterable<A> values,
                                   TripleConsumer<Integer,​A,​A> changes)
        Замена дочернего узла
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        index - идекс узлов которые необходимо заменить
        values - дочерние узлы
        changes - (Возможно null) Список изменений (index, oldChildNode, newChildNode)
      • insert

        public static <A> void insert​(List<A> nodeList,
                                      int index,
                                      Iterable<A> values,
                                      TripleConsumer<Integer,​A,​A> changes)
        Добавление дочернего узла в указанную позицию списка дочерних улов
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        index - индекс (0..) позиции вставки
        values - добавляемые дочерние узлы
        changes - (Возможно null) Список изменений (index, oldChildNode=null, newChildNode)
      • append

        public static <A> void append​(List<A> nodeList,
                                      Iterable<A> values,
                                      TripleConsumer<Integer,​A,​A> changes)
        Добавление дочернего узла в конец списка
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        values - добавляемые дочерние узлы
        changes - (Возможно null) Список изменений (index, oldChildNode=null, newChildNode)
      • deleteByIndex

        public static <A> void deleteByIndex​(List<A> nodeList,
                                             Iterable<Integer> index,
                                             TripleConsumer<Integer,​A,​A> changes)
        Удаление дочернего узла(ов)
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        index - иднекс дочернего элемента(ов)
        changes - (Возможно null) Список изменений (index, oldChildNode, newChildNode=null)
      • deleteByValue

        public static <A> void deleteByValue​(List<A> nodeList,
                                             Iterable<A> value,
                                             TripleConsumer<Integer,​A,​A> changes)
        Удаление дочернего узла(ов)
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        value - дочерние удаляемые элементы
        changes - (Возможно null) Список изменений (index, oldChildNode, newChildNode=null)
      • clear

        public static <A> void clear​(List<A> nodeList,
                                     TripleConsumer<Integer,​A,​A> changes)
        Удаление всех дочерних узлов
        Type Parameters:
        A - Тип узла
        Parameters:
        nodeList - список узлов
        changes - (Возможно null) Список изменений (index, oldChildNode, newChildNode=null)