+/* $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<Process>();
+ }
+
+ /**
+ * 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<Process>)_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<Process> processList)
+ {
+ _processList = processList;
+ }
+
+ /**
+ * Get the list of processes bound to this processor.
+ */
+ public Vector<Process> 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<Process> _processList;
+}