net.sf.freecol.common.model
Interface Consumer

All Known Implementing Classes:
Building, BuildQueue, ServerBuilding, ServerUnit, Unit, UnitType

public interface Consumer

Objects implementing the Consumer interface consume Goods. Examples include units that eat food, buildings that convert Goods into other Goods, or buildings that store Goods.


Field Summary
static int BUILDING_PRIORITY
          Default consumption priority for buildings.
static int COLONY_PRIORITY
          The consumption priority of the colony build queue.
static java.util.Comparator<Consumer> COMPARATOR
           
static int POPULATION_PRIORITY
          Default consumption priority for the Colony when producing new colonists (from food).
static int UNIT_PRIORITY
          Default consumption priority for units.
 
Method Summary
 java.util.List<AbstractGoods> getConsumedGoods()
          Returns a list of GoodsTypes this Consumer consumes.
 java.util.Set<Modifier> getModifierSet(java.lang.String id)
          Returns the modifier set with the given id.
 int getPriority()
          The priority of this Consumer.
 boolean hasAbility(java.lang.String id)
          Returns whether the consumer has the ability with the given id.
 

Field Detail

COMPARATOR

static final java.util.Comparator<Consumer> COMPARATOR

POPULATION_PRIORITY

static final int POPULATION_PRIORITY
Default consumption priority for the Colony when producing new colonists (from food).

See Also:
Constant Field Values

COLONY_PRIORITY

static final int COLONY_PRIORITY
The consumption priority of the colony build queue.

See Also:
Constant Field Values

BUILDING_PRIORITY

static final int BUILDING_PRIORITY
Default consumption priority for buildings. Individual building types may have different priorities.

See Also:
Constant Field Values

UNIT_PRIORITY

static final int UNIT_PRIORITY
Default consumption priority for units. Individual unit types may have different priorities. Slave units, or converts, or petty criminals, for example, might have a lower priority.

See Also:
Constant Field Values
Method Detail

getConsumedGoods

java.util.List<AbstractGoods> getConsumedGoods()
Returns a list of GoodsTypes this Consumer consumes.

Returns:
a List value

getPriority

int getPriority()
The priority of this Consumer. The higher the priority, the earlier will the Consumer be allowed to consume the goods it requires.

Returns:
an int value

hasAbility

boolean hasAbility(java.lang.String id)
Returns whether the consumer has the ability with the given id. The ability most relevant to consumers is "consumeAllOrNothing", which implies that the consumer will not consume any goods if its requirements can not be met and is used by BuildQueues.

Parameters:
id - a String value
Returns:
a boolean value

getModifierSet

java.util.Set<Modifier> getModifierSet(java.lang.String id)
Returns the modifier set with the given id. The modifier most relevant to consumers is "consumeOnlySurplusProduction", which implies that the consumer does not consume stored goods (used by the country and stables).

Parameters:
id - a String value
Returns:
a boolean value