com.helger.tree.singleton.ITreeWithUniqueIDProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ph-tree Show documentation
Show all versions of ph-tree Show documentation
Java 1.8+ Library with tree structures
The newest version!
/*
* Copyright (C) 2014-2024 Philip Helger (www.helger.com)
* philip[at]helger[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.helger.tree.singleton;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.impl.ICommonsCollection;
import com.helger.commons.collection.impl.ICommonsIterable;
import com.helger.commons.state.EChange;
import com.helger.tree.withid.DefaultTreeItemWithID;
import com.helger.tree.withid.unique.DefaultTreeWithGlobalUniqueID;
import com.helger.tree.withid.unique.ITreeWithGlobalUniqueID;
/**
* Default proxy interface for {@link ITreeWithGlobalUniqueID}.
*
* @author Philip Helger
* @param
* Tree key type
* @param
* Tree value type
*/
public interface ITreeWithUniqueIDProxy extends
ITreeWithGlobalUniqueID >
{
@Nonnull
DefaultTreeWithGlobalUniqueID getProxyTree ();
@Override
default boolean hasChildren ()
{
return getProxyTree ().hasChildren ();
}
@Override
default boolean hasNoChildren ()
{
return getProxyTree ().hasNoChildren ();
}
@Nonnegative
default int getChildCount ()
{
return getProxyTree ().getChildCount ();
}
@Nonnull
@ReturnsMutableCopy
default ICommonsCollection > getAllChildren ()
{
return getProxyTree ().getAllChildren ();
}
@Nullable
default ICommonsIterable > getChildren ()
{
return getProxyTree ().getChildren ();
}
@Override
default void forAllChildren (@Nonnull final Consumer super DefaultTreeItemWithID > aConsumer)
{
getProxyTree ().forAllChildren (aConsumer);
}
@Override
default void forAllChildren (@Nonnull final Predicate super DefaultTreeItemWithID > aFilter,
@Nonnull final Consumer super DefaultTreeItemWithID > aConsumer)
{
getProxyTree ().forAllChildren (aFilter, aConsumer);
}
@Override
default void forAllChildrenMapped (@Nonnull final Predicate super DefaultTreeItemWithID > aFilter,
@Nonnull final Function super DefaultTreeItemWithID , ? extends DSTTYPE> aMapper,
@Nonnull final Consumer super DSTTYPE> aConsumer)
{
getProxyTree ().forAllChildrenMapped (aFilter, aMapper, aConsumer);
}
@Nonnull
default DefaultTreeItemWithID getRootItem ()
{
return getProxyTree ().getRootItem ();
}
@Nullable
default DefaultTreeItemWithID getChildWithID (@Nullable final DefaultTreeItemWithID aCurrent,
@Nullable final KEYTYPE aID)
{
return getProxyTree ().getChildWithID (aCurrent, aID);
}
@Override
default boolean hasChildren (@Nullable final DefaultTreeItemWithID aCurrent)
{
return getProxyTree ().hasChildren (aCurrent);
}
@Override
default boolean hasNoChildren (@Nullable final DefaultTreeItemWithID aCurrent)
{
return getProxyTree ().hasNoChildren (aCurrent);
}
@Nonnegative
default int getChildCount (@Nullable final DefaultTreeItemWithID aCurrent)
{
return getProxyTree ().getChildCount (aCurrent);
}
@Nullable
default ICommonsCollection extends DefaultTreeItemWithID > getAllChildren (@Nullable final DefaultTreeItemWithID aCurrent)
{
return getProxyTree ().getAllChildren (aCurrent);
}
@Nullable
default DefaultTreeItemWithID getItemWithID (@Nullable final KEYTYPE aDataID)
{
return getProxyTree ().getItemWithID (aDataID);
}
@Nonnegative
default int getItemCount ()
{
return getProxyTree ().getItemCount ();
}
@Nonnull
default ICommonsCollection > getAllItems ()
{
return getProxyTree ().getAllItems ();
}
default boolean isItemSameOrDescendant (@Nullable final KEYTYPE aParentItemID, @Nullable final KEYTYPE aChildItemID)
{
return getProxyTree ().isItemSameOrDescendant (aParentItemID, aChildItemID);
}
default boolean containsItemWithID (@Nullable final KEYTYPE aDataID)
{
return getProxyTree ().containsItemWithID (aDataID);
}
@Nullable
default VALUETYPE getItemDataWithID (@Nullable final KEYTYPE aDataID)
{
return getProxyTree ().getItemDataWithID (aDataID);
}
@Nonnull
@ReturnsMutableCopy
default ICommonsCollection getAllItemDatas ()
{
return getProxyTree ().getAllItemDatas ();
}
@Nonnull
default EChange removeItemWithID (@Nullable final KEYTYPE aDataID)
{
return getProxyTree ().removeItemWithID (aDataID);
}
}