source: src/main/java/negotiator/onetomany/Product.java@ 226

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

GUI updated (using Jpanel). DemandPlanDrawing updated. PutImaged renamed to DrawImage. DemandPlan is updating for the Utility, Bid, and Preference classes. Protocol and Agents packages (and some classes) added.

File size: 779 bytes
Line 
1package negotiator.onetomany;
2
3import java.awt.Color;
4
5/**
6 * A product, such as Paracetamol, or a Red Dot
7 */
8public class Product
9{
10
11 String id;
12
13 public Product(String id)
14 {
15 this.id = id;
16 }
17
18 @Override
19 public String toString()
20 {
21 return id;
22 }
23
24 public Color getColor() //anyway, gives the result in RGB ! :)
25
26 {
27 switch(id.toLowerCase())
28 {
29 case "red":
30 return Color.RED;
31 case "blue":
32 return Color.BLUE;
33 case "pink":
34 return Color.PINK;
35 case "orange":
36 return Color.ORANGE;
37 default:
38 System.out.println("Undefined color!");
39 return null;
40 }
41 }
42
43 public Color getRGBColor(String s) // to be able to pass colors in RGB hex strings
44 {
45 return Color.decode(s);
46 }
47
48}
Note: See TracBrowser for help on using the repository browser.