source: src/main/java/negotiator/onetomany/domain/Chip.java@ 233

Last change on this file since 233 was 233, checked in by Faria Nassiri Mofakham, 5 years ago

Some changes in Bundle class: method aggregationWith(Stack), but still it doesn't return back well when called from null bundles.

File size: 1.6 KB
Line 
1/**
2 * Chip class
3 */
4package negotiator.onetomany.domain;
5
6import java.awt.Color;
7
8/**
9 * Chip is the fundamental element of the market domain in Bargaining Chips Game.
10 * Chip could be assumed as any item at any scenario, e.g. Paracetamol in pharmaceutical market, a chair in furniture market, or a Red Dot.
11 * A chip=(color, unit price), where color is the id of the chip.
12 *
13 * @author Faria Nassiri-Mofakham
14 */
15
16public class Chip
17{
18
19 private String color;
20 private double price;
21
22 public Chip()
23 {
24 setColor(null);
25 setPrice(-1);
26 }
27
28 public Chip(String c, double p)
29 {
30 setColor(c);
31 setPrice(p);
32 }
33
34 /**
35 * @param c the color to set
36 */
37 public void setColor(String c)
38 {
39 this.color = c;
40 }
41
42 /**
43 * @param p the price to set
44 */
45 public void setPrice(double p)
46 {
47 this.price = p;
48 }
49
50 /**
51 * @return the color
52 */
53 public String getColor()
54 {
55 return color;
56 }
57
58 /**
59 * @return the price
60 */
61 public Double getPrice()
62 {
63 return price;
64 }
65
66 /**
67 * @return the color
68 */
69 public Color toRGB() //anyway, gives the result in RGB ! :)
70 {
71 return Color.decode(color);
72 }
73
74// public String RGBtoColor(Color c)
75// {
76//// c= new Color((int)(Math.random()*266,(int)(Math.random()*266,(int)(Math.random()*266)
77//// return c.getRGB();
78// }
79
80 @Override
81 public String toString()
82 {
83 return "("+getColor()+","+getPrice().floatValue()+"$)";
84 // other representations
85 //return this.getClass().getSimpleName()+"("+getColor()+","+getPrice().floatValue()+"$)";
86 // // return getColor()+" "+this.getClass().getSimpleName()+" for "+getPrice()+"$";
87 }
88}
Note: See TracBrowser for help on using the repository browser.