X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Farchitecture%2FProcessor.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Farchitecture%2FProcessor.java;h=cffc781e781a69ca1b1b5a2a4045c226d575b92a;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/architecture/Processor.java b/dol/src/dol/datamodel/architecture/Processor.java new file mode 100644 index 0000000..cffc781 --- /dev/null +++ b/dol/src/dol/datamodel/architecture/Processor.java @@ -0,0 +1,135 @@ +/* $Id: Processor.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.datamodel.architecture; + +import java.util.Vector; + +import dol.datamodel.pn.Process; +import dol.visitor.ArchiVisitor; + +/** + * This class represents a processor element in the architecture. + */ +public class Processor extends ArchiResource { + + /** + * Constructor to create a Processor with a name and an empty + * nodeList. + */ + public Processor(String name) { + super(name); + _processList = new Vector(); + } + + /** + * Accept a Visitor + * @param x A Visitor Object. + */ + public void accept(ArchiVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this Processor + * + * @return a new instance of the Processor. + */ + @SuppressWarnings("unchecked") + public Object clone() { + Processor newObj = (Processor) super.clone(); + newObj.setProcessList((Vector)_processList.clone()); + return (newObj); + } + + /** + * Get the range of this processor. + * + * @return range + */ + public String getRange() { + return _range; + } + + /** + * Set the range of this process. + * + * @param range new range value + */ + public void setRange(String range) { + _range= range; + } + + /** + * Get the type of this processor. + * + * @return type + */ + public String getType() { + return _type; + } + + /** + * Set the type of this processor. + * + * @param type new range value + */ + public void setType(String type) { + _type= type; + } + + + + /** + * Set the list of processes bound to this processor. + * @param processList the new process list + */ + public void setProcessList(Vector processList) + { + _processList = processList; + } + + /** + * Get the list of processes bound to this processor. + */ + public Vector getProcessList() + { + return _processList; + } + + /** + * Indicates if a process with a specific name is bound + * to this processor. + * @param name the name of the process to search for + * @return true if a process with the specifed name is bound to this + * processor + */ + public boolean hasProcess(String name) + { + for (Process iter : _processList) { + if (iter.getName().equals(name)) + return true; + } + + return false; + } + + /** + * Return a description of the processor. + * + * @return a description of the processor. + */ + public String toString() { + return "Processor: " + getName() ; + } + + /** + * Range of the iterator when the instance belongs to an iterated + * series of processors. + */ + protected String _range; + protected String _type; + + /** + * List of processes bound to this processor. + */ + protected Vector _processList; +}