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

com.github.tmatek.zhangshasha.EditableTreeNode Maven / Gradle / Ivy

Go to download

A Java implementation of Zhang-Shasha algorithm for ordered tree distance calculation. Calculates a series of transformations required to transform one tree into another. Every transformation has an associated cost. The sum of costs of all transformations is minimal - the tree distance.

There is a newer version: 1.01
Show newest version
package com.github.tmatek.zhangshasha;


/**
 * A node belonging to a tree structure, which permits transformations, such as removing/adding children
 * and changing the parent node.
 * @see TreeNode
 */
public interface EditableTreeNode extends TreeNode {

    /**
     * Returns a shallow copy of this tree node, ignoring children and parent relationships.
     * @return a shallow copy of this tree node
     */
    TreeNode cloneNode();

    /**
     * Sets a new parent node of this node
     * @param newParent the new parent node
     */
    void setParent(TreeNode newParent);

    /**
     * Inserts a new child of this node at position position
     * @param child the child {@link TreeNode} being inserted
     * @param position the position of inserted node
     */
    void addChildAt(TreeNode child, int position);

    /**
     * Renames this tree node (changes its label) to the name of other
     * @param other the node which will provide the new label
     */
    void renameNodeTo(TreeNode other);

    /**
     * Removes a child node from the list of children of this tree node.
     * @param child the child node to be removed
     */
    void deleteChild(TreeNode child);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy