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 classRecruitingSubTree.RecruiterAndRecruit
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<ICustomRecruitBase>allCustomprivate java.util.Set<CreatureType>allRecruitsprivate java.util.Map<CreatureType,java.lang.Integer>anyprivate java.util.Map<CreatureType,java.lang.Integer>anyDemiLordprivate java.util.Map<CreatureType,java.lang.Integer>anyLordprivate java.util.Map<CreatureType,java.lang.Integer>anyNonLordprivate booleancompletedprivate AllCreatureTypecreatureTypesprivate static java.util.logging.LoggerLOGGERprivate 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 voidaddAny(CreatureType recruit, int number)voidaddCustom(ICustomRecruitBase crb)voidaddDemiLord(CreatureType recruit, int number)voidaddLord(CreatureType recruit, int number)voidaddNonLord(CreatureType recruit, int number)voidaddRegular(CreatureType recruiter, CreatureType recruit, int number)voidcomplete(boolean regularRecruit)private voidcompleteGraph()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 booleanisADeadEnd(Variant variant, CreatureType creature)private booleanisRegularAncestorOf(CreatureType a, CreatureType b, java.util.Set<CreatureType> checked)intmaximumNumberNeededOf(CreatureType ct, MasterHex hex)intnumberOfRecruiterNeeded(CreatureType recruiter, CreatureType recruit, MasterHex hex)Return the number of recruiter needed to obtain a recruit in hexjava.lang.StringtoString()
-
-
-
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:
toStringin 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:IRecruitingReturn the number of recruiter needed to obtain a recruit in hex- Specified by:
numberOfRecruiterNeededin 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:
getPossibleRecruitsin 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:IRecruitingReturn all the CreatureType that can be recruits (something) in the hex.- Specified by:
getPossibleRecruitersin 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:
maximumNumberNeededOfin 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)
-
-