X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FSchedule.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FSchedule.java;h=688afca8bc9bf2f7f067de935f6a1ca85c829859;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/mapping/Schedule.java b/dol/src/dol/datamodel/mapping/Schedule.java new file mode 100644 index 0000000..688afca --- /dev/null +++ b/dol/src/dol/datamodel/mapping/Schedule.java @@ -0,0 +1,160 @@ +/* $Id: Schedule.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.datamodel.mapping; + +import java.util.Vector; + +import dol.datamodel.architecture.ArchiResource; +import dol.visitor.MapVisitor; + +/** + * This class represents a schedule element in the mapping. + */ +public class Schedule extends MapResource { + + /** + * Constructor to create a Schedule with a name. + */ + public Schedule(String name) { + super(name); + _entryList = new Vector(); + _cfgList = new Vector(); + } + + /** + * Accept a Visitor + * + * @param x visitor object + */ + public void accept(MapVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this Schedule resource. + * + * @return new instance of the Schedule resource. + */ + @SuppressWarnings("unchecked") + public Object clone() { + Schedule newObj = (Schedule) super.clone(); + newObj.setResource(_resource); + newObj.setSchedPolicy(_policy); + newObj.setCfgList((Vector)_cfgList.clone() ); + newObj.setEntryList((Vector)_entryList.clone()); + return (newObj); + } + + /** Set the resource, a HW channel or a processor from the architecture */ + public void setResource(ArchiResource r) { + _resource = r; + } + + /** Get the resource */ + public ArchiResource getResource() { + return _resource; + } + + /** Set the scheduling policy */ + public void setSchedPolicy(SchedulingPolicy p) { + _policy = p; + } + + /** Get the scheduling policy */ + public SchedulingPolicy getSchedPolicy() { + return _policy; + } + + /** + * Get the list of configurations of this schedule. + * + * @return list of configurations + */ + public Vector getCfgList() { + return _cfgList; + } + + /** + * Set the list of configurations of this schedule. + * + * @param cfgList configuration list + */ + public void setCfgList(Vector cfgList) { + _cfgList = cfgList; + } + + /** + * Set the list of scheduler table entries. + * + * @param entryList The new list + */ + public void setEntryList(Vector entryList) { + _entryList = entryList; + } + + /** Get the list of scheduler table entries */ + public Vector getEntryList() { + return _entryList; + } + + /** + * Return the scheduler table entry with its schedule configuration + * that has a specific name. + * Return null if the entry cannot be found. + * + * @param name the name of the entry for which we are looking for. + * @return the entry with its schedule configuration with the specified name. + */ + public ScheduleEntry getScheduleEntry(String name) { + for(ScheduleEntry entry : _entryList) { + if (entry.getName().equals(name)) { + return entry; + } + } + return null; + } + + /** + * Return the value for the given configuration key. Return null + * when the key cannot be found. + * + * @param name name of the configuration key to search for + * @return value of the specified configuration key + */ + public String getCfgValue(String name) { + for(Configuration c : _cfgList) { + if(c.getName().equals(name)) { + return c.getValue(); + } + } + return null; + } + + /** + * Return a string representation of the Schedule. + * + * @return string representation of the Schedule + */ + public String toString() { + return "Schedule: " + getName(); + } + + /** Resource that is scheduled */ + ArchiResource _resource = null; + + /** Scheduling policy */ + SchedulingPolicy _policy = null; + + /** List of the configurations of the Schedule */ + protected Vector _cfgList = null; + + /** List of scheduler table entries */ + Vector _entryList = null; + + /** Configuration key for the slots per cycle of a TDMA scheduler */ + final public static String cfdTdmaSlotsPerCycle = "slotsonecycle"; + + /** Configuration key for the general slot length + * in nanoseconds of a TDMA scheduler */ + final public static String cfgTdmaSlotLength = "slotlength"; + +}