Class SceneGraphPath
java.lang.Object
com.thecsdev.commonmc.api.client.gui.util.SceneGraphPath
-
Constructor Summary
ConstructorsConstructorDescriptionSceneGraphPath(@NotNull Class<? extends TElement> child, int childIndex, @Nullable SceneGraphPath path) Creates a newSceneGraphPathsegment instance. -
Method Summary
Modifier and TypeMethodDescriptiongetChild()intReturns the expected index of the childTElementwithin its parent at this path segment.@Nullable SceneGraphPathgetNext()Returns the next segment in this scene graph path, ornullif this is the last segment.static final @Nullable SceneGraphPathCreates aSceneGraphPaththat navigates from a given parentTElementdown to a specified childTElement.final @Nullable TElementResolves thisSceneGraphPathstarting from a givenTElement, returning the finalTElementat the end of the path, if found.static final @Nullable TElementresolve(@NotNull TElement from, @NotNull SceneGraphPath path) Resolves aSceneGraphPathstarting from a givenTElement, returning the finalTElementat the end of the path, if found.
-
Constructor Details
-
SceneGraphPath
public SceneGraphPath(@NotNull @NotNull Class<? extends TElement> child, int childIndex, @Nullable @Nullable SceneGraphPath path) throws NullPointerException Creates a newSceneGraphPathsegment instance.- Parameters:
child- The expectedClasstype of the childTElementat this segment.childIndex- The expected index of the childTElementwithin its parent at this segment.path- The next segment in the scene graph path, ornullif this is the last segment.- Throws:
NullPointerException- Ifchildisnull.
-
-
Method Details
-
getChild
-
getChildIndex
public int getChildIndex()Returns the expected index of the childTElementwithin its parent at this path segment. -
getNext
Returns the next segment in this scene graph path, ornullif this is the last segment. -
resolve
@Nullable public final @Nullable TElement resolve(@NotNull @NotNull TElement from) throws NullPointerException Resolves thisSceneGraphPathstarting from a givenTElement, returning the finalTElementat the end of the path, if found.- Parameters:
from- TheTElementfrom which to start resolving the path.- Returns:
- The resolved
TElement, ornullif the path could not be fully resolved. - Throws:
NullPointerException- If the argument isnull.
-
of
@Nullable public static final @Nullable SceneGraphPath of(@NotNull @NotNull TElement from, @Nullable @Nullable TElement to) Creates aSceneGraphPaththat navigates from a given parentTElementdown to a specified childTElement.- Parameters:
from- The parentTElementfrom which to navigate.to- The childTElementto which to navigate.- Returns:
- The
SceneGraphPathfromfromtoto, ornulliffromis the same asto, or iftois not a descendant offrom. - Throws:
NullPointerException- If an argument isnull.
-
resolve
@Nullable public static final @Nullable TElement resolve(@NotNull @NotNull TElement from, @NotNull @NotNull SceneGraphPath path) throws NullPointerException Resolves aSceneGraphPathstarting from a givenTElement, returning the finalTElementat the end of the path, if found.- Parameters:
from- TheTElementfrom which to start resolving the path.path- TheSceneGraphPathto resolve.- Returns:
- The resolved
TElement, ornullif the path could not be fully resolved. - Throws:
NullPointerException- If an argument isnull.
-