pamanager
Class AirfareAgent

java.lang.Object
  |
  +--ciagent.CIAgent
        |
        +--pamanager.AirfareAgent

public class AirfareAgent
extends CIAgent
implements java.io.Serializable

The AirfareAgent class implements an agent that determines if desirable flights are available based on the departure time, the return time, and the cost of the tickets.

See Also:
Serialized Form

Field Summary
protected  java.lang.String actionString
           
protected  java.lang.String departDay
           
protected  java.lang.String departMonth
           
protected  RuleVariable departs
           
protected  java.lang.String destCity
           
protected  java.lang.String origCity
           
protected  RuleVariable price
           
protected  BooleanRuleBase rb
           
protected  java.lang.String returnDay
           
protected  java.lang.String returnMonth
           
protected  RuleVariable returns
           
 
Fields inherited from class ciagent.CIAgent
agentPlatform, children, DEFAULT_ASYNCTIME, DEFAULT_SLEEPTIME, name, parent, traceLevel
 
Constructor Summary
AirfareAgent()
          Creates an AirfareAgent instance.
AirfareAgent(java.lang.String name)
          Creates an AirfareAgent instance with the given name.
 
Method Summary
 java.lang.String getActionString()
          Retrieves the actionString this agent sends in events.
 java.lang.String getDepartDay()
          Retrieves the day of the departure date for a flight.
 java.lang.String getDepartMonth()
          Retrieves the month of the departure date for a flight.
 java.lang.String getDestCity()
          Retrieves the destination city for a flight.
 java.lang.String getOrigCity()
          Retrieves the departure city for a flight.
 java.lang.String getReturnDay()
          Retrieves the day of the return date for a flight.
 java.lang.String getReturnMonth()
          Retrieves the month of the return date for a flight.
 java.lang.String getTaskDescription()
          Retrieves a formatted string for display of this agent's current task.
 void initFlightRuleBase()
          Initializes the Flight rule base that is used by the agent when evaluating the flight information.
 void initialize()
          Initializes the agent by initialing the rule base.
 void process()
          Provides the default behavior of this agent which includes going out to a web page to get airfare information, parsing that page, and determining whether the flights and airfares are within certain limits set in the rule base.
 void processCIAgentEvent(CIAgentEvent e)
          Processes an event by invoking the default behavior of this agent.
 void processTimerPop()
          Processes a timer pop which does nothing in this case.
 void setActionString(java.lang.String actionString)
          Sets the action string to be sent by this agent in an EVENT.
 void setDepartDay(java.lang.String departDay)
          Sets the day of the departure date for a flight.
 void setDepartMonth(java.lang.String departMonth)
          Sets the month of the departure date for a flight.
 void setDestCity(java.lang.String destCity)
          Sets the destination city for a flight.
 void setOrigCity(java.lang.String origCity)
          Sets the departure city for a flight.
 void setReturnDay(java.lang.String returnDay)
          Sets the day of the return date for a flight.
 void setReturnMonth(java.lang.String returnMonth)
          Sets the month of the departure date for a flight.
 
Methods inherited from class ciagent.CIAgent
addAgent, addCIAgentEventListener, addPropertyChangeListener, getAgent, getAgentPlatform, getAgents, getAsyncTime, getChildren, getCustomizerClass, getDisplayName, getName, getParent, getSleepTime, getState, getTraceLevel, notifyCIAgentEventListeners, postCIAgentEvent, processAsynchronousEvents, removeAgent, removeCIAgentEventListener, removePropertyChangeListener, reset, resumeAgentProcessing, setAgentPlatform, setAsyncTime, setName, setParent, setSleepTime, setState, setTraceLevel, startAgentProcessing, stopAgentProcessing, suspendAgentProcessing, trace
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

departMonth

protected java.lang.String departMonth

departDay

protected java.lang.String departDay

origCity

protected java.lang.String origCity

destCity

protected java.lang.String destCity

returnMonth

protected java.lang.String returnMonth

returnDay

protected java.lang.String returnDay

rb

protected BooleanRuleBase rb

departs

