gov.usgs.earthquake.event
Class EventComparison
java.lang.Object
gov.usgs.earthquake.event.EventComparison
public class EventComparison
- extends java.lang.Object
Comparison of 2 events.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventComparison
public EventComparison(EventInfo a,
EventInfo b)
EventComparison
public EventComparison(java.math.BigDecimal timeDifference,
java.math.BigDecimal locationDifference,
java.math.BigDecimal depthDifference,
java.math.BigDecimal magnitudeDifference)
getLocationDifference
public java.math.BigDecimal getLocationDifference()
getMagnitudeDifference
public java.math.BigDecimal getMagnitudeDifference()
getDepthDifference
public java.math.BigDecimal getDepthDifference()
getTimeDifference
public java.math.BigDecimal getTimeDifference()
getDistance
public static java.math.BigDecimal getDistance(EventInfo a,
EventInfo b)
- Compares two events and returns their distance in kilometers.
- Parameters:
a
- first eventb
- second event
- Returns:
- distance in kilometers, or null if one event doesn't have location.
getDistance
public static double getDistance(double lona,
double lonb,
double lata,
double latb)
- Utilizes the haversine formula to calculate great circle distance.
http://www.movable-type.co.uk/scripts/gis-faq-5.1.html
- Parameters:
lona
- First longitude in degreeslonb
- Second Longitude in degreeslata
- First latitude in degreeslatb
- Second latitude in degrees
- Returns:
- distance in kilometers