All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nutz.lang.util.Node Maven / Gradle / Ivy

package org.nutz.lang.util;

import java.util.Iterator;
import java.util.List;

import org.nutz.lang.Each;

/**
 * 树节点。
 * 
 * @author zozoh([email protected])
 * 
 * @param 
 */
public interface Node {

    T get();

    Node set(T obj);

    Node parent(Node node);

    Node parent();

    Node top();

    Node prev();

    Node prev(Node node);

    Node prev(int index);

    Node next();

    Node next(Node node);

    Node next(int index);

    Node add(Node... nodes);

    Node addFirst(Node node);

    Node pop();

    Node popFirst();

    Node removeChild(int index);

    int getIndex();

    /**
     * @return true 成功移除,false 不能移除
     */
    boolean remove();

    Node clearChildren();

    Node insertBefore(int index, Node node);

    boolean isRoot();

    boolean isLast();

    boolean isFirst();

    List> getAncestors();
    
    List> parents();

    int depth();

    List> getNextSibling();

    List> getPrevSibling();

    int index();

    List> getChildren();

    Node child(int index);

    Node desc(int... indexes);

    int countChildren();

    boolean hasChild();

    Node firstChild();

    Node lastChild();

    Iterator> iterator();

    > void eachChild(Each callback);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy