|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IContest
This interface represents the PC2 API view of the contest information available to a client connected to a PC2 server through the API.
This documentation describes the current draft of the PC2 API, which is subject to change.
Method Summary | |
---|---|
void |
addClarificationListener(IClarificationEventListener clarificationEventListener)
Add a Clarification Event listener to contest. |
void |
addConnectionListener(IConnectionEventListener connectionEventListener)
Add a Connection Event listener to the contest. |
void |
addContestConfigurationUpdateListener(IConfigurationUpdateListener contestConfigurationUpdateListener)
Add a Contest Configuration Update listener to the contest. |
void |
addRunListener(IRunEventListener runEventListener)
Add a Run Event listener to the contest. |
IClarification[] |
getClarifications()
Get a list of all the clarifications in the contest. |
IContestClock |
getContestClock()
Get an IContestClock object containing contest time-related information. |
String |
getContestTitle()
Get the contest title. |
IGroup[] |
getGroups()
Get a list of the groups currently defined in the contest. |
IJudgement[] |
getJudgements()
Get a list of all currently-defined (i.e., possible) judgements. |
ILanguage[] |
getLanguages()
Get a list of all currently defined contest languages. |
IClient |
getMyClient()
Get the current logged in client. |
IProblemDetails[] |
getProblemDetails()
Get all the problem details. |
IProblem[] |
getProblems()
Get an ordered list of all currently defined contest problems. |
IRun[] |
getRuns()
Get a list of all the runs in the contest. |
String |
getServerHostName()
Returns name of the host (server) this application is using. |
int |
getServerPort()
Returns the port number for the host (server) this application is using. |
String |
getSiteName()
Get the name of the contest site for the PC2 server to which this client is currently connected. |
String |
getSiteName(int siteNumber)
Get the name for the specified contest site. |
ISite[] |
getSites()
Get an ordered list of all currently defined contest sites. |
IStanding |
getStanding(ITeam team)
Returns an IStanding describing the current standing of the specified team in the contest as
determined by the currently active implementation of the PC2 scoring algorithm. |
IStanding[] |
getStandings()
Returns an array of IStanding s describing the current standing of every team in the contest as determined by the currently active plugin implementation of the PC2 scoring
algorithm. |
ITeam[] |
getTeams()
Gets all the teams in the contest. |
boolean |
isContestClockRunning()
Returns a boolean value indicating whether the contest clock is currently running. |
void |
removeClarificationListener(IClarificationEventListener clarificationEventListener)
Remove the specified clarification event listener from the contest. |
void |
removeConnectionListener(IConnectionEventListener connectionEventListener)
Remove the specified connection event listener from the contest. |
void |
removeContestConfigurationUpdateListener(IConfigurationUpdateListener contestConfigurationUpdateListener)
Remove the specified Contest Configuration Update listener from the contest. |
void |
removeRunListener(IRunEventListener runEventListener)
Remove the specified run event listener from the contest. |
Method Detail |
---|
ITeam[] getTeams()
ITeam
objects, where each ITeam
element describes one Team account in the contest. Note that the returned array contains
one entry for every Team account which is currently defined, whether or not that team is currently logged in to the contest via PC2. Note also that in a multi-site contest the
returned array contains an entry for every account at every site, not just for the site for the server to which the client is currently connected.
The following code snippet shows typical usage for obtaining and printing a list of all teams currently in the contest. It assumes variable contest
represents a valid IContest
obtained from a server to which this client is connected.
for (ITeam team : contest.getTeams()) { String teamName = team.getDisplayName(); int siteNumber = team.getSiteNumber(); String groupName = team.getGroup().getName(); System.out.println(teamName + " Site: " + siteNumber + " Group: " + groupName); }
ITeam
s, one for each team account defined in the contest.String getSiteName(int siteNumber)
siteNumber
- The number of a site in the contest.
String getContestTitle()
String getSiteName()
ILanguage[] getLanguages()
ILanguage
for each currently defined contest language.
The languages in the returned array are always ordered in the order in which the Contest Administrator
entered them into the contest: element [0] is the first language, etc.
The following code snippet shows typical usage for obtaining and printing the names of all languages
currently defined in the contest. It assumes variable contest
represents a valid
IContest
obtained from a server to which this client is connected.
for (ILanguage language : contest.getLanguages()) { System.out.println(language.getName()); }
ILanguage
s, one for each language defined in the contest.IProblem[] getProblems()
IProblem
for each currently defined contest problem.
The problems in the returned array are always ordered in the order in which the Contest Administrator
entered them into the contest: element [0] is the first problem, etc.
The following code snippet shows typical usage for obtaining and printing the names of all problems
currently defined in the contest. It assumes variable contest
represents a valid
IContest
obtained from a server to which this client is connected.
for (IProblem problem : contest.getProblems()) { System.out.println(problem.getName()); }
IProblem
for each currently defined contest problem.ISite[] getSites()
ISite
for each currently defined contest site.
The sites in the returned array are always ordered in the order in which the Contest Administrator
defined them in the contest: element [0] is the first site, etc.
ISite
for each currently defined contest site.IJudgement[] getJudgements()
Returns an array containing one IJudgement
for each currently defined allowable Judge's response
to a submitted run. The returned IJudgement
s are given in the array in the order in which they
were defined by the Contest Administrator.
The following code snippet shows typical usage for obtaining and printing the names of all Judgements
currently defined in the contest. It assumes variable contest
represents a valid
IContest
obtained from a server to which this client is connected.
for (IJudgement judgement : contest.getJudgements()) { System.out.println(judgement.getName()); }
IJudgement
for each currently defined allowable Judge's response
to a submitted run.IRun[] getRuns()
IRun
s, where each element of the array holds a single contest IRun
. In a multi-site contest the returned array will contain the runs from all connected
sites, not just the site for the server to which this client is connected.
The following code snippet shows typical usage for obtaining and printing a list of all runs currently in the contest. It assumes variable contest
represents a valid IContest
obtained from a server to which this client is connected.
for (IRun run : contest.getRuns()) { System.out.println("Run " + run.getNumber() + " from site " + run.getSiteNumber()); System.out.println(" submitted at " + run.getSubmissionTime() + " minutes by " + run.getTeam().getDisplayName()); System.out.println(" For problem " + run.getProblem().getName()); System.out.println(" Written in " + run.getLanguage().getName()); if (run.isFinalJudged()) { System.out.println(" Judgement: " + run.getJudgementName()); } else { System.out.println(" Judgement: not judged yet "); } }
IClarification[] getClarifications()
void addRunListener(IRunEventListener runEventListener)
IRunEventListener
) will be
invoked every time a run is added to the contest, modified (e.g. Judged), or marked as deleted from the contest.
Custom clients using the PC2 API can therefore arrange to be notified when any of these conditions occurs.
runEventListener
- an IRunEventListener
listener for Run eventsIRunEventListener
,
IRun
void removeRunListener(IRunEventListener runEventListener)
runEventListener
- The IRunEventListener
listener to be removed.void addConnectionListener(IConnectionEventListener connectionEventListener)
IConnectionEventListener
) will be
invoked every time a connection to the server has been dropped, this client is no longer logged in.
connectionEventListener
- void removeConnectionListener(IConnectionEventListener connectionEventListener)
connectionEventListener
- The IConnectionEventListener
listener to be removed.void removeClarificationListener(IClarificationEventListener clarificationEventListener)
clarificationEventListener
- void addClarificationListener(IClarificationEventListener clarificationEventListener)
IClarificationEventListener
) will be
invoked every time a clarification is added to the contest, modified (e.g. Answered), or marked as deleted from the contest.
Custom clients using the PC2 API can therefore arrange to be notified when any of these conditions occurs.
clarificationEventListener
- an IClarificationEventListener
listener for Clarification events.IClarificationEventListener
,
IClarification
void addContestConfigurationUpdateListener(IConfigurationUpdateListener contestConfigurationUpdateListener)
IConfigurationUpdateListener
) will be
invoked every time a contest configuration item is added, modified, or removed from the contest.
Custom clients using the PC2 API can therefore arrange to be notified when any of these conditions occurs.
contestConfigurationUpdateListener
- an IConfigurationUpdateListener
listener for configuration update eventsIConfigurationUpdateListener
,
ContestEvent
void removeContestConfigurationUpdateListener(IConfigurationUpdateListener contestConfigurationUpdateListener)
contestConfigurationUpdateListener
- The IConfigurationUpdateListener
listener to be removed.IContestClock getContestClock()
IContestClock
object containing contest time-related information.
The IContestClock
object can be queried for values such as the amount of
time elasped so far in the contest, the amount of time remaining in the contest, and
whether the contest clock is currently "paused" or not.
Note that the IContestClock
object returned by the current implementation of
this method is static; it does not dynamically update. In other words, obtaining the
current contest time requires obtaining a new IContestClock
object each
time the current time information is needed.
IContestClock
object containing contest time informationIContestClock
IGroup[] getGroups()
IGroup
IClient getMyClient()
IClient
description of its own client
login data.
boolean isContestClockRunning()
getContestClock()
can be used to obtain clock information to determine which case exists (not yet started vs. paused.)
IStanding getStanding(ITeam team)
IStanding
describing the current standing of the specified team in the contest as
determined by the currently active implementation of the PC2 scoring algorithm.
Note that the determination of the data in an IStanding
is up to the scoring algorithm, which
can be dynamically changed by the Contest Administrator during a contest. Note also that scoring
details such as how to rank teams that are tied is also a function of the scoring algorithm.
team
- The ITeam
for which an IStanding
is being requested.
IStanding
for the specified team.IStanding[] getStandings()
IStanding
s describing the current standing of every team in the contest as determined by the currently active plugin implementation of the PC2 scoring
algorithm.
Note that the determination of the data in an IStanding
is up to the scoring algorithm, which can be dynamically changed by the Contest Administrator during a contest. Note also that
scoring details such as how to rank teams that are tied is also a function of the scoring algorithm.
In addition, note also that the order in which the IStanding
s are contained in the returned array is a function of the scoring algorithm. In particular, while the default PC2
scoring algorithm provides IStanding
s in ranked order, scoring algorithm implementations are not required to do so.
for (IStanding standingRank : contest.getStandings()) { String displayName = standingRank.getClient().getDisplayName(); System.out.printf(" %3d %-35s %2d %4d", standingRank.getRank(), displayName, standingRank.getNumProblemsSolved(), standingRank.getPenaltyPoints()); }
IStanding
s, one element for each contest team.String getServerHostName()
int getServerPort()
IProblemDetails[] getProblemDetails()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |