public class PredictSplitNode extends java.lang.Object implements java.lang.Comparable<PredictSplitNode>
Modifier and Type | Field and Description |
---|---|
private CreatureType |
angel |
private PredictSplitNode |
child1 |
private PredictSplitNode |
child2 |
private int |
childSize2 |
private static CreatureInfoComparator |
cic |
private CreatureInfoList |
creatures |
private java.lang.String |
markerId |
private PredictSplitNode |
parent |
private CreatureInfoList |
removed |
private CreatureType |
titan |
private int |
turnCreated |
private Variant |
variant |
Constructor and Description |
---|
PredictSplitNode(java.lang.String markerId,
int turnCreated,
CreatureInfoList cil,
PredictSplitNode parent,
Variant variant) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addCreature(CreatureType type) |
(package private) boolean |
allCertain() |
(package private) boolean |
allDescendentsCertain()
Return true if all of this node's children, grandchildren, etc.
|
(package private) java.util.List<CreatureType> |
chooseCreaturesToSplitOut(java.util.List<java.util.List<CreatureType>> possibleSplits)
Decide how to split this legion, and return a list of creatures names to
remove.
|
private void |
clearChildren() |
int |
compareTo(PredictSplitNode other) |
(package private) void |
computeSplit(int childSize,
java.util.List<CreatureType> knownKeep,
java.util.List<CreatureType> knownSplit,
CreatureInfoList keepList,
CreatureInfoList splitList)
Computes the predicted split of childsize, given that we may already know
some pieces that are keept or spilt.
|
(package private) int |
count(java.util.List<?> li,
java.lang.Object ob)
Return the number of times ob is found in li
|
(package private) static int |
count(java.util.List<java.lang.String> li,
java.lang.String name)
Return the number of times name occurs in li
|
(package private) java.util.List<java.util.List<CreatureType>> |
findAllPossibleSplits(int childSize,
java.util.List<CreatureType> knownKeep,
java.util.List<CreatureType> knownSplit)
Return a list of all legal combinations of splitoffs.
|
(package private) CreatureInfoList |
getAfterSplitCreatures()
Return list of CreatureInfo where atSplit == false.
|
(package private) CreatureInfoList |
getAtSplitOrRemovedCreatures()
Return list of CreatureInfo where atSplit == true, plus removed
creatures.
|
(package private) CreatureInfoList |
getCertainAtSplitOrRemovedCreatures()
Return list of CreatureInfo where both certain and atSplit are true, plus
removed creatures.
|
(package private) CreatureInfoList |
getCertainCreatures()
Return list of CreatureInfo where certain == true.
|
PredictSplitNode |
getChild1() |
PredictSplitNode |
getChild2() |
(package private) java.util.List<PredictSplitNode> |
getChildren() |
(package private) CreatureInfoList |
getCreatures()
Return list of CreatureInfo
|
java.lang.String |
getFullName() |
(package private) int |
getHeight() |
java.lang.String |
getMarkerId() |
(package private) java.lang.String |
getOtherChildMarkerId() |
PredictSplitNode |
getParent() |
(package private) CreatureInfoList |
getRemovedCreatures()
Return list of CreatureInfo
|
int |
getTurnCreated() |
(package private) boolean |
hasSplit() |
boolean |
isLegalInitialSplitoff(java.util.List<CreatureType> types) |
(package private) void |
merge(PredictSplitNode other)
Recombine this legion and other, because it was not possible to move.
|
(package private) static int |
minCount(java.util.List<java.util.List<java.lang.String>> lili,
java.lang.String name)
lili is a list of lists.
|
(package private) int |
numCertainCreatures() |
(package private) int |
numUncertainCreatures() |
(package private) void |
removeCreature(CreatureType type) |
(package private) void |
removeCreatures(java.util.List<CreatureType> creatureTypes) |
(package private) void |
reSplit()
Recompute the split of a stack, taking advantage of any information
potentially gained from the children
|
(package private) void |
revealCreatures(java.util.List<CreatureType> cnl) |
private static <T> boolean |
safeEquals(T obj1,
T obj2) |
(package private) void |
setCreatures(CreatureInfoList creatures) |
(package private) void |
split(int childSize,
Legion otherLegion,
int turn)
Perform the initial split of a stack, and create the children
|
(package private) static <T> java.util.List<T> |
subtractLists(java.util.List<T> big,
java.util.List<T> little) |
(package private) static <T> boolean |
superset(java.util.List<T> big,
java.util.List<T> little)
Return true if big is a superset of little.
|
java.lang.String |
toString() |
(package private) void |
updateInitialSplitInfo(CreatureInfoList newList)
This takes potentially new information about the legion's composition at
split and applies the later changes to the legion to get a new predicton
of contents.
|
private final java.lang.String markerId
private final int turnCreated
private CreatureInfoList creatures
private final CreatureInfoList removed
private final PredictSplitNode parent
private int childSize2
private PredictSplitNode child1
private PredictSplitNode child2
private final Variant variant
private final CreatureType titan
private final CreatureType angel
private static CreatureInfoComparator cic
PredictSplitNode(java.lang.String markerId, int turnCreated, CreatureInfoList cil, PredictSplitNode parent, Variant variant)
private void clearChildren()
public java.lang.String getMarkerId()
public java.lang.String getFullName()
public PredictSplitNode getChild1()
public PredictSplitNode getChild2()
public PredictSplitNode getParent()
public int getTurnCreated()
public java.lang.String toString()
toString
in class java.lang.Object
CreatureInfoList getCreatures()
void setCreatures(CreatureInfoList creatures)
CreatureInfoList getRemovedCreatures()
CreatureInfoList getCertainCreatures()
int numCertainCreatures()
int numUncertainCreatures()
boolean allCertain()
boolean hasSplit()
java.util.List<PredictSplitNode> getChildren()
boolean allDescendentsCertain()
CreatureInfoList getAtSplitOrRemovedCreatures()
CreatureInfoList getAfterSplitCreatures()
CreatureInfoList getCertainAtSplitOrRemovedCreatures()
java.lang.String getOtherChildMarkerId()
int getHeight()
static <T> boolean superset(java.util.List<T> big, java.util.List<T> little)
void revealCreatures(java.util.List<CreatureType> cnl)
public boolean isLegalInitialSplitoff(java.util.List<CreatureType> types)
java.util.List<java.util.List<CreatureType>> findAllPossibleSplits(int childSize, java.util.List<CreatureType> knownKeep, java.util.List<CreatureType> knownSplit)
childSize
- knownKeep
- knownSplit
- private static <T> boolean safeEquals(T obj1, T obj2)
java.util.List<CreatureType> chooseCreaturesToSplitOut(java.util.List<java.util.List<CreatureType>> possibleSplits)
int count(java.util.List<?> li, java.lang.Object ob)
void computeSplit(int childSize, java.util.List<CreatureType> knownKeep, java.util.List<CreatureType> knownSplit, CreatureInfoList keepList, CreatureInfoList splitList)
childSize
- knownKeep
- certain creatures to keepknownSplit
- certain creatures to splitkeepList
- return argumentsplitList
- return argumentvoid split(int childSize, Legion otherLegion, int turn)
childSize
- otherMarkerId
- turn
- void reSplit()
void updateInitialSplitInfo(CreatureInfoList newList)
newList
- void merge(PredictSplitNode other)
void addCreature(CreatureType type)
void removeCreature(CreatureType type)
void removeCreatures(java.util.List<CreatureType> creatureTypes)
public int compareTo(PredictSplitNode other)
compareTo
in interface java.lang.Comparable<PredictSplitNode>
static <T> java.util.List<T> subtractLists(java.util.List<T> big, java.util.List<T> little)
static int count(java.util.List<java.lang.String> li, java.lang.String name)
static int minCount(java.util.List<java.util.List<java.lang.String>> lili, java.lang.String name)