edu.neu.ccs.seller
Class Seller
java.lang.Object
gen.Player
edu.neu.ccs.seller.Seller
public class Seller
- extends gen.Player
Represents a Seller and provides all the operations that a seller might require for playing SDG.
- Author:
- Charu Chandra and Wu Jiang
Nested classes/interfaces inherited from class gen.Player |
gen.Player.id, gen.Player.name |
Fields inherited from class gen.Player |
name |
Constructor Summary |
Seller(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.Derivative |
generateDerivative(java.lang.String dName)
Derivatives are generated randomly choosing two relations
which gives profit of atleast 0.06 |
gen.RawMaterial |
generateRawMaterial(int numVar,
gen.Type type)
Generates Raw material. |
gen.Price |
getPrice(gen.Derivative d)
Gets the optimum price for the given derivative. |
gen.Price |
getPrice(gen.Type type)
Gets the optimum price for the given relations in form of Type. |
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 |
Seller
public Seller(int id,
java.lang.String name)
generateDerivative
public gen.Derivative generateDerivative(java.lang.String dName)
throws java.lang.Exception
- Derivatives are generated randomly choosing two relations
which gives profit of atleast 0.06
- Parameters:
dName
-
- Throws:
java.lang.Exception
getPrice
public gen.Price getPrice(gen.Type type)
- Gets the optimum price for the given relations in form of Type. Currently it works for only two relations.
- Parameters:
type
-
- Returns:
getPrice
public gen.Price getPrice(gen.Derivative d)
- Gets the optimum price for the given derivative. Currently it works for only two relations.
- Parameters:
type
-
- Returns:
generateRawMaterial
public gen.RawMaterial generateRawMaterial(int numVar,
gen.Type type)
throws java.lang.Exception
- Generates Raw material. It can currently generate raw material
for only for the first two relations.
- Parameters:
numVar
- - number of variablestype
- - Type containing TypeInstance
- Returns:
- RawMaterial
- 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 objectassign
- in form of Assignment object
- Returns:
- quality achieved by the assignment
- Throws:
java.lang.Exception
- Any exception produced during calculation