-
Notifications
You must be signed in to change notification settings - Fork 24
Building a JALSE instance
What is a JALSE instance?
A JALSE instance is the root of the tree - this can be used to create the top level entities, process the entire tree and control the ActionEngine (see What is a JALSE instance? for more information).
DefaultJALSE.Builder builder = new DefaultJALSE.Builder();JALSE is an Identifiable so it must have an ID:
// Random ID
builder.setRandomID();
// Dummy ID (00000000-0000-0000-0000-000000000000)
builder.setDummyID();
// Specific ID
builder.setID(/* Some ID */);Setting the Entity limit
JALSE is an EntityContainer so an EntityFactory is required to populate the tree. JALSEBuilder supplies a DefaultEntityFactory instance and DefaultEntityFactory takes in an Entity limit:
// Integer.MAX_VALUE
builder.setNoEntityLimit();
// Limit of 15
builder.setEntityLimit(15);Setting the ActionEngine
JALSE is an ActionEngine and wraps an engine instance. This ActionEngine instance is supplied to the EntityFactory.
Constructing a ThreadPoolActionEngine:
// new ThreadPoolActionEngine(4)
builder.setThreadPoolEngine().setParallelism(4);
// new ThreadPoolActionEngine(1)
builder.setThreadPoolEngine().setSingleThread();Constructing a ForkJoinActionEngine:
// new ForkJoinActionEngine(4)
builder.setForkJoinActionEngine().setParallelism(4);
// new ForkJoinActionEngine()
builder.setForkJoinActionEngine().setParallelismToProcessors();Constructing a ManualActionEngine:
// new ManualActionEngine()
builder.setManualActionEngine();Using the common pool engine (see Picking an ActionEngine implementation):
// ForkJoinActionEngine.commonPoolEngine()
builder.setCommonPoolEngine();Below is an example of building a JALSE instance using a random ID, ThreadPoolActionEngine with 8 threads and an Entity limit of 50:
JALSE jalse = new DefaultJALSE.Builder.setRandomID().setThreadPoolEngine().setParallelism(8).setEntityLimit(50).build();Check out the Example projects and Code snippets!
Getting Started
- Getting the latest release
- Building from source
- Example projects
- Code snippets
- How to contribute
- Have bugs or questions?
How To Use
- JALSE
- Entities
- Attributes
- Actions
- Tags
Misc