package domain; import robot.exceptions.RobotException; import robot.exceptions.RobotIllegalStateException; import robot.interfaces.Robot; import java.util.Arrays; public abstract class RobotBasics implements Robot { private int id; private String name; private boolean power; public RobotBasics(int id, String name){ this.id = id; this.name = name; this.power = false; } /** * @see robot.interfaces.RobotControl; */ @Override public int getId() { return id; } /** * @see robot.interfaces.RobotControl; */ @Override public String getName() { return name; } /** * @see robot.interfaces.RobotControl; */ @Override public void triggerPowerSwitch() { if(power){ power = false; }else{ power = true; } } /** * @see robot.interfaces.RobotControl; */ @Override public boolean isPowerOn() { return power; } /** * @see robot.interfaces.RobotControl; */ @Override public RobotException getLastException() { return null; } public boolean checkArray(int[] input){ for(int x: input){ if(x == 42){ return true; } } return false; } }