Package name.moore.kevin.ze.game.verbs
Class search
java.lang.Object
name.moore.kevin.ze.game.verbs.search
Search for data in the entity repository.
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.simsilica.es.EntityDataprivate Set<com.simsilica.es.EntityId>private com.simsilica.es.EntityIdprivate static org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindbyName(reference key)findbyName(reference key, Class appliesto)Update foundentities with Entity Ids that match the Name component.findComponent(Class clazz)findComponents(Class[] clazzes)Attempt to locate all the specified components - any that cant be found WONt be in the foundcomponents results.Set<com.simsilica.es.EntityId>findEntities(com.simsilica.es.ComponentFilter cf, Class[] clazzes)Use the entities 'parts' component (if it has one) of installed or required equipment to provide a parts list (which is a list of those parts' EntityIds).Set<com.simsilica.es.EntityId>com.simsilica.es.EntityIdEnd a search that resulted in a single entityId.com.simsilica.es.EntityComponentEnd a search involving components.com.simsilica.es.EntitySetgetEntitySet(Class[] clazzes)Create a detailed report of the repository state for testing purposes.setEntity(com.simsilica.es.EntityId s)Before using the searches, we need an Entity either by a search or by setting directly.Given an existing entityid, work out what class (from extends XMLbase) of 'thing' it represents eg a ship, a planet.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
foundentities
-
foundcomponents
-
haystack
private com.simsilica.es.EntityId haystack -
entityrepository
@Inject public com.simsilica.es.EntityData entityrepository
-
-
Constructor Details
-
search
public search()
-
-
Method Details
-
setEntity
Before using the searches, we need an Entity either by a search or by setting directly.- Parameters:
s-- Returns:
-
findbyName
-
findbyName
Update foundentities with Entity Ids that match the Name component. The results will be EMPTY_SET if nothing found.- Parameters:
key-appliesto- eg engine.class- Returns:
-
findEntities
-
findParts
Use the entities 'parts' component (if it has one) of installed or required equipment to provide a parts list (which is a list of those parts' EntityIds).Update foundentities with results or EMPTY_SET if unable to locate a parts component.
- Returns:
-
getEntity
public com.simsilica.es.EntityId getEntity()End a search that resulted in a single entityId.- Returns:
- first entity in the foundentities set or NULL_ID if search had no results.
-
getEntities
- Returns:
- foundentities
-
findComponent
- Parameters:
clazz-- Returns:
-
findComponents
Attempt to locate all the specified components - any that cant be found WONt be in the foundcomponents results.- Parameters:
clazzes-- Returns:
-
getEntityComponent
public com.simsilica.es.EntityComponent getEntityComponent()End a search involving components. We return just the component value and not the class since its assumed we know that from the query we originally asked!- Returns:
- null if component not found.
-
getEntityComponents
-
getEntitySet
- Parameters:
clazzes-- Returns:
-
typeOfEntity
Given an existing entityid, work out what class (from extends XMLbase) of 'thing' it represents eg a ship, a planet.- Returns:
-
report
Create a detailed report of the repository state for testing purposes.- Parameters:
clazzes- the component classes to be included.- Returns:
- built report
-