Go to most recent revision | Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 915 | migan | 1 | package items; |
| 2 | |||
| 3 | import java.util.ArrayList; |
||
| 4 | |||
| 5 | public class Module |
||
| 6 | { |
||
| 7 | private int id; |
||
| 8 | private String name; |
||
| 9 | private CanClass canClass; |
||
| 10 | private String description; |
||
| 11 | private ArrayList<SupportedCommand> supportedCommands; |
||
| 12 | |||
| 13 | public Module() |
||
| 14 | { |
||
| 15 | this.supportedCommands = new ArrayList<SupportedCommand>(); |
||
| 16 | } |
||
| 17 | |||
| 18 | public Module(int id, String name, CanClass canClass, String description) |
||
| 19 | { |
||
| 20 | this.id = id; |
||
| 21 | this.name = name; |
||
| 22 | this.canClass = canClass; |
||
| 23 | this.description = description; |
||
| 24 | this.supportedCommands = new ArrayList<SupportedCommand>(); |
||
| 25 | } |
||
| 26 | |||
| 27 | public int getId() |
||
| 28 | { |
||
| 29 | return this.id; |
||
| 30 | } |
||
| 31 | |||
| 32 | public void setId(int id) |
||
| 33 | { |
||
| 34 | this.id = id; |
||
| 35 | } |
||
| 36 | |||
| 37 | public String getName() |
||
| 38 | { |
||
| 39 | return this.name; |
||
| 40 | } |
||
| 41 | |||
| 42 | public void setName(String name) |
||
| 43 | { |
||
| 44 | this.name = name; |
||
| 45 | } |
||
| 46 | |||
| 47 | public CanClass getCanClass() |
||
| 48 | { |
||
| 49 | return this.canClass; |
||
| 50 | } |
||
| 51 | |||
| 52 | public void setCanClass(CanClass canClass) |
||
| 53 | { |
||
| 54 | this.canClass = canClass; |
||
| 55 | } |
||
| 56 | |||
| 57 | public String getDescription() |
||
| 58 | { |
||
| 59 | return this.description; |
||
| 60 | } |
||
| 61 | |||
| 62 | public void setDescription(String description) |
||
| 63 | { |
||
| 64 | this.description = description; |
||
| 65 | } |
||
| 66 | |||
| 67 | public ArrayList<SupportedCommand> getSupportedCommands() |
||
| 68 | { |
||
| 69 | return this.supportedCommands; |
||
| 70 | } |
||
| 71 | |||
| 72 | public void setSupportedCommands(ArrayList<SupportedCommand> supportedCommands) |
||
| 73 | { |
||
| 74 | this.supportedCommands = supportedCommands; |
||
| 75 | } |
||
| 76 | |||
| 77 | public void addSupportedCommand(SupportedCommand supportedCommand) |
||
| 78 | { |
||
| 79 | this.supportedCommands.add(supportedCommand); |
||
| 80 | } |
||
| 81 | |||
| 82 | public String getCDefineName() |
||
| 83 | { |
||
| 84 | return "CAN_TYPE_MODULE_" + this.name; |
||
| 85 | } |
||
| 86 | |||
| 87 | public String getSupportedCommandsString() |
||
| 88 | { |
||
| 89 | String result = ""; |
||
| 90 | |||
| 91 | for (int n = 0; n < this.supportedCommands.size(); n++) |
||
| 92 | { |
||
| 93 | result += this.supportedCommands.get(n).toString(); |
||
| 94 | } |
||
| 95 | |||
| 96 | return result; |
||
| 97 | } |
||
| 98 | |||
| 99 | public String toString() |
||
| 100 | { |
||
| 101 | String buffer = ""; |
||
| 102 | buffer += this.getName() + " (" + this.getId() + ")\n"; |
||
| 103 | buffer += "C define name: " + this.getCDefineName() + "\n"; |
||
| 104 | buffer += "Class: " + this.getCanClass().getName() + "\n"; |
||
| 105 | buffer += "Supported commands:\n"; |
||
| 106 | buffer += this.getSupportedCommandsString(); |
||
| 107 | buffer += "Description: " + this.getDescription() + "\n"; |
||
| 108 | return buffer; |
||
| 109 | } |
||
| 110 | } |