1 /* $Id: Schedule.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.architecture.ArchiResource;
\r
7 import dol.visitor.MapVisitor;
\r
10 * This class represents a schedule element in the mapping.
\r
12 public class Schedule extends MapResource {
\r
15 * Constructor to create a Schedule with a name.
\r
17 public Schedule(String name) {
\r
19 _entryList = new Vector<ScheduleEntry>();
\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 Schedule resource.
\r
35 * @return new instance of the Schedule resource.
\r
37 @SuppressWarnings("unchecked")
\r
38 public Object clone() {
\r
39 Schedule newObj = (Schedule) super.clone();
\r
40 newObj.setResource(_resource);
\r
41 newObj.setSchedPolicy(_policy);
\r
42 newObj.setCfgList((Vector<Configuration>)_cfgList.clone() );
\r
43 newObj.setEntryList((Vector<ScheduleEntry>)_entryList.clone());
\r
47 /** Set the resource, a HW channel or a processor from the architecture */
\r
48 public void setResource(ArchiResource r) {
\r
52 /** Get the resource */
\r
53 public ArchiResource getResource() {
\r
57 /** Set the scheduling policy */
\r
58 public void setSchedPolicy(SchedulingPolicy p) {
\r
62 /** Get the scheduling policy */
\r
63 public SchedulingPolicy getSchedPolicy() {
\r
68 * Get the list of configurations of this schedule.
\r
70 * @return list of configurations
\r
72 public Vector<Configuration> getCfgList() {
\r
77 * Set the list of configurations of this schedule.
\r
79 * @param cfgList configuration list
\r
81 public void setCfgList(Vector<Configuration> cfgList) {
\r
86 * Set the list of scheduler table entries.
\r
88 * @param entryList The new list
\r
90 public void setEntryList(Vector<ScheduleEntry> entryList) {
\r
91 _entryList = entryList;
\r
94 /** Get the list of scheduler table entries */
\r
95 public Vector<ScheduleEntry> getEntryList() {
\r
100 * Return the scheduler table entry with its schedule configuration
\r
101 * that has a specific name.
\r
102 * Return null if the entry cannot be found.
\r
104 * @param name the name of the entry for which we are looking for.
\r
105 * @return the entry with its schedule configuration with the specified name.
\r
107 public ScheduleEntry getScheduleEntry(String name) {
\r
108 for(ScheduleEntry entry : _entryList) {
\r
109 if (entry.getName().equals(name)) {
\r
117 * Return the value for the given configuration key. Return null
\r
118 * when the key cannot be found.
\r
120 * @param name name of the configuration key to search for
\r
121 * @return value of the specified configuration key
\r
123 public String getCfgValue(String name) {
\r
124 for(Configuration c : _cfgList) {
\r
125 if(c.getName().equals(name)) {
\r
126 return c.getValue();
\r
133 * Return a string representation of the Schedule.
\r
135 * @return string representation of the Schedule
\r
137 public String toString() {
\r
138 return "Schedule: " + getName();
\r
141 /** Resource that is scheduled */
\r
142 ArchiResource _resource = null;
\r
144 /** Scheduling policy */
\r
145 SchedulingPolicy _policy = null;
\r
147 /** List of the configurations of the Schedule */
\r
148 protected Vector<Configuration> _cfgList = null;
\r
150 /** List of scheduler table entries */
\r
151 Vector<ScheduleEntry> _entryList = null;
\r
153 /** Configuration key for the slots per cycle of a TDMA scheduler */
\r
154 final public static String cfdTdmaSlotsPerCycle = "slotsonecycle";
\r
156 /** Configuration key for the general slot length
\r
157 * in nanoseconds of a TDMA scheduler */
\r
158 final public static String cfgTdmaSlotLength = "slotlength";
\r