Skip to content

Commit

Permalink
refactor: 메서드명을 동사로 시작하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
takoyakimchi committed Jul 17, 2024
1 parent d4e8569 commit a4b9402
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.woowacourse.friendogly.footprint.domain;

import static java.lang.Math.*;
import static java.lang.Math.abs;
import static java.lang.Math.acos;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import static java.lang.Math.toDegrees;
import static java.lang.Math.toRadians;

import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -18,10 +23,10 @@ public class Location {
private double longitude;

public boolean isWithin(Location other, int radius) {
return distanceAsMeter(other) <= radius;
return calculateDistanceInMeters(other) <= radius;
}

private double distanceAsMeter(Location other) {
private double calculateDistanceInMeters(Location other) {
double theta = this.longitude - other.longitude;
double dist = sin(toRadians(this.latitude)) * sin(toRadians(other.latitude)) +
cos(toRadians(this.latitude)) * cos(toRadians(other.latitude)) * cos(toRadians(theta));
Expand Down

0 comments on commit a4b9402

Please sign in to comment.