|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.ai.ColonyPlan
public class ColonyPlan
Objects of this class describes the plan the AI has for a Colony.
A ColonyPlan contains WorkLocationPlans which defines
the production of each Building and ColonyTile.
Colony| Nested Class Summary | |
|---|---|
class |
ColonyPlan.Buildable
|
class |
ColonyPlan.Production
|
| Field Summary | |
|---|---|
private AIMain |
aiMain
|
static int |
ARTILLERY_PRIORITY
|
static int |
BUILDING_PRIORITY
|
static int |
CHURCH_PRIORITY
|
private Colony |
colony
The FreeColGameObject this AIObject contains AI-information for. |
static int |
CUSTOMS_HOUSE_PRIORITY
|
static int |
DOCKS_PRIORITY
|
private static java.util.logging.Logger |
logger
|
private static int |
MAX_LEVEL
|
private static int |
MIN_RAW_GOODS_THRESHOLD
|
private GoodsType |
primaryRawMaterial
|
private ColonyProfile |
profile
Describe profile here. |
static int |
SCHOOL_PRIORITY
|
private GoodsType |
secondaryRawMaterial
|
static int |
TOWN_HALL_PRIORITY
|
static int |
UPGRADE_PRIORITY
|
static int |
WAGON_TRAIN_PRIORITY
|
static int |
WAREHOUSE_PRIORITY
|
private java.util.ArrayList<WorkLocationPlan> |
workLocationPlans
|
| Constructor Summary | |
|---|---|
ColonyPlan(AIMain aiMain,
Colony colony)
Creates a new ColonyPlan. |
|
ColonyPlan(AIMain aiMain,
org.w3c.dom.Element element)
Creates a new ColonyPlan. |
|
| Method Summary | |
|---|---|
void |
adjustProductionAndManufacture()
|
void |
adjustProductionAndManufactureFor(GoodsType rawMat,
GoodsType producedGoods)
|
void |
create()
Creates a plan for this colony. |
AIMain |
getAIMain()
Gets the main AI-object. |
private GoodsType |
getBestGoodsToProduce(Tile t)
Determines the best goods to produce on a given Tile
within this colony. |
ColonyPlan.Production |
getBestProduction(UnitType unitType)
|
private ColonyTile |
getBestTileToProduce(GoodsType goodsType)
|
java.util.Iterator<BuildableType> |
getBuildable()
Gets an Iterator for everything to be built in the
Colony. |
GoodsType |
getBuildingReqGoods()
|
Colony |
getColony()
Gets the Colony this ColonyPlan controls. |
private int |
getFoodConsumption()
|
int |
getFoodProduction()
Returns the production of food according to this plan. |
Game |
getGame()
Get the Game this object is associated to. |
private int |
getNextFoodConsumption()
|
GoodsType |
getPrimaryRawMaterial()
|
int |
getProductionOf(GoodsType goodsType)
Returns the production of the given type of goods according to this plan. |
ColonyProfile |
getProfile()
Get the Profile value. |
GoodsType |
getSecondaryRawMaterial()
|
java.util.List<WorkLocationPlan> |
getSortedWorkLocationPlans()
Returns the WorkLocationPlans associated with this
ColonyPlan sorted by production in a decreasing order. |
java.util.List<WorkLocationPlan> |
getWorkLocationPlans()
Returns the WorkLocationPlans associated with this
ColonyPlan. |
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
private boolean |
needsFood()
|
void |
readFromXMLElement(org.w3c.dom.Element element)
Updates this object from an XML-representation of a ColonyPlan. |
private void |
selectProfile()
|
void |
setProfile(ColonyProfile newProfile)
Set the Profile value. |
java.lang.String |
toString()
Creates a String representation of this plan. |
org.w3c.dom.Element |
toXMLElement(org.w3c.dom.Document document)
Creates an XML-representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int DOCKS_PRIORITY
public static final int ARTILLERY_PRIORITY
public static final int CHURCH_PRIORITY
public static final int WAGON_TRAIN_PRIORITY
public static final int SCHOOL_PRIORITY
public static final int UPGRADE_PRIORITY
public static final int CUSTOMS_HOUSE_PRIORITY
public static final int TOWN_HALL_PRIORITY
public static final int WAREHOUSE_PRIORITY
public static final int BUILDING_PRIORITY
private static final int MAX_LEVEL
private static final int MIN_RAW_GOODS_THRESHOLD
private Colony colony
private AIMain aiMain
private java.util.ArrayList<WorkLocationPlan> workLocationPlans
private GoodsType primaryRawMaterial
private GoodsType secondaryRawMaterial
private ColonyProfile profile
| Constructor Detail |
|---|
public ColonyPlan(AIMain aiMain,
Colony colony)
ColonyPlan.
aiMain - The main AI-object.colony - The colony to make a ColonyPlan for.
public ColonyPlan(AIMain aiMain,
org.w3c.dom.Element element)
ColonyPlan.
aiMain - The main AI-object.element - An Element containing an XML-representation
of this object.| Method Detail |
|---|
public java.util.List<WorkLocationPlan> getWorkLocationPlans()
WorkLocationPlans associated with this
ColonyPlan.
WorkLocationPlans .public java.util.List<WorkLocationPlan> getSortedWorkLocationPlans()
WorkLocationPlans associated with this
ColonyPlan sorted by production in a decreasing order.
WorkLocationPlans .public final ColonyProfile getProfile()
Profile value.
ColonyProfile valuepublic final void setProfile(ColonyProfile newProfile)
Profile value.
newProfile - The new Profile value.public java.util.Iterator<BuildableType> getBuildable()
Iterator for everything to be built in the
Colony.
Buildable sorted by
priority (highest priority first).public AIMain getAIMain()
public Game getGame()
Game this object is associated to.
Game.public void create()
private int getFoodConsumption()
private int getNextFoodConsumption()
private boolean needsFood()
public int getProductionOf(GoodsType goodsType)
goodsType - The type of goods to check the production for.
ColonyPlan.public int getFoodProduction()
ColonyPlan.private GoodsType getBestGoodsToProduce(Tile t)
Tile
within this colony.
t - The Tile.
private ColonyTile getBestTileToProduce(GoodsType goodsType)
public ColonyPlan.Production getBestProduction(UnitType unitType)
public void adjustProductionAndManufacture()
public void adjustProductionAndManufactureFor(GoodsType rawMat,
GoodsType producedGoods)
public GoodsType getBuildingReqGoods()
public GoodsType getPrimaryRawMaterial()
public GoodsType getSecondaryRawMaterial()
public Colony getColony()
Colony this ColonyPlan controls.
Colony.private void selectProfile()
public org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
document - The Document in which the
XML-representation should be created.
public void readFromXMLElement(org.w3c.dom.Element element)
ColonyPlan.
element - The XML-representation.public static java.lang.String getXMLElementTagName()
public java.lang.String toString()
String representation of this plan.
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||