- java.lang.Object
-
- xyz.cofe.collection.TreeListImpl
-
public class TreeListImpl extends Object
Реализация Tree с использованием List
-
-
Constructor Summary
Constructors Constructor Description TreeListImpl()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A> voidappend(List<A> nodeList, Iterable<A> values, TripleConsumer<Integer,A,A> changes)Добавление дочернего узла в конец спискаstatic <A> voidclear(List<A> nodeList, TripleConsumer<Integer,A,A> changes)Удаление всех дочерних узловstatic <A> voiddeleteByIndex(List<A> nodeList, Iterable<Integer> index, TripleConsumer<Integer,A,A> changes)Удаление дочернего узла(ов)static <A> voiddeleteByValue(List<A> nodeList, Iterable<A> value, TripleConsumer<Integer,A,A> changes)Удаление дочернего узла(ов)static <A> voidinsert(List<A> nodeList, int index, Iterable<A> values, TripleConsumer<Integer,A,A> changes)Добавление дочернего узла в указанную позицию списка дочерних уловstatic <A> Anode(List<? extends A> nodeList, int index)Возвращает n-ый дочерний узелstatic intnodesCount(Collection<? extends Object> nodeList)Возвращает кол-во узлов в спискеstatic <A> voidset(List<A> nodeList, int index, Iterable<A> values, TripleConsumer<Integer,A,A> changes)Замена дочернего узла
-
-
-
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)
-
-