edu.cuny.cat.market.accepting
Class StandingAverageBeatingAcceptingPolicy
java.lang.Object
  
edu.cuny.cat.market.AuctioneerPolicy
      
edu.cuny.cat.market.accepting.ShoutAcceptingPolicy
          
edu.cuny.cat.market.accepting.OnlyNewShoutDecidingAcceptingPolicy
              
edu.cuny.cat.market.accepting.StandingAverageBeatingAcceptingPolicy
- All Implemented Interfaces: 
 - AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Resetable
 
public class StandingAverageBeatingAcceptingPolicy
- extends OnlyNewShoutDecidingAcceptingPolicy
 
This accepting policy compares a shout with the average price of the existing
 shouts on the same side and allows the shout to place only if it is no less
 competitive than the average. It also uses a parameter, ratio, to loose or
 tighten the restriction by adding the product of ratio and the variance to
 the average. When ratio is positive, it looses the restriction, while when it
 is negative, it tightens the restriction.
 
 This policy should be distinguished from
 SlidingMatchedAverageBeatingAcceptingPolicy.
 SlidingMatchedAverageBeatingAcceptingPolicy averages prices of matched
 shouts, while this policy averages prices of standing shouts.
 
 
 
 Parameters
 
 
 
 base.ratio 
 double (0 by default) | 
 (a factor to adjust the restriction threshold by how many
 variances) | 
 
 
 
- Version:
 
  - $Revision: 1.5 $
 
- Author:
 
  - Jinzhong Niu
 
 
 
 
 
 
 
 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
P_RATIO
public static final java.lang.String P_RATIO
- See Also:
 - Constant Field Values
 
askAverageTracker
protected StandingAverageBeatingAcceptingPolicy.ShoutAverageTracker askAverageTracker
bidAverageTracker
protected StandingAverageBeatingAcceptingPolicy.ShoutAverageTracker bidAverageTracker
ratio
protected double ratio
StandingAverageBeatingAcceptingPolicy
public StandingAverageBeatingAcceptingPolicy()
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- Overrides:
 setup in class AuctioneerPolicy
 
 
reset
public void reset()
- Description copied from class: 
AuctioneerPolicy 
- resets the state to be the same as the policy is created and initialized.
- Specified by:
 reset in interface edu.cuny.obj.Resetable- Overrides:
 reset in class AuctioneerPolicy
 
 
 
getRatio
public double getRatio()
- Returns:
 - ratio
 
 
setRatio
public void setRatio(double ratio)
- Parameters:
 ratio - 
 
getShoutAverage
public StandingAverageBeatingAcceptingPolicy.ShoutAverageTracker getShoutAverage(boolean isAsk)
- Parameters:
 isAsk - 
- Returns:
 - the shout average tracker requested
 
 
check
public void check(Shout shout)
           throws IllegalShoutException
- accepts all shouts that are no less competitive than the average of
 standing shouts from the same side, or 
IllegalShoutException is
 thrown otherwise.
- Specified by:
 check in class OnlyNewShoutDecidingAcceptingPolicy
 
- Parameters:
 shout - the shout being checked.
- Throws:
 IllegalShoutException- See Also:
 OnlyNewShoutDecidingAcceptingPolicy.check(edu.cuny.cat.core.Shout)
 
 
eventOccurred
public void eventOccurred(AuctionEvent event)
- Specified by:
 eventOccurred in interface AuctionEventListener- Overrides:
 eventOccurred in class AuctioneerPolicy
 
 
toString
public java.lang.String toString()
- Overrides:
 toString in class AuctioneerPolicy