mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
281ce2d842
- Re-engineered code to work with the new marks - Fixed bug where race order wasn't correct (added RacePosition class to fix) - Rewrote tests to work with new RacePosition class Tags: #story[1124] (Task 1)
56 lines
1.3 KiB
Java
56 lines
1.3 KiB
Java
package seng302.model.mark;
|
|
|
|
/**
|
|
* Represents a boats position between two marks
|
|
*/
|
|
public class RacePosition {
|
|
private Integer positionIndex;
|
|
private Mark nextMark;
|
|
private Mark previousMark;
|
|
private Boolean isFinishingLeg;
|
|
|
|
public RacePosition(Integer positionIndex, Mark nextMark, Mark previousMark){
|
|
this.positionIndex = positionIndex;
|
|
this.nextMark = nextMark;
|
|
this.previousMark = previousMark;
|
|
isFinishingLeg = false;
|
|
}
|
|
|
|
/**
|
|
* @return The position of the boat (0...number of marks in race - 1)
|
|
*/
|
|
public Integer getPositionIndex(){
|
|
return positionIndex;
|
|
}
|
|
|
|
/**
|
|
* @return The mark the boat is heading to
|
|
* will return NULL if this is the finishing legg
|
|
*/
|
|
public Mark getNextMark(){
|
|
return nextMark;
|
|
}
|
|
|
|
/**
|
|
* @return The mark the boat is heading away from,
|
|
* Will return NULL if this is the starting leg
|
|
*/
|
|
public Mark getPreviousMark(){
|
|
return previousMark;
|
|
}
|
|
|
|
/**
|
|
* Sets a flag that this is the last leg in the race
|
|
*/
|
|
public void setFinishingLeg(){
|
|
isFinishingLeg = true;
|
|
}
|
|
|
|
/**
|
|
* @return true if this is the last leg in the race
|
|
*/
|
|
public boolean getIsFinishingLeg() {
|
|
return isFinishingLeg;
|
|
}
|
|
}
|