org.dartra.standard
Class StandardHit

java.lang.Object
  extended byorg.dartra.standard.PersistentObject
      extended byorg.dartra.standard.StandardHit
All Implemented Interfaces:
Hit, Persistent

public class StandardHit
extends PersistentObject
implements Hit

A hit on a standard darts board.

Author:
Erwin Vervaet

Constructor Summary
StandardHit(boolean bounceOut, boolean illegal, long timestamp)
          Create an out-of-bounds hit, possibly a bounce-out.
StandardHit(Location location, Zone zone, boolean illegal, long timestamp, boolean calculatedLocation)
          Create a hit that actually hit the board.
 
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.
 boolean equals(java.lang.Object obj)
           
 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).
 int hashCode()
           
 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.
 java.lang.String toString()
           
 
Methods inherited from class org.dartra.standard.PersistentObject
getId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dartra.framework.Persistent
getId, setId
 

Constructor Detail

StandardHit

public StandardHit(boolean bounceOut,
                   boolean illegal,
                   long timestamp)

Create an out-of-bounds hit, possibly a bounce-out. This hit can be legal or illegal, as indicated by the "illegal" parameter.


StandardHit

public StandardHit(Location location,
                   Zone zone,
                   boolean illegal,
                   long timestamp,
                   boolean calculatedLocation)

Create a hit that actually hit the board. This hit can be legal or illegal, as indicated by the "illegal" parameter.

Method Detail

getLocation

public Location getLocation()
Description copied from interface: Hit

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

Specified by:
getLocation in interface Hit

getZone

public Zone getZone()
Description copied from interface: Hit

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

Specified by:
getZone in interface Hit

isOutOfBounds

public boolean isOutOfBounds()
Description copied from interface: Hit

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

Specified by:
isOutOfBounds in interface Hit

isBounceOut

public boolean isBounceOut()
Description copied from interface: Hit

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.

Specified by:
isBounceOut in interface Hit

isIllegal

public boolean isIllegal()
Description copied from interface: Hit

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.

Specified by:
isIllegal in interface Hit

getTimestamp

public long getTimestamp()
Description copied from interface: Hit

Returns the time at which the dart hit the board.

Specified by:
getTimestamp in interface Hit

isLocationCalculated

public boolean isLocationCalculated()
Description copied from interface: Hit

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

Specified by:
isLocationCalculated in interface Hit

distanceTo

public double distanceTo(Hit hit)
Description copied from interface: Hit

Calculate the distance between this hit and given hit.

Specified by:
distanceTo in interface Hit

distanceTo

public double distanceTo(Location location)
Description copied from interface: Hit

Calculate the distance between this hit and given location.

Specified by:
distanceTo in interface Hit

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

public java.lang.String toString()