|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.core.person.ai.mission.Mission
org.mars_sim.msp.core.person.ai.mission.TravelMission
org.mars_sim.msp.core.person.ai.mission.VehicleMission
org.mars_sim.msp.core.person.ai.mission.RoverMission
org.mars_sim.msp.core.person.ai.mission.Trade
public class Trade
A mission for trading between two settlements.
| Field Summary | |
|---|---|
static String |
BUY_LOAD_EVENT
|
static String |
DEFAULT_DESCRIPTION
|
static String |
LOAD_GOODS
|
static String |
TRADE_DISEMBARKING
|
static String |
TRADE_EMBARKING
|
static String |
TRADE_NEGOTIATING
|
static String |
UNLOAD_GOODS
|
| Fields inherited from class org.mars_sim.msp.core.person.ai.mission.RoverMission |
|---|
MIN_PEOPLE, STARTING_SETTLEMENT_EVENT |
| Fields inherited from class org.mars_sim.msp.core.person.ai.mission.VehicleMission |
|---|
DISEMBARKING, EMBARKING, equipmentNeededCache, loadedFlag, OPERATOR_EVENT, TRAVELLING, VEHICLE_EVENT |
| Fields inherited from class org.mars_sim.msp.core.person.ai.mission.TravelMission |
|---|
AT_NAVPOINT, DISTANCE_EVENT, NAVPOINTS_EVENT, TRAVEL_STATUS_EVENT, TRAVEL_TO_NAVPOINT |
| Fields inherited from class org.mars_sim.msp.core.person.ai.mission.Mission |
|---|
ADD_MEMBER_EVENT, ASSOCIATED_SETTLEMENT_EVENT, CAPACITY_EVENT, DESCRIPTION_EVENT, END_MISSION_EVENT, MIN_PEOPLE_EVENT, NAME_EVENT, PHASE_DESCRIPTION_EVENT, PHASE_EVENT, REMOVE_MEMBER_EVENT |
| Constructor Summary | |
|---|---|
Trade(Collection<Person> members,
Settlement startingSettlement,
Settlement tradingSettlement,
Rover rover,
String description,
Map<Good,Integer> sellGoods,
Map<Good,Integer> buyGoods)
Constructor with explicit data. |
|
Trade(Person startingPerson)
Constructor. |
|
| Method Summary | |
|---|---|
protected int |
compareVehicles(Vehicle firstVehicle,
Vehicle secondVehicle)
Compares the quality of two vehicles for use in this mission. |
void |
destroy()
Prepare object for garbage collection. |
protected void |
determineNewPhase()
Determines a new phase for the mission when the current phase has ended. |
void |
endMission(String reason)
Finalizes the mission |
Settlement |
getAssociatedSettlement()
Gets the settlement associated with the mission. |
Map<Good,Integer> |
getBuyLoad()
Gets the load that is being bought in the trade. |
Map<Good,Integer> |
getDesiredBuyLoad()
Gets the load that the starting settlement initially desires to buy. |
double |
getDesiredProfit()
Gets the profit initially expected by the starting settlement. |
Map<Class,Integer> |
getEquipmentNeededForRemainingMission(boolean useBuffer)
Gets the number and types of equipment needed for the mission. |
static double |
getNewMissionProbability(Person person)
Gets the weighted probability that a given person would start this mission. |
Map<Class,Integer> |
getOptionalEquipmentToLoad()
Gets the optional equipment needed for loading the vehicle. |
Map<Resource,Number> |
getOptionalResourcesToLoad()
Gets the optional resources needed for loading the vehicle. |
double |
getProfit()
Gets the profit for the settlement initiating the trade. |
Map<Good,Integer> |
getSellLoad()
Gets the load that is being sold in the trade. |
Settlement |
getTradingSettlement()
Gets the settlement that the starting settlement is trading with. |
protected boolean |
isCapableOfMission(Person person)
Checks to see if a person is capable of joining a mission. |
protected void |
performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
Performs the disembark to settlement phase of the mission. |
protected void |
performEmbarkFromSettlementPhase(Person person)
Performs the embark from settlement phase of the mission. |
protected void |
performPhase(Person person)
The person performs the current phase of the mission. |
protected void |
recruitPeopleForMission(Person startingPerson)
Recruits new people into the mission. |
| Methods inherited from class org.mars_sim.msp.core.person.ai.mission.RoverMission |
|---|
areVehiclesAvailable, atLeastOnePersonRemainingAtSettlement, getOperateVehicleTask, getResourcesNeededForTrip, getRover, getStartingSettlement, getVehicleWithGreatestRange, hasBackupRover, hasDangerousMedicalProblemAtAssociatedSettlement, hasEmergency, hasEnoughBasicResources, isEveryoneInRover, isNoOneInRover, isRoverInAGarage, isUsableVehicle, minAvailablePeopleAtSettlement, setStartingSettlement |
| Methods inherited from class org.mars_sim.msp.core.person.ai.mission.TravelMission |
|---|
addNavpoint, clearRemainingNavpoints, getCurrentLegDistance, getCurrentLegRemainingDistance, getCurrentLegStartingTime, getCurrentNavpoint, getCurrentNavpointIndex, getNavpoint, getNavpointIndex, getNextNavpoint, getNextNavpointIndex, getNumberOfNavpoints, getPreviousNavpoint, getTotalDistance, getTotalRemainingDistance, getTravelStatus, reachedNextNode, setNavpoint, setNextNavpointIndex, startTravelToNextNode |
| Methods inherited from class org.mars_sim.msp.core.person.ai.mission.Mission |
|---|
addMissionListener, addPerson, addPhase, assignTask, associateAllMembersWithSettlement, fireMissionUpdate, fireMissionUpdate, getCurrentMissionLocation, getDescription, getMinPeople, getMissionCapacity, getMissionQualification, getName, getPeople, getPeopleNumber, getPhase, getPhaseDescription, getPhaseEnded, hasDangerousMedicalProblems, hasDangerousMedicalProblemsAllCrew, hasEmergencyAllCrew, hasPerson, isDone, performMission, removeMissionListener, removePerson, setDescription, setMinPeople, setMissionCapacity, setName, setPhase, setPhaseDescription, setPhaseEnded, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String BUY_LOAD_EVENT
public static final String DEFAULT_DESCRIPTION
public static final String TRADE_DISEMBARKING
public static final String TRADE_NEGOTIATING
public static final String UNLOAD_GOODS
public static final String LOAD_GOODS
public static final String TRADE_EMBARKING
| Constructor Detail |
|---|
public Trade(Person startingPerson)
startingPerson - the person starting the settlement.
MissionException - if error constructing mission.
public Trade(Collection<Person> members,
Settlement startingSettlement,
Settlement tradingSettlement,
Rover rover,
String description,
Map<Good,Integer> sellGoods,
Map<Good,Integer> buyGoods)
members - collection of mission members.startingSettlement - the starting settlement.tradingSettlement - the trading settlement.rover - the rover to use.description - the mission's description.sellGoods - map of mission sell goods and integer amounts.buyGoods - map of mission buy goods and integer amounts
MissionException - if error constructing mission.| Method Detail |
|---|
public static double getNewMissionProbability(Person person)
person - the given person
protected void determineNewPhase()
determineNewPhase in class VehicleMissionMissionException - if problem setting a new phase.protected void performPhase(Person person)
performPhase in class RoverMissionperson - the person performing the phase.
MissionException - if problem performing the phase.protected void performEmbarkFromSettlementPhase(Person person)
performEmbarkFromSettlementPhase in class RoverMissionperson - the person currently performing the mission
MissionException - if error performing phase.
protected void performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
performDisembarkToSettlementPhase in class RoverMissionperson - the person currently performing the mission.disembarkSettlement - the settlement to be disembarked to.
MissionException - if error performing phase.public void endMission(String reason)
VehicleMission
endMission in class RoverMissionreason - the reason of ending the mission.public Map<Class,Integer> getOptionalEquipmentToLoad()
VehicleMission
getOptionalEquipmentToLoad in class VehicleMissionpublic Map<Resource,Number> getOptionalResourcesToLoad()
VehicleMission
getOptionalResourcesToLoad in class VehicleMissionpublic Settlement getAssociatedSettlement()
getAssociatedSettlement in class Missionprotected boolean isCapableOfMission(Person person)
isCapableOfMission in class Missionperson - the person to check.
protected void recruitPeopleForMission(Person startingPerson)
recruitPeopleForMission in class MissionstartingPerson - the person starting the mission.
protected int compareVehicles(Vehicle firstVehicle,
Vehicle secondVehicle)
compareVehicles in class VehicleMissionfirstVehicle - the first vehicle to comparesecondVehicle - the second vehicle to compare
IllegalArgumentException - if firstVehicle or secondVehicle is null.
MissionException - if error comparing vehicles.public Map<Good,Integer> getSellLoad()
public Map<Good,Integer> getBuyLoad()
public double getProfit()
public Map<Good,Integer> getDesiredBuyLoad()
public double getDesiredProfit()
public Settlement getTradingSettlement()
public void destroy()
Mission
destroy in class RoverMissionpublic Map<Class,Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
Mission
getEquipmentNeededForRemainingMission in class MissionuseBuffer - use time buffers in estimation if true.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||