protected RuleVariable departs

returns

protected RuleVariable returns

price

protected RuleVariable price

actionString

protected java.lang.String actionString
Constructor Detail

AirfareAgent

public AirfareAgent()
Creates an AirfareAgent instance.

AirfareAgent

public AirfareAgent(java.lang.String name)
Creates an AirfareAgent instance with the given name.
Parameters:
name - the String that contains the name of the agent
Method Detail

setDepartMonth

public void setDepartMonth(java.lang.String departMonth)
Sets the month of the departure date for a flight.
Parameters:
departMonth - the String that contains the three letter abbreviation for the month (JAN, FEB, MAR, APR, etc.)

getDepartMonth

public java.lang.String getDepartMonth()
Retrieves the month of the departure date for a flight.
Returns:
a String that contains the three letter abbreviation for the month (JAN, FEB, MAR, APR, etc.)

setDepartDay

public void setDepartDay(java.lang.String departDay)
Sets the day of the departure date for a flight.
Parameters:
departDay - the String that contains the number of day of the month

getDepartDay

public java.lang.String getDepartDay()
Retrieves the day of the departure date for a flight.
Returns:
a String that contains the number of day of the month

setReturnMonth

public void setReturnMonth(java.lang.String returnMonth)
Sets the month of the departure date for a flight.
Parameters:
returnMonth - the String that contains the three letter abbreviation for the month (JAN, FEB, MAR, APR, etc.)

getReturnMonth

public java.lang.String getReturnMonth()
Retrieves the month of the return date for a flight.
Returns:
a String that contains the three letter abbreviation for the month (JAN, FEB, MAR, APR, etc.)

setReturnDay

public void setReturnDay(java.lang.String returnDay)
Sets the day of the return date for a flight.
Parameters:
returnDay - the String that contains the number of day of the month

getReturnDay

public java.lang.String getReturnDay()
Retrieves the day of the return date for a flight.
Returns:
a String that contains the number of day of the month

setOrigCity

public void setOrigCity(java.lang.String origCity)
Sets the departure city for a flight.
Parameters:
origCity - the String that contains the three letter airport code for the departure city (RST, MSP, ORD, etc.)

getOrigCity

public java.lang.String getOrigCity()
Retrieves the departure city for a flight.
Returns:
a String that contains the three letter airport code for the departure city (RST, MSP, ORD, etc.)

setDestCity

public void setDestCity(java.lang.String destCity)
Sets the destination city for a flight.
Parameters:
destCity - the String that contains the three letter airport code for the destination city (RST, MSP, ORD, etc.)

getDestCity

public java.lang.String getDestCity()
Retrieves the destination city for a flight.
Returns:
a String that contains the three letter airport code for the destination city (RST, MSP, ORD, etc.)

setActionString

public void setActionString(java.lang.String actionString)
Sets the action string to be sent by this agent in an EVENT.
Parameters:
actionString - the integer that represents the action

getActionString

public java.lang.String getActionString()
Retrieves the actionString this agent sends in events.
Returns:
the String that is sent in the action field of an event.

getTaskDescription

public java.lang.String getTaskDescription()
Retrieves a formatted string for display of this agent's current task.
Returns:
the String that represents the current task
Overrides:
getTaskDescription in class CIAgent

initialize

public void initialize()
Initializes the agent by initialing the rule base.
Overrides:
initialize in class CIAgent

process

public void process()
Provides the default behavior of this agent which includes going out to a web page to get airfare information, parsing that page, and determining whether the flights and airfares are within certain limits set in the rule base.
Overrides:
process in class CIAgent

processCIAgentEvent

public void processCIAgentEvent(CIAgentEvent e)
Processes an event by invoking the default behavior of this agent.
Parameters:
e - the CIAgentEvent object
Overrides:
processCIAgentEvent in class CIAgent

processTimerPop

public void processTimerPop()
Processes a timer pop which does nothing in this case.
Overrides:
processTimerPop in class CIAgent

initFlightRuleBase

public void initFlightRuleBase()
Initializes the Flight rule base that is used by the agent when evaluating the flight information.