1 /* $Id: ScheduleEntry.java 1 2010-02-24 13:03:05Z haidw $ */
\r
2 package dol.datamodel.mapping;
\r
4 import java.util.Vector;
\r
6 import dol.datamodel.pn.Schedulable;
\r
7 import dol.visitor.MapVisitor;
\r
10 * This class represents an origin element in the mapping which refers
\r
11 * to a PN process or a SW channel with a configuration element.
\r
13 public class ScheduleEntry extends MapResource {
\r
16 * Constructor to create a ScheduleProcess with a name.
\r
18 public ScheduleEntry(String name) {
\r
20 _cfgList = new Vector<Configuration>();
\r
26 * @param x visitor object
\r
28 public void accept(MapVisitor x) {
\r
29 x.visitComponent(this);
\r
33 * Clone this ScheduleProcess resource.
\r
35 * @return new instance of the ScheduleProcess resource.
\r
37 @SuppressWarnings("unchecked")
\r
38 public Object clone() {
\r
39 ScheduleEntry newObj = (ScheduleEntry) super.clone();
\r
40 newObj.setConsumer(_consumer);
\r
41 newObj.setCfgList((Vector<Configuration>)_cfgList.clone());
\r
46 * Get the list of configurations of this scheduled process.
\r
48 * @return list of configurations
\r
50 public Vector<Configuration> getCfgList() {
\r
55 * Set the list of configurations of this scheduled process.
\r
57 * @param cfgList configuration list
\r
59 public void setCfgList(Vector<Configuration> cfgList) {
\r
63 /** Set the consumer */
\r
64 public void setConsumer(Schedulable c) {
\r
68 /** Get the consumer */
\r
69 public Schedulable getConsumer() {
\r
74 * Return the value for the given configuration key. Return null
\r
75 * when the key cannot be found.
\r
77 * @param name name of the configuration key to search for
\r
78 * @return value of the specified configuration key
\r
80 public String getCfgValue(String name) {
\r
81 for(Configuration c : _cfgList) {
\r
82 if(c.getName().equals(name)) {
\r
83 return c.getValue();
\r
90 * Return a string representation of the ScheduleProcess.
\r
92 * @return string representation of the ScheduleProcess
\r
94 public String toString() {
\r
95 return "ScheduleProcess: " + getName();
\r
98 /** Consumer: PN process or SW channel */
\r
99 private Schedulable _consumer = null;
\r
101 /** list of the configurations of the ScheduleProcess */
\r
102 protected Vector<Configuration> _cfgList = null;
\r
104 /** Configuration key for the priority of a task in a fixed priority scheduler */
\r
105 final public static String cfgFpPriority = "priority";
\r
107 /** Configuration key for the index of the TDMA slot of a process */
\r
108 final public static String cfgTdmaStartSlot = "startslot";
\r
110 /** Configuration key for the number of TDMA slots for a process */
\r
111 final public static String cfgTdmaNumberOfSlots = "numberofslots";
\r