source: src/main/java/onetomany/etc/Product.java@ 256

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

Commit #1 of:
+ negotiator.onetomany package refactored into onetomany package.
+ info created for all contained the packages.
+ current work defined under onetomany.bargainingchipsgame.
+ in this package, onetomany.bargainingchipsgame.players package includes packages for utility function, coordinator, negotiatior, and buyer and seller.
+ negotiator.onetomany package now contains nothing, can be deleted.
+ Interaction thread

File size: 772 bytes
Line 
1package onetomany.etc;
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.