X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FScheduleEntry.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FScheduleEntry.java;h=2ee5331440eb4d8c4119ff7c469b8ec473fd6864;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/mapping/ScheduleEntry.java b/dol/src/dol/datamodel/mapping/ScheduleEntry.java new file mode 100644 index 0000000..2ee5331 --- /dev/null +++ b/dol/src/dol/datamodel/mapping/ScheduleEntry.java @@ -0,0 +1,113 @@ +/* $Id: ScheduleEntry.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.datamodel.mapping; + +import java.util.Vector; + +import dol.datamodel.pn.Schedulable; +import dol.visitor.MapVisitor; + +/** + * This class represents an origin element in the mapping which refers + * to a PN process or a SW channel with a configuration element. + */ +public class ScheduleEntry extends MapResource { + + /** + * Constructor to create a ScheduleProcess with a name. + */ + public ScheduleEntry(String name) { + super(name); + _cfgList = new Vector(); + } + + /** + * Accept a Visitor + * + * @param x visitor object + */ + public void accept(MapVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this ScheduleProcess resource. + * + * @return new instance of the ScheduleProcess resource. + */ + @SuppressWarnings("unchecked") + public Object clone() { + ScheduleEntry newObj = (ScheduleEntry) super.clone(); + newObj.setConsumer(_consumer); + newObj.setCfgList((Vector)_cfgList.clone()); + return (newObj); + } + + /** + * Get the list of configurations of this scheduled process. + * + * @return list of configurations + */ + public Vector getCfgList() { + return _cfgList; + } + + /** + * Set the list of configurations of this scheduled process. + * + * @param cfgList configuration list + */ + public void setCfgList(Vector cfgList) { + _cfgList = cfgList; + } + + /** Set the consumer */ + public void setConsumer(Schedulable c) { + _consumer = c; + } + + /** Get the consumer */ + public Schedulable getConsumer() { + return _consumer; + } + + /** + * 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 ScheduleProcess. + * + * @return string representation of the ScheduleProcess + */ + public String toString() { + return "ScheduleProcess: " + getName(); + } + + /** Consumer: PN process or SW channel */ + private Schedulable _consumer = null; + + /** list of the configurations of the ScheduleProcess */ + protected Vector _cfgList = null; + + /** Configuration key for the priority of a task in a fixed priority scheduler */ + final public static String cfgFpPriority = "priority"; + + /** Configuration key for the index of the TDMA slot of a process */ + final public static String cfgTdmaStartSlot = "startslot"; + + /** Configuration key for the number of TDMA slots for a process */ + final public static String cfgTdmaNumberOfSlots = "numberofslots"; + +}