org.dartra.framework
Interface Hit

All Superinterfaces:
Persistent
All Known Implementing Classes:
StandardHit

public interface Hit
extends Persistent

Hit of a dart on a darts board. A dart hits a particular zone of the board, at a particular location.

A hit can also be out-of-bounds, in which case it did not hit the board, so no location and zone information are available. A bounce-out is a special case of an out-of-bounds hit.

A third type is hit is an illegal hit, for instance when a player's foot extends over the throw line (also called a foul). An illegal hit can be out-of-bounds, or can correctly hit the board, in which case zone and location information is available.

Hits are value objects.

Author:
Erwin Vervaet

Method Summary
 double distanceTo(Hit hit)
          Calculate the distance between this hit and given hit.
 double distanceTo(Location location)
          Calculate the distance between this hit and given location.
 Location getLocation()
          Returns the location that was hit, or null if the darts board was not hit (out-of-bounds).
 long getTimestamp()
          Returns the time at which the dart hit the board.
 Zone getZone()
          Returns the zone that was hit, or null if the darts board was not hit (out-of-bounds).
 boolean isBounceOut()
          Returns whether or not this hit was a bounce-out: the dart hit the board but it bounced out and fell on the floor.
 boolean isIllegal()
          Returns whether or not this was a legal hit.
 boolean isLocationCalculated()
          Returns whether or not the location for this hit was calculated or provided explicitly.
 boolean isOutOfBounds()
          Returns whether or not this hit actually hit the darts board.
 
Methods inherited from interface org.dartra.framework.Persistent
getId, setId
 

Method Detail

getLocation

public Location getLocation()

Returns the location that was hit, or null if the darts board was not hit (out-of-bounds).


getZone

public Zone getZone()

Returns the zone that was hit, or null if the darts board was not hit (out-of-bounds).


isOutOfBounds

public boolean isOutOfBounds()

Returns whether or not this hit actually hit the darts board. If not, the hit is considered out-of-bounds.


isBounceOut

public boolean isBounceOut()

Returns whether or not this hit was a bounce-out: the dart hit the board but it bounced out and fell on the floor. A bounce-out is always considered out-of-bounds.


isIllegal

public boolean isIllegal()

Returns whether or not this was a legal hit. A hit can be illegal when a player's foot extends over the throw line for instance.


getTimestamp

public long getTimestamp()

Returns the time at which the dart hit the board.


isLocationCalculated

public boolean isLocationCalculated()

Returns whether or not the location for this hit was calculated or provided explicitly.


distanceTo

public double distanceTo(Hit hit)

Calculate the distance between this hit and given hit.


distanceTo

public double distanceTo(Location location)

Calculate the distance between this hit and given location.