edu.neu.ccs.buyer
Class Buyer

java.lang.Object
  extended by gen.Player
      extended by edu.neu.ccs.buyer.Buyer

public class Buyer
extends gen.Player

Represents a buyer. Provides all teh functions that a buyer might want to do while playing SDG game

Author:
Charu Chandra and Wu Jiang

Nested Class Summary
 
Nested classes/interfaces inherited from class gen.Player
gen.Player.id, gen.Player.name
 
Field Summary
 
Fields inherited from class gen.Player
id, name
 
Constructor Summary
Buyer(int id, java.lang.String name)
           
 
Method Summary
static double findQuality(gen.RawMaterial rawMaterial, gen.Assignment assign)
          Calculates the quality of assignment for the input raw material.
 gen.Assignment getFinishedProduct(gen.RawMaterial rm)
          Provides a finished product for the given raw material
 boolean goodBuy(gen.Derivative d)
          Suggests if the derivative with a list of relations is a good buy or not Takes only two relations
 boolean goodBuy(gen.Derivative d, double p)
          Suggests if the derivative with a list of relations is a good buy or not.
 boolean goodBuy(gen.Type type, gen.Price price)
          Suggests if the derivative with a list of relations is a good buy or not
 
Methods inherited from class gen.Player
display, equals, parse, parse, parse, print, toStr
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Buyer

public Buyer(int id,
             java.lang.String name)
Method Detail

goodBuy

public boolean goodBuy(gen.Derivative d)
Suggests if the derivative with a list of relations is a good buy or not Takes only two relations

Parameters:
Derivative -
price -
Returns:
boolean

goodBuy

public boolean goodBuy(gen.Derivative d,
                       double p)
Suggests if the derivative with a list of relations is a good buy or not. The derivative should make at least p amount of profit. Takes only two relations

Parameters:
Derivative -
price -
Returns:
boolean

goodBuy

public boolean goodBuy(gen.Type type,
                       gen.Price price)
Suggests if the derivative with a list of relations is a good buy or not

Parameters:
type -
price -
Returns:
boolean

getFinishedProduct

public gen.Assignment getFinishedProduct(gen.RawMaterial rm)
                                  throws java.lang.Exception
Provides a finished product for the given raw material

Parameters:
rm -
Returns:
Throws:
java.lang.Exception

findQuality

public static double findQuality(gen.RawMaterial rawMaterial,
                                 gen.Assignment assign)
                          throws java.lang.Exception
Calculates the quality of assignment for the input raw material.

Parameters:
rawMaterial - in form of RawMaterial object
assign - in form of Assignment object
Returns:
quality achieved by the assignment
Throws:
java.lang.Exception - Any exception produced during calculation