Package com.j3d.engine.scene.find
Class Finder
java.lang.Object
com.j3d.engine.scene.find.Finder
The
Finder class provides utility methods for searching and locating
SceneObjects within the engine's hierarchical structure of Layers,
Things, and GObjects.- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionSupplies theLayerListcontaining all active layers in the engine. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends SceneObject>
Query<T, Object> allQuery()<T extends SceneObject,V>
ArrayList<FindResult> Searches through all layers, things, and GObjects to find allSceneObjects of a specified type that satisfy a given query.<T extends SceneObject,V>
FindResultSearches through all layers, things, and GObjects to find the firstSceneObjectof a specified type that satisfies a given query.private LayerListRetrieves the currentLayerListfrom the configured supplier.static <T extends SceneObject>
Query<T, UUID> idQuery()Creates aQuerythat matchesSceneObjects based on their unique identifier (UUID).static <T extends SceneObject>
Query<T, T> Creates aQuerythat matchesSceneObjects based on instance equality.static <T extends SceneObject>
Query<T, String> Creates aQuerythat matchesSceneObjects based on their name.
-
Field Details
-
layerListSupplier
Supplies theLayerListcontaining all active layers in the engine. This allows the Finder to access the current state of layers dynamically.
-
-
Constructor Details
-
Method Details
-
getLayers
Retrieves the currentLayerListfrom the configured supplier.- Returns:
- The
LayerListcontaining all active layers.
-
nameQuery
Creates aQuerythat matchesSceneObjects based on their name. This query compares the name of aSceneObjectwith a given string value.- Type Parameters:
T- The type ofSceneObjectto query.- Returns:
- A
Queryinstance that takes aSceneObjectand aString(name) and returnstrueif their names are equal.
-
idQuery
Creates aQuerythat matchesSceneObjects based on their unique identifier (UUID). This query compares the ID of aSceneObjectwith a givenUUIDvalue.- Type Parameters:
T- The type ofSceneObjectto query.- Returns:
- A
Queryinstance that takes aSceneObjectand aUUID(ID) and returnstrueif their IDs are equal.
-
allQuery
-
instanceQuery
Creates aQuerythat matchesSceneObjects based on instance equality. This query uses theequalsmethod to compare twoSceneObjectinstances.- Type Parameters:
T- The type ofSceneObjectto query.- Returns:
- A
Queryinstance that takes twoSceneObjects and returnstrueif they are considered equal by theirequalsmethod.
-
findFirst
Searches through all layers, things, and GObjects to find the firstSceneObjectof a specified type that satisfies a given query. This method traverses the entire scene graph and returns the first match found, or an emptyFindResultif no object matches.- Type Parameters:
T- The type ofSceneObjectto search for.V- The type of the value used by theQueryfor comparison.- Parameters:
clazz- TheClassobject representing the typeT. This is used to filter objects by their runtime type.query- TheQueryto apply to eachSceneObject. It defines the condition for an object to be considered a match.value- The value to be used by theQueryfor comparison.- Returns:
- A
FindResultcontaining the first matchingSceneObjectand its hierarchical location (layer, thing, GObject indices), or an emptyFindResultif no object is found. - See Also:
-
find
public <T extends SceneObject,V> ArrayList<FindResult> find(Class<T> clazz, Query<T, V> query, V value) Searches through all layers, things, and GObjects to find allSceneObjects of a specified type that satisfy a given query. This method traverses the entire scene graph and collects all matching objects.- Type Parameters:
T- The type ofSceneObjectto search for.V- The type of the value used by theQueryfor comparison.- Parameters:
clazz- TheClassobject representing the typeT. This is used to filter objects by their runtime type.query- TheQueryto apply to eachSceneObject. It defines the condition for an object to be considered a match.value- The value to be used by theQueryfor comparison.- Returns:
- An
ArrayListofFindResults, each containing a reference to a matchingSceneObjectand its hierarchical location (layer, thing, GObject indices). Returns an empty list if no objects are found. - See Also:
-