mns
Class Command

java.lang.Object
  extended by java.lang.Thread
      extended by mns.Command
All Implemented Interfaces:
BioDeviceListener, java.lang.Cloneable, java.lang.Runnable, Commandable
Direct Known Subclasses:
CommandThread, ComplexCommand, SynchroSpeachThread

public abstract class Command
extends java.lang.Thread
implements java.lang.Cloneable, BioDeviceListener, Commandable

Author:
Martin Lukac The general superclass of all MNS commands, it provides all possible ways to format the command and make it ready for execution

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface mns.Commandable
DELAYED_ACT, MULTIPLE_ACT, PERIODIC_ACT, RANDOM_VALUE_MODE, REPEAT_VALUE_MODE, RRANGE_VALUE_MODE, SINGLE_ACT
 
Constructor Summary
Command(java.lang.String name)
           
 
Method Summary
protected  void addListener()
          private method for adding this to the biodevices as a listener
 Command cloneCommand()
           
 int getAssignDevices()
           
 java.lang.String getBioname()
           
 java.lang.Object[] getCommand()
           
 int getExecDependency()
           
 int getExecMode()
           
 int getExecType()
           
 java.lang.Object[] getInstructions()
           
 char getKey()
           
 int getMode()
           
 MNSRobotPart getPart()
           
 int getPeriod()
           
 boolean isDone()
           
 boolean isNominal()
           
 void setAssignDevices(int assignDevices)
           
 void setCommand(java.lang.Object[] command)
           
 void setDone(boolean done)
           
 void setExecDependency(int execDependency)
           
 void setExecMode(int execMode)
           
 void setexecPeriod(int execPeriod)
          external tool to modify the execution period
 void setExecType(int execType)
           
 void setKey(char key)
           
 void setNominal(boolean isNominal)
           
 void setPart(MNSRobotPart part)
           
 void setSingleCom(java.lang.Object o, int index)
          set a single instruction at index
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface biocell.BioDeviceListener
bioEvent
 
Methods inherited from interface mns.Commandable
getName, setName
 

Constructor Detail

Command

public Command(java.lang.String name)
Method Detail

getCommand

public java.lang.Object[] getCommand()
Specified by:
getCommand in interface Commandable
Returns:
Returns the command.

setCommand

public void setCommand(java.lang.Object[] command)
Specified by:
setCommand in interface Commandable
Parameters:
command - The command to set.

setexecPeriod

public void setexecPeriod(int execPeriod)
external tool to modify the execution period

Specified by:
setexecPeriod in interface Commandable
Parameters:
execPeriod - integer

setSingleCom

public void setSingleCom(java.lang.Object o,
                         int index)
set a single instruction at index

Specified by:
setSingleCom in interface Commandable
Parameters:
o - - the instruction
index - - the index of the instruction

getInstructions

public java.lang.Object[] getInstructions()
Specified by:
getInstructions in interface Commandable
Returns:
- the array of individual commands

getPeriod

public int getPeriod()
Specified by:
getPeriod in interface Commandable
Returns:
- the period for this command

getMode

public int getMode()
Specified by:
getMode in interface Commandable
Returns:

cloneCommand

public Command cloneCommand()
Specified by:
cloneCommand in interface Commandable
Returns:
- copy of this command

getExecMode

public int getExecMode()
Specified by:
getExecMode in interface Commandable
Returns:
Returns the execMode.

setExecMode

public void setExecMode(int execMode)
Specified by:
setExecMode in interface Commandable
Parameters:
execMode - The execMode to set.

getExecType

public int getExecType()
Specified by:
getExecType in interface Commandable
Returns:
Returns the execType.

setExecType

public void setExecType(int execType)
Specified by:
setExecType in interface Commandable
Parameters:
execType - The execType to set.

getExecDependency

public int getExecDependency()
Specified by:
getExecDependency in interface Commandable
Returns:
Returns the execDependency.

setExecDependency

public void setExecDependency(int execDependency)
Specified by:
setExecDependency in interface Commandable
Parameters:
execDependency - The execDependency to set.

isNominal

public boolean isNominal()
Specified by:
isNominal in interface Commandable
Returns:
Returns the isNominal.

setNominal

public void setNominal(boolean isNominal)
Specified by:
setNominal in interface Commandable
Parameters:
isNominal - The isNominal to set.

getAssignDevices

public int getAssignDevices()
Specified by:
getAssignDevices in interface Commandable
Returns:
Returns the assignDevices.

setAssignDevices

public void setAssignDevices(int assignDevices)
Specified by:
setAssignDevices in interface Commandable
Parameters:
assignDevices - The assignDevices to set.

getPart

public MNSRobotPart getPart()
Specified by:
getPart in interface Commandable
Returns:
Returns the part.

setPart

public void setPart(MNSRobotPart part)
Specified by:
setPart in interface Commandable
Parameters:
part - The part to set.

isDone

public boolean isDone()
Specified by:
isDone in interface Commandable
Returns:
Returns the done.

setDone

public void setDone(boolean done)
Specified by:
setDone in interface Commandable
Parameters:
done - The done to set.

addListener

protected void addListener()
private method for adding this to the biodevices as a listener


getKey

public char getKey()
Returns:
Returns the key.

setKey

public void setKey(char key)
Parameters:
key - The key to set.

getBioname

public java.lang.String getBioname()
Returns:
Returns the bioname.