com.oanda.fxtrade.api
Class FXRateEvent

java.lang.Object
  extended by com.oanda.fxtrade.api.FXEvent
      extended by com.oanda.fxtrade.api.FXRateEvent

public abstract class FXRateEvent
extends FXEvent

The FXRateEvent class is the abstract superclass of all events which will be fired in response to a change in current market rates. An FXRateEvent can filter incoming rates by setting a key corresponding to a desired currency pair. If a key is set, the match method will only be called for rate changes in the specified pair.

Author:
Chris MacGregor

Constructor Summary
FXRateEvent()
          Default constructor.
FXRateEvent(boolean b)
          Constructor to set the transient flag.
FXRateEvent(java.lang.String s)
          Constructor to set the key.
FXRateEvent(java.lang.String s, boolean b)
          Constructor to set the key and transient flag.
 
Method Summary
 FXEventKey getKey()
          Accessor method used by the API.
abstract  void handle(FXEventInfo EI, FXEventManager EM)
          The handle method is called once for each FXEventInfo which results in the match method returning true.
 boolean match(FXEventInfo EI)
          The match method is used to determine whether the handle method of this event should be called for the given FXEventInfo.
 
Methods inherited from class com.oanda.fxtrade.api.FXEvent
isTransient, setTransient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FXRateEvent

public FXRateEvent()
Default constructor. Sets key to null and transient to false.


FXRateEvent

public FXRateEvent(java.lang.String s)
Constructor to set the key. Sets transient to false.

Parameters:
s - The string value of an FXPair to filter for.

FXRateEvent

public FXRateEvent(boolean b)
Constructor to set the transient flag. Sets key to null.

Parameters:
b - The value to set the transient flag to.

FXRateEvent

public FXRateEvent(java.lang.String s,
                   boolean b)
Constructor to set the key and transient flag.

Parameters:
s - The string value of an FXPair to filter for.
b - The value to set the transient flag to.
Method Detail

handle

public abstract void handle(FXEventInfo EI,
                            FXEventManager EM)
The handle method is called once for each FXEventInfo which results in the match method returning true. Users must override this method to specify what they want their programs to do when a relevant rate event occurrs.

Specified by:
handle in class FXEvent
Parameters:
EI - The event info which fired this event
EM - The event manager which contains this event

match

public boolean match(FXEventInfo EI)
The match method is used to determine whether the handle method of this event should be called for the given FXEventInfo. The default behaviour of match (if the user doesn't override it) is to return true if the event info's pair matches the key specified on construction.

Specified by:
match in class FXEvent
Parameters:
EI - The FXEventInfo which is being matched
Returns:
True if the handle method should be called for the given FXEventInfo, false otherwise

getKey

public final FXEventKey getKey()
Accessor method used by the API.

Specified by:
getKey in class FXEvent
Returns:
The FXEventKey used to match this FXEvent to an FXEventInfo


Copyright © 2005 OANDA Corporation. All Rights Reserved.