## 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.

Constructor Summary
`EventComparison(java.math.BigDecimal timeDifference, java.math.BigDecimal locationDifference, java.math.BigDecimal depthDifference, java.math.BigDecimal magnitudeDifference)`
`EventComparison(EventInfo a, EventInfo b)`

Method Summary
`java.math.BigDecimal` `getDepthDifference()`
`static double` `getDistance(double lona, double lonb, double lata, double latb)` Utilizes the haversine formula to calculate great circle distance.
`static java.math.BigDecimal` `getDistance(EventInfo a, EventInfo b)` Compares two events and returns their distance in kilometers.
`java.math.BigDecimal` `getLocationDifference()`
`java.math.BigDecimal` `getMagnitudeDifference()`
`java.math.BigDecimal` `getTimeDifference()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### 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)

Method Detail

### 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 event
    `b` - 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 degrees
    `lonb` - Second Longitude in degrees
    `lata` - First latitude in degrees
    `latb` - Second latitude in degrees
  Returns:
    distance in kilometers