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

com.phloc.commons.tree.simple.ITreeItem Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
/**
 * Copyright (C) 2006-2015 phloc systems
 * http://www.phloc.com
 * office[at]phloc[dot]com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.phloc.commons.tree.simple;

import java.util.Comparator;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.phloc.commons.state.EChange;
import com.phloc.commons.tree.IBasicTreeItem;

/**
 * Base interface for simple tree items
 * 
 * @author Philip Helger
 * @param 
 *        tree item value type
 * @param 
 *        tree item implementation type
 */
public interface ITreeItem > extends
                                                                                       IBasicTreeItem 
{
  /**
   * @return The factory used to create instances of this interface.
   */
  @Nonnull
  ITreeItemFactory  getFactory ();

  /**
   * Add an existing child to this tree item. Use only internally!
   * 
   * @param aChild
   *        The child to be added. May not be null.
   * @return {@link EChange#UNCHANGED} if the child is already contained,
   *         {@link EChange#CHANGED} upon success.
   */
  @Nonnull
  EChange internalAddChild (@Nonnull ITEMTYPE aChild);

  /**
   * Add a child item to this item.
   * 
   * @param aData
   *        the data associated with this item
   * @return the created TreeItem object
   */
  @Nonnull
  ITEMTYPE createChildItem (@Nullable DATATYPE aData);

  /**
   * Remove the passed node as a child node from this node.
   * 
   * @param aChild
   *        The child to be removed. May not be nullnull.
   */
  void reorderChildItems (@Nonnull Comparator  aComparator);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy