/** * Creates a BagOfBalls with the size being the same as the number of Appearances given. * * @param sizeInMeters double Size of each ball in meters. * @param name String Name of the BagOfBalls * @param appearances ArrayList of the Appearance for each of the balls. * @param parentYoVariableRegistry YoVariableRegistry to register the BagOfBalls with. * @param yoGraphicsListRegistry DynamicGraphicObjectsListRegistry to register the BagOfBalls with. */ public BagOfBalls(double sizeInMeters, String name, ArrayList<AppearanceDefinition> appearances, YoVariableRegistry parentYoVariableRegistry, YoGraphicsListRegistry yoGraphicsListRegistry) { YoVariableRegistry registry = new YoVariableRegistry(name + "Balls"); for (int i = 0; i < appearances.size(); i++) { createABall(name, i, sizeInMeters, appearances.get(i), registry); } index = 0; registerBalls(name, registry, parentYoVariableRegistry, yoGraphicsListRegistry); }
/** * Creates a BagOfBalls with the given number of balls, and all the balls with the given Appearance. * * @param numberOfBalls int Number of balls to create. * @param sizeInMeters double Size of each ball in meters. * @param name String Name of the BagOfBalls * @param appearance Appearance for each of the balls. * @param parentYoVariableRegistry YoVariableRegistry to register the BagOfBalls with. * @param yoGraphicsListRegistry DynamicGraphicObjectsListRegistry to register the BagOfBalls with. */ public BagOfBalls(int numberOfBalls, double sizeInMeters, String name, AppearanceDefinition appearance, YoVariableRegistry parentYoVariableRegistry, YoGraphicsListRegistry yoGraphicsListRegistry) { YoVariableRegistry registry = new YoVariableRegistry(name + "Balls"); for (int i = 0; i < numberOfBalls; i++) { createABall(name, i, sizeInMeters, appearance, registry); } index = 0; registerBalls(name, registry, parentYoVariableRegistry, yoGraphicsListRegistry); }