2022-03-24 16:22:13 +00:00
|
|
|
namespace MultiversalDiplomacy.Adjudicate.Decision;
|
|
|
|
|
|
|
|
public abstract class BinaryAdjudicationDecision : AdjudicationDecision
|
|
|
|
{
|
|
|
|
public bool? Outcome { get; private set; } = null;
|
|
|
|
|
|
|
|
public override bool Resolved => this.Outcome != null;
|
|
|
|
|
2022-03-28 22:05:04 +00:00
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return $"{this.GetType().Name}={this.Outcome}";
|
|
|
|
}
|
|
|
|
|
2022-03-24 16:22:13 +00:00
|
|
|
public bool Update(bool outcome)
|
|
|
|
{
|
|
|
|
if (this.Outcome == null)
|
|
|
|
{
|
|
|
|
this.Outcome = outcome;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (this.Outcome != outcome)
|
|
|
|
{
|
|
|
|
string name = this.GetType().Name;
|
|
|
|
throw new ArgumentException(
|
|
|
|
$"Cannot reverse adjudication of {name} from {this.Outcome} to {outcome}");
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|