Package ch.bfh.ti.kybernetik.engine.controller.roboter

Source Code of ch.bfh.ti.kybernetik.engine.controller.roboter.RoboterControllerFactory

/**
* Copyright (C) BFH www.bfh.ch 2011
* Code written by: Patrick Dobler, Marc Folly
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package ch.bfh.ti.kybernetik.engine.controller.roboter;

import ch.bfh.ti.kybernetik.engine.model.Roboter;
import ch.bfh.ti.kybernetik.engine.model.RoboterFactory;
import ch.bfh.ti.kybernetik.lego.ki.RobKIFactr;
import ch.bfh.ti.kybernetik.lego.ki.RoboterKI;
import ch.bfh.ti.kybernetik.lego.ki.RobKIFactr.Wesen;

/**
* The Factory to create new {@link RoboterController} instances
*
*/
public final class RoboterControllerFactory {

  private static final Wesen DEFAULT_WESEN = Wesen.WESEN3;

  public static RoboterController createRoboterController() {
    return createRoboterController(RobKIFactr.getRoboterKI(DEFAULT_WESEN));
  }

  /**
   * Creates a default {@link RoboterController} with a default
   * {@link Roboter} Model and a default {@link RoboterConstruction} instance
   *
   * @param roboterKI
   * @return a new {@link RoboterController}
   */
  public static RoboterController createRoboterController(RoboterKI roboterKI) {
    Roboter roboter = RoboterFactory.createRoboter();
    DefaultRoboterControllerImpl roboterController = new DefaultRoboterControllerImpl(roboter, roboterKI,
        new DefaultRoboterConstructionImpl(roboter));

    return roboterController;
  }

  /**
   * Creates a new {@link RoboterController} with a random {@link Roboter}
   * Model but having still the default {@link RoboterKI} and
   * {@link RoboterConstruction} set
   *
   * @param maxX
   *            the max x-coordinate of the random {@link Roboter} Model
   * @param maxY
   *            the max y-coordinate of the random {@link Roboter} Model
   * @return a new {@link RoboterController} with a random positioned
   *         {@link Roboter} Model
   */
  public static RoboterController createRandomRoboterController(int maxX, int maxY) {
    RoboterKI roboterKI = RobKIFactr.getRoboterKI(DEFAULT_WESEN);
    Roboter roboter = RoboterFactory.createRandomRoboter(maxX, maxY);
    DefaultRoboterControllerImpl roboterController = new DefaultRoboterControllerImpl(roboter, roboterKI,
        new DefaultRoboterConstructionImpl(roboter));

    return roboterController;
  }

}
TOP

Related Classes of ch.bfh.ti.kybernetik.engine.controller.roboter.RoboterControllerFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.