net.commerce.zocalo.experiment.role
Class AbstractSubject
java.lang.Object
net.commerce.zocalo.experiment.role.AbstractSubject
- All Implemented Interfaces:
- ExperimentSubject
- Direct Known Subclasses:
- Judge, TradingSubject
public abstract class AbstractSubject
- extends java.lang.Object
- implements ExperimentSubject
Abstract base class for experiment subjects. Knows how to calculate
and record scores.
Method Summary |
java.lang.String |
actualValueLabel(java.util.Properties props)
|
abstract void |
addBonus(Funds funds)
|
void |
addScoreComponent(java.lang.Object key,
Quantity value)
|
static java.lang.String |
dividendValueLabel(java.util.Properties props)
|
protected boolean |
dormant(int currentRound)
|
boolean[] |
dormantPeriods()
|
abstract java.lang.String |
getName()
|
Quantity |
getScore(int round)
|
Quantity |
getScoreComponent(java.lang.Object key)
|
Quantity |
getScoreComponent(java.lang.Object key,
Quantity defaultValue)
|
java.lang.String |
getScoreExplanation()
|
static org.apache.log4j.Logger |
getScoreLogger()
|
void |
initializeDormancy(boolean[] booleans)
|
boolean |
isDormant(int currentRound)
|
static java.lang.String |
labelFromPropertyOrDefault(java.util.Properties props,
java.lang.String labelName,
java.lang.String defaultValue)
|
void |
linkHtml(java.lang.StringBuffer buff)
|
protected abstract java.lang.String |
linkText()
|
java.lang.String |
logConfigValues(org.apache.log4j.Logger log,
java.util.Properties props,
int rounds)
|
abstract Funds |
payDividend(Quantity perShareDividend,
Quantity shares,
Position noPosition)
|
abstract void |
receiveDividend(Funds funds)
|
abstract Quantity |
recordBonusInfo(Price average,
Quantity judged,
Quantity judgingTarget,
Quantity totalDividend,
int round,
java.util.Properties props)
|
abstract void |
recordDormantInfo(Quantity judged,
java.lang.String outcome,
java.util.Properties props)
|
abstract void |
recordExplanation(java.util.Properties props,
boolean keepingScore,
boolean carryForward,
java.lang.String eventOutcome)
|
void |
recordMultiplier(Quantity multiplier)
|
abstract void |
recordScore(int currentRound,
Quantity multiplier,
java.util.Properties props)
|
abstract void |
reduceReservesTo(Quantity perShare,
Position pos)
|
void |
rememberAssets(BinaryClaim claim)
|
void |
rememberHoldings(BinaryClaim claim)
|
void |
resetScoreInfo()
|
abstract java.lang.String |
roleName()
|
void |
saveMultiplierIfGiven(ScoreExplanationAccumulator accumulator)
|
void |
setHintsForRound(int currentRound,
Session session)
|
void |
setScore(int round,
Quantity score)
|
java.lang.String |
totalAssetsLabel(java.util.Properties props)
|
abstract Quantity |
totalDividend(BinaryClaim claim,
Session session,
int round)
|
Quantity |
totalScore()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BonusComponent
public static final java.lang.Object BonusComponent
ScoreComponent
public static final java.lang.Object ScoreComponent
MultiplierComponent
public static final java.lang.Object MultiplierComponent
scoreExplanation
protected java.lang.String scoreExplanation
AbstractSubject
public AbstractSubject()
logConfigValues
public java.lang.String logConfigValues(org.apache.log4j.Logger log,
java.util.Properties props,
int rounds)
- Specified by:
logConfigValues
in interface ExperimentSubject
setHintsForRound
public void setHintsForRound(int currentRound,
Session session)
- Specified by:
setHintsForRound
in interface ExperimentSubject
roleName
public abstract java.lang.String roleName()
getName
public abstract java.lang.String getName()
linkHtml
public void linkHtml(java.lang.StringBuffer buff)
- Specified by:
linkHtml
in interface ExperimentSubject
linkText
protected abstract java.lang.String linkText()
getScoreLogger
public static org.apache.log4j.Logger getScoreLogger()
totalScore
public Quantity totalScore()
- Specified by:
totalScore
in interface ExperimentSubject
setScore
public void setScore(int round,
Quantity score)
- Specified by:
setScore
in interface ExperimentSubject
getScore
public Quantity getScore(int round)
- Specified by:
getScore
in interface ExperimentSubject
actualValueLabel
public java.lang.String actualValueLabel(java.util.Properties props)
dividendValueLabel
public static java.lang.String dividendValueLabel(java.util.Properties props)
labelFromPropertyOrDefault
public static java.lang.String labelFromPropertyOrDefault(java.util.Properties props,
java.lang.String labelName,
java.lang.String defaultValue)
totalAssetsLabel
public java.lang.String totalAssetsLabel(java.util.Properties props)
getScoreExplanation
public java.lang.String getScoreExplanation()
- Specified by:
getScoreExplanation
in interface ExperimentSubject
rememberHoldings
public void rememberHoldings(BinaryClaim claim)
rememberAssets
public void rememberAssets(BinaryClaim claim)
addScoreComponent
public void addScoreComponent(java.lang.Object key,
Quantity value)
getScoreComponent
public Quantity getScoreComponent(java.lang.Object key)
getScoreComponent
public Quantity getScoreComponent(java.lang.Object key,
Quantity defaultValue)
recordBonusInfo
public abstract Quantity recordBonusInfo(Price average,
Quantity judged,
Quantity judgingTarget,
Quantity totalDividend,
int round,
java.util.Properties props)
addBonus
public abstract void addBonus(Funds funds)
totalDividend
public abstract Quantity totalDividend(BinaryClaim claim,
Session session,
int round)
throws ScoreException
- Throws:
ScoreException
payDividend
public abstract Funds payDividend(Quantity perShareDividend,
Quantity shares,
Position noPosition)
receiveDividend
public abstract void receiveDividend(Funds funds)
recordScore
public abstract void recordScore(int currentRound,
Quantity multiplier,
java.util.Properties props)
recordExplanation
public abstract void recordExplanation(java.util.Properties props,
boolean keepingScore,
boolean carryForward,
java.lang.String eventOutcome)
reduceReservesTo
public abstract void reduceReservesTo(Quantity perShare,
Position pos)
recordDormantInfo
public abstract void recordDormantInfo(Quantity judged,
java.lang.String outcome,
java.util.Properties props)
resetScoreInfo
public void resetScoreInfo()
saveMultiplierIfGiven
public void saveMultiplierIfGiven(ScoreExplanationAccumulator accumulator)
recordMultiplier
public void recordMultiplier(Quantity multiplier)
dormant
protected boolean dormant(int currentRound)
initializeDormancy
public void initializeDormancy(boolean[] booleans)
dormantPeriods
public boolean[] dormantPeriods()
isDormant
public boolean isDormant(int currentRound)
- Specified by:
isDormant
in interface ExperimentSubject