Dark Planet Development Platform |
Return value | Method | Function |
---|---|---|
Collection<IAgtAgentTypes> | getAll() | Returns a collection of all agent type objects. |
IAgtAgentTypes | getFromId(int id) | Returns the IAgtAgentTypes with the given agent type ID, or null if no agent exists with the given type. |
The IAgtAgentTypesFactory interface is typical for tables with a single index field (i.e. SQL table column). For tables with multiple index fields, the factory will provide separate methods for retrieving collections by each index field. An example is org.dps.core.database.agt.IAgtConfigFactory which has methods:
Return value | Method | Function |
---|---|---|
Collection<IAgtConfig> | getAll() | Returns a collection of all agent config objects. |
Collection<IAgtConfig> | getAllByAgentId(int id) | Returns a collection of all agent config objects with the given agent ID. |
Collection<IAgtConfig> | getAllByKey(String key) | Returns a collection of all agent config objects with the given key. |
IAgtConfig | getFromId(int id, String key) | Returns the IAgtConfig with the given agent ID and key, or null if no such agent config exists. |
The objects returned by the factory interfaces implement methods which provide access to each of the fields in the static table. Many of the static data tables are cross-referenced. We reflect this in the static data API using object references. This means you won't need to perform additional lookups to get a reference to naturally cross-referenced data. A simple example of this is IMapRegionJumps:
Return value | Method | Function |
---|---|---|
int | getFromRegionID() | Returns the region ID of the source of the jump. |
IMapRegions | getFromRegionIDObject() | Returns the IMapRegions object corresponding to the source of the jump. |
int | getToRegionID() | Returns the region ID of the destination of the jump. |
IMapRegions | getToRegionIDObject() | Returns the IMapRegions object corresponding to the destination of the jump. |
The convention for all static data object interfaces is to return both the raw data for cross-references (e.g. the value of the cross-reference field) as well as an object reference for the cross-reference (e.g. the object which would be obtained by calling getFromId on the appropriate factory interface). Methods which return the cross-reference as an object have Object appended to the method name. Note that occasionally there are missing cross-references in the static data dumps, and thus the object form of the cross-reference may return null.
IEveDatabase database = ...get database reference...; for (IAgtAgentTypes type : database.getAgtAgentTypesFactory().getAll()) System.out.println("type = " + type);
A word of caution: some of the static data tables are quite large so use the getAll method with care.