energyTycoon
Class ExchangeServer

java.lang.Object
  extended by energyTycoon.Exchange
      extended by energyTycoon.ExchangeServer

public class ExchangeServer
extends Exchange

Exchange rules between two players

Author:
Leo CARNAUT-DELORD

Constructor Summary
ExchangeServer(NetworkServerPlayer owner, NetworkServerPlayer proCustomer)
           
 
Method Summary
 void buy(int quantity)
          buy energy
 boolean canBuy()
          test if the player can buy to this customer
 boolean canSell()
          test if the player can sell to this customer
 int getBuyPrice()
          get the price the player will pay energy
 NetworkServerPlayer getProCustomer()
          get pro customer ( other provider )
 int maxAvailableToBuy()
          get the maximum energy available to buy
 int maxAvailableToSell()
          get the maximum energy available to sell
 void reset()
          reset sell frame counter
 void sell(int quantity)
          sell energy
 void setMirror(ExchangeServer mirror)
           
 
Methods inherited from class energyTycoon.Exchange
changeValues, getBuyMax, getBuyMaxPrice, getSellMax, getSellPrice, setBuyMax, setBuyMaxPrice, setSellMax, setSellPrice
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExchangeServer

public ExchangeServer(NetworkServerPlayer owner,
                      NetworkServerPlayer proCustomer)
Parameters:
owner -
proCustomer -
Method Detail

setMirror

public void setMirror(ExchangeServer mirror)
Parameters:
mirror -

getProCustomer

public NetworkServerPlayer getProCustomer()
get pro customer ( other provider )

Returns:

getBuyPrice

public int getBuyPrice()
get the price the player will pay energy

Returns:
energy price

reset

public void reset()
reset sell frame counter


canSell

public boolean canSell()
test if the player can sell to this customer

Returns:
true if he can

canBuy

public boolean canBuy()
test if the player can buy to this customer

Returns:
true if he can

maxAvailableToBuy

public int maxAvailableToBuy()
get the maximum energy available to buy

Returns:
maximum available

maxAvailableToSell

public int maxAvailableToSell()
get the maximum energy available to sell

Returns:
maximum available

buy

public void buy(int quantity)
buy energy

Parameters:
quantity - quantity to buy

sell

public void sell(int quantity)
sell energy

Parameters:
quantity - quantity to sell