Class StateGenerator

java.lang.Object
ubc.team09.state.StateGenerator

public class StateGenerator extends Object
This class is used to iterate over child states, generating them on demand. E.g.,
StateGenerator iter = new StateGenerator(state);
for (
	State child = iter.next();
	child != null;
	child = iter.next()
) {
	// Do something with the `child` state... 
}
Rather than using the constructor, you can also get a state generator via the State.children() method.
  • Constructor Details

    • StateGenerator

      public StateGenerator(State parent)
      Creates a new generator to iterate over the children of a given game state. Typically you should use State.children() instead of calling this constructor directly.
  • Method Details

    • next

      public State next()
      Yields the next child state. If all child states have been exhausted, then this will return null.