Skip to content

Instantly share code, notes, and snippets.

@bragboy
Created November 12, 2015 11:15
Show Gist options
  • Select an option

  • Save bragboy/ac272b8f9d8091af90c1 to your computer and use it in GitHub Desktop.

Select an option

Save bragboy/ac272b8f9d8091af90c1 to your computer and use it in GitHub Desktop.
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