Commit 88428a8d authored by patrick.lambert's avatar patrick.lambert
Browse files

typing

parent 05d49351
......@@ -4,39 +4,45 @@ import fr.cemagref.simaqualife.pilot.Pilot;
public class Time {
public static enum Season {
WINTER, SPRING, SUMMER, AUTOMN
};
public static enum Season {WINTER, SPRING, SUMMER, AUTOMN};
public Season getSeason(Pilot pilot){
public Season getSeason(Pilot pilot) {
return getSeason(pilot.getCurrentTime());
}
// use dans MyCSvObserver
public static Season getSeason(long time){
return Season.values()[(int)time% Season.values().length];
public static Season getSeason(long time) {
return Season.values()[(int) time % Season.values().length];
}
public long getYear(Pilot pilot){
return getNbYearFromBegin(pilot.getCurrentTime())+
((GridBasinNetwork) pilot.getAquaticWorld().getEnvironment()).getYearOfTheBegin();
public long getYear(Pilot pilot) {
return getNbYearFromBegin(pilot.getCurrentTime())
+ ((BasinNetwork) pilot.getAquaticWorld().getEnvironment()).getYearOfTheBegin();
}
public long getNbYearFromBegin(Pilot pilot){
public long getNbYearFromBegin(Pilot pilot) {
return getNbYearFromBegin(pilot.getCurrentTime());
}
// use dans MyCSvObserver
public static long getNbYearFromBegin(long time){
return (long) Math.floor(time / Season.values().length);
public static long getNbYearFromBegin(long time) {
return (long) Math.floor(time / Season.values().length);
}
/**
* @return the duration of season (time step)
* @return the duration of season (time step)
* @unit year
*/
public double getSeasonDuration(){
return 1./ Season.values().length;
public double getSeasonDuration() {
return 1. / Season.values().length;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment