Package gov.usgs.earthquake.indexer
Interface Associator
-
- All Known Implementing Classes:
DefaultAssociator
public interface Associator
Implement event association logic used by the indexer. It is the associators job to describe how to find matching events, and then choose the best matching event that was found. The indexer uses the Associator to build a query used to search the ProductIndex. After querying the ProductIndex, the indexer then calls the chooseEvent method with any found events.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Event
chooseEvent(java.util.List<Event> events, ProductSummary summary)
Choose the best matching event for a product summary from a list of events.boolean
eventsAssociated(Event event1, Event event2)
Check if two events are associated.ProductIndexQuery
getEventIdQuery(java.lang.String eventSource, java.lang.String eventCode)
Get a ProductIndexQuery that searches by eventid.ProductIndexQuery
getLocationQuery(java.util.Date time, java.math.BigDecimal latitude, java.math.BigDecimal longitude)
Get a ProductIndexQuery that searches by location.SearchRequest
getSearchRequest(ProductSummary summary)
Create a SearchRequest that can be used to find related events.
-
-
-
Method Detail
-
getSearchRequest
SearchRequest getSearchRequest(ProductSummary summary)
Create a SearchRequest that can be used to find related events.- Parameters:
summary
- the product summary being associated.- Returns:
- a SearchRequest that can be used to search the ProductIndex.
-
chooseEvent
Event chooseEvent(java.util.List<Event> events, ProductSummary summary)
Choose the best matching event for a product summary from a list of events. If no events match, returns null.- Parameters:
events
- a list of candidate events.summary
- the product summary being associated.- Returns:
- the best match event, or null if no matching event found.
-
eventsAssociated
boolean eventsAssociated(Event event1, Event event2)
Check if two events are associated.- Parameters:
event1
- the first eventevent2
- the second event- Returns:
- true if they refer to the same event, false otherwise.
-
getEventIdQuery
ProductIndexQuery getEventIdQuery(java.lang.String eventSource, java.lang.String eventCode)
Get a ProductIndexQuery that searches by eventid.- Parameters:
eventSource
- relevant to eventeventCode
- relevant to event- Returns:
- a ProductIndexQuery that searches by eventid.
-
getLocationQuery
ProductIndexQuery getLocationQuery(java.util.Date time, java.math.BigDecimal latitude, java.math.BigDecimal longitude)
Get a ProductIndexQuery that searches by location.- Parameters:
time
- of eventlatitude
- of eventlongitude
- of event- Returns:
- a ProductIndexQuery that searches by location.
-
-