edu.cuny.cat.server
Class ChargeValidator

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

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

A class used by the game server to check the validity of the charges from a specialist.

Parameters

base.maxflat
double (1000 by default)
(the upper bound of a flat fee charged by a specialist, including registration fee, information fee, shout fee, and transaction fee.)
base.minflat
double (0 by default)
(the lower bound of the a flat fee charged by a specialist)
base.maxfractional
double (1 by default)
(the upper bound of a fractional fee charged by a specialist, including profit fee.)
base.minfractional
double (0 by default)
(the lower bound of the a fractional fee charged by a specialist)
base.isbanning
boolean (true by default)
(whether to ban a specialist on a day when its price list includes invalid values)

Default Base

charge

Version:
$Revision: 1.9 $
Author:
Jinzhong Niu

Field Summary
protected  boolean isBanning
          whether to ban a specialist when its price list includes invalid values
protected  double maxFlat
          the maximal flat fee a specialist may charge
protected  double maxFractional
          the maximal fractional fee a specialist may charge
protected  double minFlat
          the minimal flat fee a specialist may charge
protected  double minFractional
          the minimal fractional fee a specialist may charge
static java.lang.String P_DEF_BASE
           
static java.lang.String P_ISBANNING
           
static java.lang.String P_MAXFLAT
           
static java.lang.String P_MAXFRACTIONAL
           
static java.lang.String P_MINFLAT
           
static java.lang.String P_MINFRACTIONAL
           
 
Constructor Summary
ChargeValidator()
           
 
Method Summary
 void check(java.lang.String specialistId, double[] fees)
          Throws exceptions when NaN or Infinity values appear in the fee array and the banning policy is in effect.
 double getMax(int type)
           
 double getMaxFlat()
           
 double getMaxFractional()
           
 double getMin(int type)
           
 double getMinFlat()
           
 double getMinFractional()
           
 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
 

Field Detail

maxFlat

protected double maxFlat
the maximal flat fee a specialist may charge


minFlat

protected double minFlat
the minimal flat fee a specialist may charge


maxFractional

protected double maxFractional
the maximal fractional fee a specialist may charge


minFractional

protected double minFractional
the minimal fractional fee a specialist may charge


isBanning

protected boolean isBanning
whether to ban a specialist when its price list includes invalid values


P_MAXFLAT

public static final java.lang.String P_MAXFLAT
See Also:
Constant Field Values

P_MINFLAT

public static final java.lang.String P_MINFLAT
See Also:
Constant Field Values

P_MAXFRACTIONAL

public static final java.lang.String P_MAXFRACTIONAL
See Also:
Constant Field Values

P_MINFRACTIONAL

public static final java.lang.String P_MINFRACTIONAL
See Also:
Constant Field Values

P_ISBANNING

public static final java.lang.String P_ISBANNING
See Also:
Constant Field Values

P_DEF_BASE

public static final java.lang.String P_DEF_BASE
See Also:
Constant Field Values
Constructor Detail

ChargeValidator

public ChargeValidator()
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

getMaxFlat

public double getMaxFlat()

getMinFlat

public double getMinFlat()

getMaxFractional

public double getMaxFractional()

getMinFractional

public double getMinFractional()

getMax

public double getMax(int type)

getMin

public double getMin(int type)

check

public void check(java.lang.String specialistId,
                  double[] fees)
           throws InvalidChargeException
Throws exceptions when NaN or Infinity values appear in the fee array and the banning policy is in effect. When the banning policy is not in effect, those invalid values will be replaced by minimum or maximum values allowed. This helps to avoid kicking out certain specialists that often propose invalid fees.

Parameters:
specialistId -
fees -
Throws:
InvalidChargeException