com.tractrac.clientmodule
Class Event

java.lang.Object
  extended by com.tractrac.clientmodule.details.Attachments
      extended by com.tractrac.clientmodule.details.IdBase
          extended by com.tractrac.clientmodule.details.IdBaseNamed
              extended by com.tractrac.clientmodule.Event

public class Event
extends IdBaseNamed

Encapsulates data related to an Event: Races, Competitors, Competitor Classes, Control points, Routes.

Given a key-value configuration source, KeyValue.setup(java.net.URL) can be used instead of a manual setup.

Version:
2.0
Author:
TracTrac
See Also:
KeyValue.setup(java.net.URL), Race, Competitor, CompetitorClass, ControlPoint, Route

Constructor Summary
Event(java.util.UUID id, java.lang.String name)
          Creates an event with a given unique id and a name.
 
Method Summary
 Competitor addCompetitor(java.util.UUID id, java.lang.String name, java.lang.String shortName, java.lang.String nationality, CompetitorClass compClass)
          Adds a new competitor to this event.
 CompetitorClass addCompetitorClass(java.util.UUID id, java.lang.String name)
          Adds a new competitor class to this event.
 ControlPoint addControlPoint(java.util.UUID id, java.lang.String name, boolean hasTwoPoints)
          Adds a new control point to this event.
 ControlPoint addControlPoint(java.util.UUID id, java.lang.String name, boolean hasTwoPoints, double lat1, double lat2, double lon1, double lon2)
          Adds a new control point to this event.
 Race addRace(java.util.UUID id, java.lang.String name)
          Adds a new race to this event.
 Route addRoute(java.util.UUID id, java.lang.String name)
          Adds a new route to this event.
 Competitor getCompetitorById(java.util.UUID id)
          Looks up a competitor based on its unique id.
 CompetitorClass getCompetitorClassById(java.util.UUID id)
          Looks up a competitor class based on its unique id.
 java.util.Collection<CompetitorClass> getCompetitorClassList()
          Returns a read-only collection of the competitor classes of this event.
 java.util.Collection<Competitor> getCompetitorList()
          Returns a read-only collection of the competitors of this event.
 ControlPoint getControlPointById(java.util.UUID id)
          Looks up a control point based on its unique id.
 java.util.Collection<ControlPoint> getControlPointList()
          Returns a read-only collection of the control points of this event.
 Race getRaceById(java.util.UUID id)
          Looks up a race based on its unique id.
 java.util.Collection<Race> getRaceList()
          Returns a read-only collection of the races of this event.
 Route getRouteById(java.util.UUID id)
          Looks up a route based on its unique id.
 java.util.Collection<Route> getRouteList()
          Returns a read-only collection of the routes of this event.
static AttKey newAttKey()
          Creates a new (static) key to be used to set/get custom data related to events.
 
Methods inherited from class com.tractrac.clientmodule.details.IdBaseNamed
getName, toString
 
Methods inherited from class com.tractrac.clientmodule.details.IdBase
equals, getId, hashCode
 
Methods inherited from class com.tractrac.clientmodule.details.Attachments
getAttachment, setAttachment
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Event

public Event(java.util.UUID id,
             java.lang.String name)
Creates an event with a given unique id and a name.

Parameters:
id - a unique id
name - the name of the event, may be null
Method Detail

newAttKey

public static AttKey newAttKey()
Creates a new (static) key to be used to set/get custom data related to events.

Returns:
a new key.

addRace

public Race addRace(java.util.UUID id,
                    java.lang.String name)
Adds a new race to this event.

Parameters:
id - a unique identifier.
name - the name of the race. May be null or non-unique.
Returns:
the new race.

addCompetitor

public Competitor addCompetitor(java.util.UUID id,
                                java.lang.String name,
                                java.lang.String shortName,
                                java.lang.String nationality,
                                CompetitorClass compClass)
Adds a new competitor to this event.

Parameters:
id - a unique identifier.
name - the name of the competitor. May be null or non-unique.
compClass - the competitor class this competitor belongs to. May be null.
Returns:
the new competitor

addCompetitorClass

public CompetitorClass addCompetitorClass(java.util.UUID id,
                                          java.lang.String name)
Adds a new competitor class to this event.

Parameters:
id - a unique identifier.
name - the name of the competitor class. May be null or non-unique.
Returns:
the new competitor class

addControlPoint

public ControlPoint addControlPoint(java.util.UUID id,
                                    java.lang.String name,
                                    boolean hasTwoPoints)
Adds a new control point to this event.

Parameters:
id - a unique identifier.
name - the name of the control point. May be null or non-unique.
hasTwoPoints - true if this control point represents two marks/buoys, false if it represents only one.
Returns:
the new control point.

addControlPoint

public ControlPoint addControlPoint(java.util.UUID id,
                                    java.lang.String name,
                                    boolean hasTwoPoints,
                                    double lat1,
                                    double lat2,
                                    double lon1,
                                    double lon2)
Adds a new control point to this event.

Parameters:
id - a unique identifier.
name - the name of the control point. May be null or non-unique.
hasTwoPoints - true if this control point represents two marks/buoys, false if it represents only one.
lat1 - is the static latitude of control point mark 1.
lat2 - is the static latitude of control point mark 2.
lon1 - is the static longitude of control point mark 1.
lon2 - is the static longitude of control point mark 2.
Returns:
the new control point.

addRoute

public Route addRoute(java.util.UUID id,
                      java.lang.String name)
Adds a new route to this event.

Parameters:
id - a unique identifier.
name - the name of the route. May be null or non-unique.
Returns:
the new route.

getRaceList

public java.util.Collection<Race> getRaceList()
Returns a read-only collection of the races of this event.

Returns:
a read-only collection of the races of this event.

getCompetitorList

public java.util.Collection<Competitor> getCompetitorList()
Returns a read-only collection of the competitors of this event.

Returns:
a read-only collection of the competitors of this event.

getCompetitorClassList

public java.util.Collection<CompetitorClass> getCompetitorClassList()
Returns a read-only collection of the competitor classes of this event.

Returns:
a read-only collection of the competitor classes of this event.

getControlPointList

public java.util.Collection<ControlPoint> getControlPointList()
Returns a read-only collection of the control points of this event.

Returns:
a read-only collection of the control points of this event.

getRouteList

public java.util.Collection<Route> getRouteList()
Returns a read-only collection of the routes of this event.

Returns:
a read-only collection of the routes of this event.

getRaceById

public Race getRaceById(java.util.UUID id)
Looks up a race based on its unique id. This method is primarily for internal use.

Parameters:
id - unique id of the race.
Returns:
the race associated with the id, or null if not found.

getCompetitorById

public Competitor getCompetitorById(java.util.UUID id)
Looks up a competitor based on its unique id. This method is primarily for internal use.

Parameters:
id - unique id of the competitor.
Returns:
the competitor associated with the id, or null if not found.

getCompetitorClassById

public CompetitorClass getCompetitorClassById(java.util.UUID id)
Looks up a competitor class based on its unique id. This method is primarily for internal use.

Parameters:
id - unique id of the competitor class.
Returns:
the competitor class associated with the id, or null if not found.

getControlPointById

public ControlPoint getControlPointById(java.util.UUID id)
Looks up a control point based on its unique id. This method is primarily for internal use.

Parameters:
id - unique id of the control point.
Returns:
the control point associated with the id, or null if not found.

getRouteById

public Route getRouteById(java.util.UUID id)
Looks up a route based on its unique id. This method is primarily for internal use.

Parameters:
id - unique id of the route.
Returns:
the route associated with the id, or null if not found.