Created
November 12, 2015 11:15
-
-
Save bragboy/ac272b8f9d8091af90c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package nasa.main; | |
| import nasa.exceptions.InvalidInputException; | |
| import nasa.exceptions.OutOfRangeException; | |
| public class Rover { | |
| ControlPanel parentControl; | |
| Heading currentHeading; | |
| public Rover(ControlPanel control){ | |
| this.parentControl = control; | |
| } | |
| public Heading getCurrentHeading() { | |
| return currentHeading; | |
| } | |
| public void setCurrentHeading(Heading currentHeading) { | |
| this.currentHeading = currentHeading; | |
| } | |
| public void setData(String data) throws InvalidInputException, OutOfRangeException{ | |
| parseData(data); | |
| } | |
| private void parseData(String data) throws InvalidInputException, OutOfRangeException{ | |
| byte[] bytes = data.trim().getBytes(); | |
| for(int i=0;i<bytes.length;i++){ | |
| currentHeading.parseCommand(bytes[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment