|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.simulation.person.ai.mission.Mission
org.mars_sim.msp.simulation.person.ai.mission.TravelMission
org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
org.mars_sim.msp.simulation.person.ai.mission.RoverMission
org.mars_sim.msp.simulation.person.ai.mission.Trade
public class Trade
A mission for trading between two settlements.
| Field Summary | |
|---|---|
static java.lang.String |
BUY_LOAD_EVENT
|
static java.lang.String |
DEFAULT_DESCRIPTION
|
static java.lang.String |
LOAD_GOODS
|
static java.lang.String |
TRADE_DISEMBARKING
|
static java.lang.String |
TRADE_EMBARKING
|
static java.lang.String |
TRADE_NEGOTIATING
|
static java.lang.String |
UNLOAD_GOODS
|
| Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.RoverMission |
|---|
MIN_PEOPLE, STARTING_SETTLEMENT_EVENT |
| Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission |
|---|
DISEMBARKING, EMBARKING, equipmentNeededCache, loadedFlag, OPERATOR_EVENT, TRAVELLING, VEHICLE_EVENT |
| Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.TravelMission |
|---|
AT_NAVPOINT, DISTANCE_EVENT, NAVPOINTS_EVENT, TRAVEL_STATUS_EVENT, TRAVEL_TO_NAVPOINT |
| Fields inherited from class org.mars_sim.msp.simulation.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(java.util.Collection<Person> members,
Settlement startingSettlement,
Settlement tradingSettlement,
Rover rover,
java.lang.String description,
java.util.Map<Good,java.lang.Integer> sellGoods,
java.util.Map<Good,java.lang.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. |
protected void |
determineNewPhase()
Determines a new phase for the mission when the current phase has ended. |
Settlement |
getAssociatedSettlement()
Gets the settlement associated with the mission. |
java.util.Map<Good,java.lang.Integer> |
getBuyLoad()
Gets the load that is being bought in the trade. |
java.util.Map<Good,java.lang.Integer> |
getDesiredBuyLoad()
Gets the load that the starting settlement initially desires to buy. |
double |
getDesiredProfit()
Gets the profit initially expected by the starting settlement. |
java.util.Map<java.lang.Class,java.lang.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. |
double |
getProfit()
Gets the profit for the settlement initiating the trade. |
java.util.Map<Resource,java.lang.Number> |
getResourcesNeededForTrip(boolean useBuffer,
boolean parts,
double distance)
Gets a map of all resources needed for the trip. |
java.util.Map<Good,java.lang.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.simulation.person.ai.mission.RoverMission |
|---|
areVehiclesAvailable, atLeastOnePersonRemainingAtSettlement, endMission, getOperateVehicleTask, getRover, getStartingSettlement, getVehicleWithGreatestRange, hasDangerousMedicalProblemAtAssociatedSettlement, hasEmergency, isEveryoneInRover, isNoOneInRover, isRoverInAGarage, isUsableVehicle, minAvailablePeopleAtSettlement, setStartingSettlement |
| Methods inherited from class org.mars_sim.msp.simulation.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.simulation.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 java.lang.String BUY_LOAD_EVENT
public static final java.lang.String DEFAULT_DESCRIPTION
public static final java.lang.String TRADE_DISEMBARKING
public static final java.lang.String TRADE_NEGOTIATING
public static final java.lang.String UNLOAD_GOODS
public static final java.lang.String LOAD_GOODS
public static final java.lang.String TRADE_EMBARKING
| Constructor Detail |
|---|
public Trade(Person startingPerson)
throws MissionException
startingPerson - the person starting the settlement.
MissionException - if error constructing mission.
public Trade(java.util.Collection<Person> members,
Settlement startingSettlement,
Settlement tradingSettlement,
Rover rover,
java.lang.String description,
java.util.Map<Good,java.lang.Integer> sellGoods,
java.util.Map<Good,java.lang.Integer> buyGoods)
throws MissionException
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()
throws MissionException
determineNewPhase in class VehicleMissionMissionException - if problem setting a new phase.
protected void performPhase(Person person)
throws MissionException
performPhase in class RoverMissionperson - the person performing the phase.
MissionException - if problem performing the phase.
protected void performEmbarkFromSettlementPhase(Person person)
throws MissionException
performEmbarkFromSettlementPhase in class RoverMissionperson - the person currently performing the mission
MissionException - if error performing phase.
protected void performDisembarkToSettlementPhase(Person person,
Settlement disembarkSettlement)
throws MissionException
performDisembarkToSettlementPhase in class RoverMissionperson - the person currently performing the mission.disembarkSettlement - the settlement to be disembarked to.
MissionException - if error performing phase.
public java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
throws MissionException
getEquipmentNeededForRemainingMission in class RoverMissionuseBuffer - use time buffers in estimation if true.
MissionException - if error determining needed equipment.
public java.util.Map<Resource,java.lang.Number> getResourcesNeededForTrip(boolean useBuffer,
boolean parts,
double distance)
throws MissionException
getResourcesNeededForTrip in class RoverMissionuseBuffer - should a buffer be used when determining resources?parts - include parts.distance - the distance of the trip.
MissionException - if error determining resources.public 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)
throws MissionException
compareVehicles in class VehicleMissionfirstVehicle - the first vehicle to comparesecondVehicle - the second vehicle to compare
java.lang.IllegalArgumentException - if firstVehicle or secondVehicle is null.
MissionException - if error comparing vehicles.public java.util.Map<Good,java.lang.Integer> getSellLoad()
public java.util.Map<Good,java.lang.Integer> getBuyLoad()
public double getProfit()
public java.util.Map<Good,java.lang.Integer> getDesiredBuyLoad()
public double getDesiredProfit()
public Settlement getTradingSettlement()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||