Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Model;
- /**
- * Model of a charging pod.
- * The charging pod charges the corresponding robot
- *
- * @author vinhhoang
- * @version 1.0
- */
- public class ChargingPod implements Actor{
- private String ID;
- private Location location;
- private int chargingSpeed;
- private String robotID;
- /**
- *
- * @param id Unique ID of charging pod
- * @param location Location of the charging pod
- * @param chargingSpeed Amount of power-increase of the battery
- * @param robotID Associated robotID of the charging pod
- */
- ChargingPod(String id, Location location, int chargingSpeed, String robotID) {
- this.ID = id;
- this.location = location;
- this.chargingSpeed = chargingSpeed;
- }
- public void act() {
- // Some code
- }
- /**
- * Return the location of the charging pod
- * @return location chargingPod's current location
- */
- public Location getLocation() {
- System.out.println("Return the location of the charging pod")
- return location;
- }
- /**
- * Compares ID of robot at chargingPod location with
- * robotID of chargingPod
- *
- * @param robot Robot at the chargingPod location
- * @return boolean true if robotID equal to chargingPod's robotID, false otherwise
- */
- public boolean checkRobotID(Robot robot) {
- System.out.println("Call a parameter of a Robot class get it ID"
- + " and compare it with the robotID with in the class.");
- if(robot.getUID() == robotID) {
- return true;
- }
- return false;
- }
- /**
- * Charge battery of the robot
- * @param robot Robot at the chargingPod's location
- */
- public void incrementPower(Robot robot) {
- System.out.println("Call a parameter of a Robot class get it power field"
- + " and increase by the charging speed");
- robot.setPower(robot.getPower() + chargingSpeed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement