mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
added lazy loading to getter methods
This commit is contained in:
parent
dff5c73e1c
commit
41407a4aee
1 changed files with 18 additions and 19 deletions
|
@ -27,37 +27,36 @@ public enum TargetController {
|
|||
NEXT,
|
||||
EACH_PLAYER;
|
||||
|
||||
private final OwnerPredicate ownerPredicate;
|
||||
private final PlayerPredicate playerPredicate;
|
||||
private final ControllerPredicate controllerPredicate;
|
||||
|
||||
TargetController() {
|
||||
this.ownerPredicate = new OwnerPredicate(this);
|
||||
this.playerPredicate = new PlayerPredicate(this);
|
||||
this.controllerPredicate = new ControllerPredicate(this);
|
||||
}
|
||||
private OwnerPredicate ownerPredicate = null;
|
||||
private PlayerPredicate playerPredicate = null;
|
||||
private ControllerPredicate controllerPredicate = null;
|
||||
|
||||
public OwnerPredicate getOwnerPredicate() {
|
||||
return ownerPredicate;
|
||||
if (this.ownerPredicate == null) {
|
||||
this.ownerPredicate = new OwnerPredicate(this);
|
||||
}
|
||||
return this.ownerPredicate;
|
||||
}
|
||||
|
||||
public PlayerPredicate getPlayerPredicate() {
|
||||
return playerPredicate;
|
||||
if (this.playerPredicate == null) {
|
||||
this.playerPredicate = new PlayerPredicate(this);
|
||||
}
|
||||
return this.playerPredicate;
|
||||
}
|
||||
|
||||
public ControllerPredicate getControllerPredicate() {
|
||||
return controllerPredicate;
|
||||
}
|
||||
|
||||
public DamagedPlayerThisTurnPredicate getDamagedPlayerThisTurnPredicate() {
|
||||
return damagedPlayerThisTurnPredicate;
|
||||
if (this.controllerPredicate == null) {
|
||||
this.controllerPredicate = new ControllerPredicate(this);
|
||||
}
|
||||
return this.controllerPredicate;
|
||||
}
|
||||
|
||||
public static class OwnerPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
|
||||
private final TargetController targetOwner;
|
||||
|
||||
public OwnerPredicate(TargetController targetOwner) {
|
||||
private OwnerPredicate(TargetController targetOwner) {
|
||||
this.targetOwner = targetOwner;
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ public enum TargetController {
|
|||
|
||||
private final TargetController targetPlayer;
|
||||
|
||||
public PlayerPredicate(TargetController player) {
|
||||
private PlayerPredicate(TargetController player) {
|
||||
this.targetPlayer = player;
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ public enum TargetController {
|
|||
|
||||
private final TargetController controller;
|
||||
|
||||
public ControllerPredicate(TargetController controller) {
|
||||
private ControllerPredicate(TargetController controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue