Package net.sf.colossus.variant
Class RecruitingSubTree
- java.lang.Object
-
- net.sf.colossus.variant.RecruitingSubTree
-
- All Implemented Interfaces:
IRecruiting
public class RecruitingSubTree extends java.lang.Object implements IRecruiting
The recruiting sub-tree in a terrain (or several terrains)- Author:
- Romain Dolbeau
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RecruitingSubTree.RecruiterAndRecruit
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<ICustomRecruitBase>
allCustom
private java.util.Set<CreatureType>
allRecruits
private java.util.Map<CreatureType,java.lang.Integer>
any
private java.util.Map<CreatureType,java.lang.Integer>
anyDemiLord
private java.util.Map<CreatureType,java.lang.Integer>
anyLord
private java.util.Map<CreatureType,java.lang.Integer>
anyNonLord
private boolean
completed
private AllCreatureType
creatureTypes
private static java.util.logging.Logger
LOGGER
private java.util.Map<RecruitingSubTree.RecruiterAndRecruit,java.lang.Integer>
regular
-
Constructor Summary
Constructors Constructor Description RecruitingSubTree(AllCreatureType creatureTypes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAny(CreatureType recruit, int number)
void
addCustom(ICustomRecruitBase crb)
void
addDemiLord(CreatureType recruit, int number)
void
addLord(CreatureType recruit, int number)
void
addNonLord(CreatureType recruit, int number)
void
addRegular(CreatureType recruiter, CreatureType recruit, int number)
void
complete(boolean regularRecruit)
private void
completeGraph()
static java.util.Set<CreatureType>
getAllInAllSubtreesIgnoringSpecials(Variant variant, CreatureType creature)
private static java.util.Set<CreatureType>
getAllInAllSubtreesIgnoringSpecialsRec(Variant variant, java.util.Map<MasterBoardTerrain,java.util.Set<CreatureType>> checked, CreatureType creature)
java.util.Set<CreatureType>
getPossibleRecruiters(MasterHex hex)
Return all the CreatureType that can be recruits (something) in the hex.java.util.Set<CreatureType>
getPossibleRecruits(MasterHex hex)
WARNING: This function, trough the CustomRecruitBase, can cause a caretaker update.static boolean
isADeadEnd(Variant variant, CreatureType creature)
private boolean
isRegularAncestorOf(CreatureType a, CreatureType b, java.util.Set<CreatureType> checked)
int
maximumNumberNeededOf(CreatureType ct, MasterHex hex)
int
numberOfRecruiterNeeded(CreatureType recruiter, CreatureType recruit, MasterHex hex)
Return the number of recruiter needed to obtain a recruit in hexjava.lang.String
toString()
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
regular
private final java.util.Map<RecruitingSubTree.RecruiterAndRecruit,java.lang.Integer> regular
-
any
private final java.util.Map<CreatureType,java.lang.Integer> any
-
anyNonLord
private final java.util.Map<CreatureType,java.lang.Integer> anyNonLord
-
anyLord
private final java.util.Map<CreatureType,java.lang.Integer> anyLord
-
anyDemiLord
private final java.util.Map<CreatureType,java.lang.Integer> anyDemiLord
-
allCustom
private final java.util.Set<ICustomRecruitBase> allCustom
-
allRecruits
private final java.util.Set<CreatureType> allRecruits
-
completed
private boolean completed
-
creatureTypes
private final AllCreatureType creatureTypes
-
-
Constructor Detail
-
RecruitingSubTree
public RecruitingSubTree(AllCreatureType creatureTypes)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isRegularAncestorOf
private boolean isRegularAncestorOf(CreatureType a, CreatureType b, java.util.Set<CreatureType> checked)
-
completeGraph
private void completeGraph()
-
complete
public void complete(boolean regularRecruit)
-
addRegular
public void addRegular(CreatureType recruiter, CreatureType recruit, int number)
-
addAny
public void addAny(CreatureType recruit, int number)
-
addNonLord
public void addNonLord(CreatureType recruit, int number)
-
addLord
public void addLord(CreatureType recruit, int number)
-
addDemiLord
public void addDemiLord(CreatureType recruit, int number)
-
addCustom
public void addCustom(ICustomRecruitBase crb)
-
numberOfRecruiterNeeded
public int numberOfRecruiterNeeded(CreatureType recruiter, CreatureType recruit, MasterHex hex)
Description copied from interface:IRecruiting
Return the number of recruiter needed to obtain a recruit in hex- Specified by:
numberOfRecruiterNeeded
in interfaceIRecruiting
- Parameters:
recruiter
- The Recruiterrecruit
- The Recruithex
- The hexagon in which the recruiting occurs- Returns:
- The number of recruiter needed to obtain a recruit in hex
-
getPossibleRecruits
public java.util.Set<CreatureType> getPossibleRecruits(MasterHex hex)
WARNING: This function, trough the CustomRecruitBase, can cause a caretaker update. It should not be called under circumstances where this update is bad.- Specified by:
getPossibleRecruits
in interfaceIRecruiting
- Parameters:
hex
- The hexagon to consider- Returns:
- All CreatureType that can be recruited in hex
-
getPossibleRecruiters
public java.util.Set<CreatureType> getPossibleRecruiters(MasterHex hex)
Description copied from interface:IRecruiting
Return all the CreatureType that can be recruits (something) in the hex.- Specified by:
getPossibleRecruiters
in interfaceIRecruiting
- Parameters:
hex
- The hexagon to consider- Returns:
- All CreatureType that can recruit in hex
-
maximumNumberNeededOf
public int maximumNumberNeededOf(CreatureType ct, MasterHex hex)
- Specified by:
maximumNumberNeededOf
in interfaceIRecruiting
-
isADeadEnd
public static boolean isADeadEnd(Variant variant, CreatureType creature)
-
getAllInAllSubtreesIgnoringSpecials
public static java.util.Set<CreatureType> getAllInAllSubtreesIgnoringSpecials(Variant variant, CreatureType creature)
-
getAllInAllSubtreesIgnoringSpecialsRec
private static java.util.Set<CreatureType> getAllInAllSubtreesIgnoringSpecialsRec(Variant variant, java.util.Map<MasterBoardTerrain,java.util.Set<CreatureType>> checked, CreatureType creature)
-
-