com.tractrac.ResultAPI
Class ResultGenerator
java.lang.Object
com.tractrac.ResultAPI.ResultGenerator
public class ResultGenerator
- extends java.lang.Object
Main class for generation of:
- Live ranking assuming all legs are perfectly aligned with the wind
- Live ranking with individual wind input
- Mark rounding tables with statistics
The class should recieve mark-roundings, routes, mark-positions and competitor positions to work properly.
|
Method Summary |
java.util.List<LiveResult> |
getLiveResults()
Generates a live result list for the last time recalculate was run. |
java.util.List<PerLegResult> |
getPerLegResults()
Generate a result list with result per leg. |
void |
recalcuateWithWind(long timems,
double windDirectionDegrees)
Recalculates the live leaderboard and the mark rounding statistics. |
void |
recalculate(long timems)
Recalculates the live leaderboard and the mark rounding statistics. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResultGenerator
public ResultGenerator(java.net.URL paramUrl)
getLiveResults
public java.util.List<LiveResult> getLiveResults()
- Generates a live result list for the last time recalculate was run.
Note: Please make sure the run recalculate first to get the latest results.
- Returns:
- a list with a live result list per class
getPerLegResults
public java.util.List<PerLegResult> getPerLegResults()
- Generate a result list with result per leg. Use recalculate to update.
Note: Please make sure the run recalculate first to get the latest results.
- Returns:
- a list of mark results per class
recalculate
public void recalculate(long timems)
- Recalculates the live leaderboard and the mark rounding statistics.
By settings timems to now, you get the very latest result.
This recalculation is done using by projecting all boats onto the direct line between the previous mark and the next mark. The distance along this line is used for leaderboard calculations.
As a standard recommendation timems should be set to now - (timedelay).
Timedelay should generally be unit sending interval + 2-5 seconds.
- Parameters:
timems - Time in milliseconds to calculate results for
recalcuateWithWind
public void recalcuateWithWind(long timems,
double windDirectionDegrees)
- Recalculates the live leaderboard and the mark rounding statistics.
By settings timems to now, you get the very latest result.
As a standard recommendation timems should be set to now - (timedelay).
Timedelay should generally be unit sending interval + 2-5 seconds.
This recalculation is done using a custom wind direction. That means that:
- For upwind legs (+/- 22.5 degrees compared to wind direction): All boats are projected onto wind vector passing through upwind mark. The distance along this vector is used for the leaderboard calculations.
- For downwind legs (180 +/- 22.5 degrees compared to the wind direction): All boats are projected onto the wind vector passing through the bottom mark. The distance along this vector is used for the leaderboard calculations.
- For reaching legs (all other legs): All boats are projected into the direct line between the previous mark and the next mark. The distance along this line is used for leaderboard calculations.
- Parameters:
timems - Time in milliseconds to calculate results forwindDirectionDegrees - The wind direction in degrees from 0 to 359