edu.cuny.cat.server
Class TransactionValidator

java.lang.Object
  extended by edu.cuny.cat.server.TransactionValidator
All Implemented Interfaces:
edu.cuny.config.param.Parameterizable

public class TransactionValidator
extends java.lang.Object
implements edu.cuny.config.param.Parameterizable

A class used by the game server to check the validity of a transaction.

Version:
$Revision: 1.6 $
Author:
Jinzhong Niu

Constructor Summary
TransactionValidator()
           
 
Method Summary
 void check(Shout ask, Shout bid, double price)
          checks whether a transaction from a specialist is valid or not.
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionValidator

public TransactionValidator()
Method Detail

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable

check

public void check(Shout ask,
                  Shout bid,
                  double price)
           throws IllegalTransactionException
checks whether a transaction from a specialist is valid or not. To be valid, the transaction price must be no lower than the ask price and no higher than the bid price. IllegalTransactionException will be thrown if the transaction is found illegal.

Parameters:
ask - the ask in the transaction request
bid - the bid in the transaction request
price - the transaction price in the transaction request
Throws:
IllegalTransactionException - thrown when the transaction is invalid