-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Because of the setters on private Calendar startDate, endDate; the SunPhase class is not thread safe. And since com.florianmski.suncalc.SunCalc which calls the setters is in a different package from com.florianmski.suncalc.models.SunPhase, the setter can't even be made package private for better encapsulation.
Perhaps we SunPhase should only house the the existing constructor's final variables:
private final Name name;
private final double startAngle, endAngle;
private final boolean startRise, endRise;
and then, once the date is known, we construct and return a new SunPhaseDay class once the date is specified in SunCalc#getPhases that includes:
private final Name name;
private final double startAngle, endAngle;
private final boolean startRise, endRise;
private final Calendar startDate, endDate;
kkamkou
Metadata
Metadata
Assignees
Labels
No labels