Package me.wobblyyyy.pathfinder.finders
Class GeneratorManager
java.lang.Object
me.wobblyyyy.pathfinder.finders.GeneratorManager
public class GeneratorManager
extends java.lang.Object
Manager class used for controlling and manipulating different generators.
Generators are path finding algorithms, wrapped up like a Christmas present for our lovely code to use. This class is designed to control and interface with any generators that have been enabled by users.
- Since:
- 0.1.0
- Author:
- Colin Robertson
-
Field Summary
-
Constructor Summary
Constructors Constructor Description GeneratorManager(PathfinderConfig config)
Create a new generator manager and instantiate the generators that the user has chosen to use. -
Method Summary
Modifier and Type Method Description void
addGenerator(Generator g)
Add a generator to the execution cycle.void
addGenerator(Generator g, int index)
Add a generator to the execution cycle.me.wobblyyyy.edt.DynamicArray<Point>
getCoordinatePath(Point start, Point end)
Get a coordinate path based on the array list of path generators that's provided earlier in this class.me.wobblyyyy.edt.DynamicArray<Generator>
getGenerators()
Get all of the current generators.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
gens
A list of all of the currently enabled generators.
-
-
Constructor Details
-
GeneratorManager
Create a new generator manager and instantiate the generators that the user has chosen to use.- Parameters:
config
- the Pathfinder configuration class.
-
-
Method Details
-
addGenerator
Add a generator to the execution cycle.- Parameters:
g
- the generator to add.index
- the index to add it at. The closer this number is to zero, the higher priority the generator has over other generators.
-
addGenerator
Add a generator to the execution cycle.- Parameters:
g
- the generator to add.
-
getGenerators
Get all of the current generators.- Returns:
- the current in-use generators.
-
getCoordinatePath
Get a coordinate path based on the array list of path generators that's provided earlier in this class.Different generators handle generation in different ways. However, all of them DO handle one thing the same way - if the array list that's returned from the path's generation method has a size of zero, we move on, moving to the next pathfinder.
If all of the path generators are exhausted - meaning that they fail to find a path to the given target - we return an array list of size zero, indicating to the pathfinder that no paths were found.
- Parameters:
start
- the start position.end
- the end position.- Returns:
- a path to the point.
-