Actually, this name is better
This commit is contained in:
		
					parent
					
						
							
								3a7a1f8c69
							
						
					
				
			
			
				commit
				
					
						31d6873249
					
				
			
		
					 2 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -13,7 +13,7 @@ import static java.lang.Math.*;
 | 
			
		|||
 * Usually off by a few minutes, except the Poles which, during polar days, are up to few hours inaccurate
 | 
			
		||||
 * Adapted from: <a href="https://gml.noaa.gov/grad/solcalc/solareqns.PDF">https://gml.noaa.gov/grad/solcalc/solareqns.PDF</a>
 | 
			
		||||
 */
 | 
			
		||||
public class SimpleTwilightTimeProvider extends TwilightTimeProvider {
 | 
			
		||||
public class ApproximateTwilightTimeProvider extends TwilightTimeProvider {
 | 
			
		||||
    @Override
 | 
			
		||||
    public Twilight calculateTwilightTime(LocalDate date, Coordinates coordinates) {
 | 
			
		||||
        int dayOfYear = date.getDayOfYear() - 1; // -1 because we have to start from zero
 | 
			
		||||
| 
						 | 
				
			
			@ -2,13 +2,13 @@ package eu.m724.wtapi.twilight;
 | 
			
		|||
 | 
			
		||||
import eu.m724.wtapi.object.Coordinates;
 | 
			
		||||
import eu.m724.wtapi.object.Twilight;
 | 
			
		||||
import eu.m724.wtapi.provider.twilight.SimpleTwilightTimeProvider;
 | 
			
		||||
import eu.m724.wtapi.provider.twilight.ApproximateTwilightTimeProvider;
 | 
			
		||||
import eu.m724.wtapi.provider.twilight.TwilightTimeProvider;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
 | 
			
		||||
public class SimpleTwilightTimeTest {
 | 
			
		||||
public class ApproximateTwilightTimeTest {
 | 
			
		||||
    /**
 | 
			
		||||
     * Acceptable discrepancy in minutes
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ public class SimpleTwilightTimeTest {
 | 
			
		|||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void approximateTest() {
 | 
			
		||||
        TwilightTimeProvider provider = new SimpleTwilightTimeProvider();
 | 
			
		||||
        TwilightTimeProvider provider = new ApproximateTwilightTimeProvider();
 | 
			
		||||
 | 
			
		||||
        testLocation(provider, 26, 6, 2023, 53.123394, 23.0864867, 122, 1139);
 | 
			
		||||
        testLocation(provider, 13, 11, 2040, 45.432427, -122.3899276, 907, 1481);
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue