From afed274c10a93957f82a009824cafe8d83aa68a8 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 15 Aug 2008 04:09:42 +0000 Subject: new branches --- VS-Sim-Javadoc/core/VSAbstractProcess.html | 1979 ++++++++++++++++++++++++++++ 1 file changed, 1979 insertions(+) create mode 100644 VS-Sim-Javadoc/core/VSAbstractProcess.html (limited to 'VS-Sim-Javadoc/core/VSAbstractProcess.html') diff --git a/VS-Sim-Javadoc/core/VSAbstractProcess.html b/VS-Sim-Javadoc/core/VSAbstractProcess.html new file mode 100644 index 0000000..992fa60 --- /dev/null +++ b/VS-Sim-Javadoc/core/VSAbstractProcess.html @@ -0,0 +1,1979 @@ + + + + + + +VSAbstractProcess + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +core +
+Class VSAbstractProcess

+
+java.lang.Object
+  extended by prefs.VSPrefs
+      extended by prefs.VSSerializablePrefs
+          extended by core.VSAbstractProcess
+
+
+
All Implemented Interfaces:
VSSerializable
+
+
+
Direct Known Subclasses:
VSInternalProcess
+
+
+
+
public abstract class VSAbstractProcess
extends VSSerializablePrefs
implements VSSerializable
+ + +

+The class VSAbstractProcess, an object of this class represents a process + of a simulator. +

+ +

+

+
Author:
+
Paul C. Buetow
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+protected  doubleclockOffset + +
+          The clock offset.
+protected  floatclockVariance + +
+          The clock variance.
+protected  java.awt.ColorcrashedColor + +
+          The color used if the process has crashed.
+protected  java.util.ArrayList<java.lang.Long>crashHistory + +
+          The crash history.
+protected  java.awt.ColorcurrentColor + +
+          The process' current color.
+protected static java.lang.String[]DEFAULT_COLOR_VALUE_KEYS + +
+          The Constant DEFAULT_COLOR_VALUE_KEYS.
+protected static java.lang.String[]DEFAULT_FLOAT_VALUE_KEYS + +
+          The Constant DEFAULT_FLOAT_VALUE_KEYS.
+protected static java.lang.String[]DEFAULT_INTEGER_VALUE_KEYS + +
+          The Constant DEFAULT_INTEGER_VALUE_KEYS.
+protected static java.lang.String[]DEFAULT_LONG_VALUE_KEYS + +
+          The Constant DEFAULT_LONG_VALUE_KEYS.
+protected static java.lang.String[]DEFAULT_STRING_VALUE_KEYS + +
+          The Constant DEFAULT_STRING_VALUE_KEYS.
+protected  longglobalTime + +
+          The global time.
+protected  booleanhasCrashed + +
+          The process has crashed.
+protected  booleanhasStarted + +
+          The process has started.
+protected  booleanisCrashed + +
+          The process is crashed.
+protected  booleanisHighlighted + +
+          The process is highlighted.
+protected  booleanisPaused + +
+          The process is paused.
+protected  longlamportTime + +
+          The lamport time.
+protected  java.util.ArrayList<VSLamportTime>lamportTimeHistory + +
+          The lamport time history.
+protected  longlocalTime + +
+          The local time.
+protected  VSLoggingloging + +
+          The loging object.
+protected  VSPrefsprefs + +
+          The simulator's default prefs.
+protected  intprocessID + +
+          The process id.
+protected  intprocessNum + +
+          The process num.
+protected  java.util.ArrayList<VSAbstractProtocol>protocolsToReset + +
+          The protocols to reset if the simulator is over or the reset + button has been pressed.
+protected  VSRandomrandom + +
+          The random generator of the process.
+protected  VSTaskrandomCrashTask + +
+          The random crash task.
+protected static longserialVersionUID + +
+          The data serialization id.
+protected  VSSimulatorVisualizationsimulatorVisualization + +
+          The simulator canvas.
+protected  VSPriorityQueue<VSTask>tasks + +
+          The tasks of the process.
+protected  booleantimeModified + +
+          The time has been modified in a task.
+protected  java.awt.ColortmpColor + +
+          A temp.
+protected  VSVectorTimevectorTime + +
+          The vector time.
+protected  java.util.ArrayList<VSVectorTime>vectorTimeHistory + +
+          The vector time history.
+ + + + + + + +
Fields inherited from class prefs.VSPrefs
BOOLEAN_PREFIX, COLOR_PREFIX, FLOAT_PREFIX, id, INTEGER_PREFIX, LONG_PREFIX, STRING_PREFIX, VECTOR_PREFIX
+  + + + + + + + + + + +
+Constructor Summary
VSAbstractProcess(VSPrefs prefs, + int processNum, + VSSimulatorVisualization simulatorVisualization, + VSLogging loging) + +
+          Instantiates a new process.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  voidaddClockOffset(long add) + +
+          Adds the clock offset.
+protected abstract  voidcreateRandomCrashTask_() + +
+           
+ voiddeserialize(VSSerialize serialize, + java.io.ObjectInputStream objectInputStream) + +
+          Deserializes
+ booleanequals(VSAbstractProcess process) + +
+          Equals.
+ voidfillWithDefaults() + +
+           
+protected  longgetARandomCrashTime() + +
+          Gets the a random crash time.
+ floatgetClockVariance() + +
+          Gets the clock variance.
+ java.lang.Long[]getCrashHistoryArray() + +
+          Gets the crash history array.
+ longgetGlobalTime() + +
+          Gets the global time.
+ longgetLamportTime() + +
+          Gets the lamport time.
+ VSTime[]getLamportTimeArray() + +
+          Gets the lamport time history as an array.
+ VSPrefsgetPrefs() + +
+          Gets the simulator's default prefs.
+ intgetProcessID() + +
+          Gets the process id.
+ intgetProcessNum() + +
+          Gets the process num.
+protected abstract  VSAbstractProtocolgetProtocolObject_(java.lang.String protocolClassname) + +
+           
+ intgetRandomPercentage() + +
+          Creates a random percentage 0..100 using the process' own pseudo + random number generator object of the VSRandom class.
+ longgetTime() + +
+          Gets the process' local time.
+ VSVectorTimegetVectorTime() + +
+          Gets the vector time.
+ VSTime[]getVectorTimeArray() + +
+          Gets the vector time history as an array.
+ booleanhasCrashed() + +
+          Checks if the process has crashed.
+ voidincreaseLamportTime() + +
+          Increases the process' lamport time.
+ voidincreaseVectorAndLamportTimeIfAll() + +
+          Increases the vector and the lamport time by 1 each if + sim.update.vectortime.all/sim.update.lamporttime.all are set + to true.
+ voidincreaseVectorTime() + +
+          Increases the vector time by 1.
+protected  voidinit(VSPrefs prefs, + int processNum, + VSSimulatorVisualization simulatorVisualization, + VSLogging loging) + +
+          Inits a the process.
+protected  voidinitTimeFormats() + +
+          Inits the time formats.
+ booleanisCrashed() + +
+          Checks if the process is crashed.
+ voidisCrashed(boolean isCrashed) + +
+          Sets if the process is crashed.
+ voidlog(java.lang.String message) + +
+          Logg a message to the loging area.
+protected  voidresetTimeFormats() + +
+          Reset time formats.
+ voidserialize(VSSerialize serialize, + java.io.ObjectOutputStream objectOutputStream) + +
+          Serializes
+ voidsetClockVariance(float clockVariance) + +
+          Sets the clock variance.
+protected  voidsetCurrentColor(java.awt.Color newColor) + +
+          Sets the current color.
+ voidsetLamportTime(long lamportTime) + +
+          Sets the lamport time.
+ voidsetProcessID(int processID) + +
+          Sets the process id.
+ voidsetTime(long time) + +
+          Sets the process' local time.
+ java.lang.StringtoString() + +
+           
+ java.lang.StringtoStringFull() + +
+          The extended string representation of the process object.
+protected abstract  voidupdateFromPrefs_() + +
+           
+ voidupdateLamportTime(long time) + +
+          Updates the process' lamport time.
+ voidupdateVectorTime(VSVectorTime vectorTimeUpdate) + +
+          Updates the vector time.
+ + + + + + + +
Methods inherited from class prefs.VSPrefs
clear, copyBooleans, copyColors, copyFloats, copyIntegers, copyLongs, copyStrings, deserialize_, getAllFullKeys, getBoolean, getBooleanKeySet, getBooleanObj, getColor, getColorKeySet, getDescription, getFloat, getFloatKeySet, getFloatObj, getID, getInteger, getIntegerKeySet, getIntegerObj, getLong, getLongKeySet, getLongObj, getObject, getRestriction, getString, getStringKeySet, getUnit, getVector, getVectorKeySet, initBoolean, initBoolean, initBoolean, initColor, initColor, initDescription, initFloat, initFloat, initFloat, initFloat, initInteger, initInteger, initInteger, initInteger, initInteger, initInteger, initLong, initLong, initLong, initLong, initRestriction, initString, initString, initUnit, initVector, initVector, initVector, isEmpty, objectExists, removeObject, serialize_, setBoolean, setBoolean, setColor, setFloat, setFloat, setInteger, setInteger, setLong, setLong, setObject, setString, setVector
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+serialVersionUID

+
+protected static final long serialVersionUID
+
+
The data serialization id. +

+

+
See Also:
Constant Field Values
+
+
+ +

+protocolsToReset

+
+protected java.util.ArrayList<VSAbstractProtocol> protocolsToReset
+
+
The protocols to reset if the simulator is over or the reset + button has been pressed. +

+

+
+
+
+ +

+crashHistory

+
+protected java.util.ArrayList<java.lang.Long> crashHistory
+
+
The crash history. represents all crashes of the process using the + global simulator time. +

+

+
+
+
+ +

+lamportTimeHistory

+
+protected java.util.ArrayList<VSLamportTime> lamportTimeHistory
+
+
The lamport time history. +

+

+
+
+
+ +

+vectorTimeHistory

+
+protected java.util.ArrayList<VSVectorTime> vectorTimeHistory
+
+
The vector time history. +

+

+
+
+
+ +

+crashedColor

+
+protected java.awt.Color crashedColor
+
+
The color used if the process has crashed. +

+

+
+
+
+ +

+currentColor

+
+protected java.awt.Color currentColor
+
+
The process' current color. +

+

+
+
+
+ +

+tmpColor

+
+protected java.awt.Color tmpColor
+
+
A temp. color. For internal usage. +

+

+
+
+
+ +

+loging

+
+protected VSLogging loging
+
+
The loging object. +

+

+
+
+
+ +

+prefs

+
+protected VSPrefs prefs
+
+
The simulator's default prefs. +

+

+
+
+
+ +

+random

+
+protected VSRandom random
+
+
The random generator of the process. +

+

+
+
+
+ +

+simulatorVisualization

+
+protected VSSimulatorVisualization simulatorVisualization
+
+
The simulator canvas. +

+

+
+
+
+ +

+randomCrashTask

+
+protected VSTask randomCrashTask
+
+
The random crash task. May be null if there is no such random task. +

+

+
+
+
+ +

+vectorTime

+
+protected VSVectorTime vectorTime
+
+
The vector time. +

+

+
+
+
+ +

+tasks

+
+protected VSPriorityQueue<VSTask> tasks
+
+
The tasks of the process. DO ONLY MANIPULATE THIS OBJECT WITHIN THE + VSTaskManager CLASS! OTHERWISE THE SYNCHRONIZATION IS WRONG! Use the + VSAbstractProcess.getTasks() method to get a reference to this object + within the VSTaskManager! +

+

+
+
+
+ +

+hasCrashed

+
+protected boolean hasCrashed
+
+
The process has crashed. But may be working again. +

+

+
+
+
+ +

+hasStarted

+
+protected boolean hasStarted
+
+
The process has started. But may be paused or crashed.. +

+

+
+
+
+ +

+isCrashed

+
+protected boolean isCrashed
+
+
The process is crashed. +

+

+
+
+
+ +

+isHighlighted

+
+protected boolean isHighlighted
+
+
The process is highlighted. +

+

+
+
+
+ +

+isPaused

+
+protected boolean isPaused
+
+
The process is paused. +

+

+
+
+
+ +

+timeModified

+
+protected boolean timeModified
+
+
The time has been modified in a task. Needed by the task manager to + calculate correct offsets. +

+

+
+
+
+ +

+clockOffset

+
+protected double clockOffset
+
+
The clock offset. Used by the task manager and also by the process' + clock variance. +

+

+
+
+
+ +

+clockVariance

+
+protected float clockVariance
+
+
The clock variance. +

+

+
+
+
+ +

+processID

+
+protected int processID
+
+
The process id. +

+

+
+
+
+ +

+processNum

+
+protected int processNum
+
+
The process num. It is different to the process id. It represents the + array index of there the process is stored at. +

+

+
+
+
+ +

+globalTime

+
+protected long globalTime
+
+
The global time. +

+

+
+
+
+ +

+lamportTime

+
+protected long lamportTime
+
+
The lamport time. +

+

+
+
+
+ +

+localTime

+
+protected long localTime
+
+
The local time. +

+

+
+
+
+ +

+DEFAULT_INTEGER_VALUE_KEYS

+
+protected static final java.lang.String[] DEFAULT_INTEGER_VALUE_KEYS
+
+
The Constant DEFAULT_INTEGER_VALUE_KEYS. + This array contains all Integer prefs of the process which should show + up in the prefs menu! All keys which dont start with "sim." only show + up in the extended prefs menu! +

+

+
+
+
+ +

+DEFAULT_LONG_VALUE_KEYS

+
+protected static final java.lang.String[] DEFAULT_LONG_VALUE_KEYS
+
+
The Constant DEFAULT_LONG_VALUE_KEYS. + This array contains all Long prefs of the process which should show + up in the prefs menu! All keys which dont start with "sim." only show + up in the extended prefs menu! +

+

+
+
+
+ +

+DEFAULT_FLOAT_VALUE_KEYS

+
+protected static final java.lang.String[] DEFAULT_FLOAT_VALUE_KEYS
+
+
The Constant DEFAULT_FLOAT_VALUE_KEYS. + This array contains all Float prefs of the process which should show + up in the prefs menu! All keys which dont start with "sim." only show + up in the extended prefs menu! +

+

+
+
+
+ +

+DEFAULT_COLOR_VALUE_KEYS

+
+protected static final java.lang.String[] DEFAULT_COLOR_VALUE_KEYS
+
+
The Constant DEFAULT_COLOR_VALUE_KEYS. + This array contains all Color prefs of the process which should show + up in the prefs menu! All keys which dont start with "sim." only show + up in the extended prefs menu! +

+

+
+
+
+ +

+DEFAULT_STRING_VALUE_KEYS

+
+protected static final java.lang.String[] DEFAULT_STRING_VALUE_KEYS
+
+
The Constant DEFAULT_STRING_VALUE_KEYS. + This array contains all String prefs of the process which should show + up in the prefs menu! All keys which dont start with "sim." only show + up in the extended prefs menu! +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+VSAbstractProcess

+
+public VSAbstractProcess(VSPrefs prefs,
+                         int processNum,
+                         VSSimulatorVisualization simulatorVisualization,
+                         VSLogging loging)
+
+
Instantiates a new process. +

+

+
Parameters:
prefs - the simulator's default prefs
processNum - the process num
simulatorVisualization - the simulator canvas
loging - the loging object
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+protected void init(VSPrefs prefs,
+                    int processNum,
+                    VSSimulatorVisualization simulatorVisualization,
+                    VSLogging loging)
+
+
Inits a the process. +

+

+
+
+
+
Parameters:
prefs - the simulator's default prefs
processNum - the process num
simulatorVisualization - the simulator canvas
loging - the loging object
+
+
+
+ +

+initTimeFormats

+
+protected void initTimeFormats()
+
+
Inits the time formats. E.g. lamport and vector time stamps. +

+

+
+
+
+
+
+
+
+ +

+resetTimeFormats

+
+protected void resetTimeFormats()
+
+
Reset time formats. E.g. lamport and vector time stamps. +

+

+
+
+
+
+
+
+
+ +

+getRandomPercentage

+
+public int getRandomPercentage()
+
+
Creates a random percentage 0..100 using the process' own pseudo + random number generator object of the VSRandom class. +

+

+
+
+
+ +
Returns:
A random percentage 0..100.
+
+
+
+ +

+addClockOffset

+
+protected void addClockOffset(long add)
+
+
Adds the clock offset. This method is used by the task manager. The + clock offset identifies if the local time of the process has changed and + how much.. +

+

+
+
+
+
Parameters:
add - the clock offset to add.
+
+
+
+ +

+getProcessID

+
+public int getProcessID()
+
+
Gets the process id. +

+

+
+
+
+ +
Returns:
the process id
+
+
+
+ +

+getProcessNum

+
+public int getProcessNum()
+
+
Gets the process num. The num is different to the process id. It + represents the array index of there the process is stored at. +

+

+
+
+
+ +
Returns:
the process num
+
+
+
+ +

+setProcessID

+
+public void setProcessID(int processID)
+
+
Sets the process id. +

+

+
+
+
+
Parameters:
processID - the new process id
+
+
+
+ +

+getTime

+
+public long getTime()
+
+
Gets the process' local time. +

+

+
+
+
+ +
Returns:
the process' local time
+
+
+
+ +

+setTime

+
+public void setTime(long time)
+
+
Sets the process' local time. +

+

+
+
+
+
Parameters:
time - the new local time of the process.
+
+
+
+ +

+isCrashed

+
+public boolean isCrashed()
+
+
Checks if the process is crashed. +

+

+
+
+
+ +
Returns:
true, if is crashed
+
+
+
+ +

+isCrashed

+
+public void isCrashed(boolean isCrashed)
+
+
Sets if the process is crashed. +

+

+
+
+
+
Parameters:
isCrashed - true if the process is crashed.
+
+
+
+ +

+hasCrashed

+
+public boolean hasCrashed()
+
+
Checks if the process has crashed. The difference to isCrashed is, + that the process may be fully functional again after crashing. This + method is needed by the simulator canvas in order to see if it should + paint 'crashed areas' using the crash history of this process. +

+

+
+
+
+ +
Returns:
true, if yes
+
+
+
+ +

+getGlobalTime

+
+public long getGlobalTime()
+
+
Gets the global time. +

+

+
+
+
+ +
Returns:
the global time
+
+
+
+ +

+getClockVariance

+
+public float getClockVariance()
+
+
Gets the clock variance. +

+

+
+
+
+ +
Returns:
the clock variance
+
+
+
+ +

+setClockVariance

+
+public void setClockVariance(float clockVariance)
+
+
Sets the clock variance. +

+

+
+
+
+
Parameters:
clockVariance - the new clock variance
+
+
+
+ +

+getARandomCrashTime

+
+protected long getARandomCrashTime()
+
+
Gets the a random crash time. +

+

+
+
+
+ +
Returns:
the a random crash time. It will be -1 if the process will not + crash at all randomly!
+
+
+
+ +

+increaseLamportTime

+
+public void increaseLamportTime()
+
+
Increases the process' lamport time. +

+

+
+
+
+
+
+
+
+ +

+updateLamportTime

+
+public void updateLamportTime(long time)
+
+
Updates the process' lamport time. +

+

+
+
+
+
Parameters:
time - the lamport time to use as its update reference.
+
+
+
+ +

+getLamportTime

+
+public long getLamportTime()
+
+
Gets the lamport time. +

+

+
+
+
+ +
Returns:
the lamport time.
+
+
+
+ +

+setLamportTime

+
+public void setLamportTime(long lamportTime)
+
+
Sets the lamport time. +

+

+
+
+
+
Parameters:
lamportTime - the new lamport time
+
+
+
+ +

+getLamportTimeArray

+
+public VSTime[] getLamportTimeArray()
+
+
Gets the lamport time history as an array. +

+

+
+
+
+ +
Returns:
the lamport time history array
+
+
+
+ +

+increaseVectorAndLamportTimeIfAll

+
+public void increaseVectorAndLamportTimeIfAll()
+
+
Increases the vector and the lamport time by 1 each if + sim.update.vectortime.all/sim.update.lamporttime.all are set + to true. +

+

+
+
+
+
+
+
+
+ +

+increaseVectorTime

+
+public void increaseVectorTime()
+
+
Increases the vector time by 1. +

+

+
+
+
+
+
+
+
+ +

+updateVectorTime

+
+public void updateVectorTime(VSVectorTime vectorTimeUpdate)
+
+
Updates the vector time. +

+

+
+
+
+
Parameters:
vectorTimeUpdate - the vector time of the other process to use for + the update
+
+
+
+ +

+getVectorTime

+
+public VSVectorTime getVectorTime()
+
+
Gets the vector time. +

+

+
+
+
+ +
Returns:
the vector time
+
+
+
+ +

+getVectorTimeArray

+
+public VSTime[] getVectorTimeArray()
+
+
Gets the vector time history as an array. +

+

+
+
+
+ +
Returns:
the vector time history array
+
+
+
+ +

+getCrashHistoryArray

+
+public java.lang.Long[] getCrashHistoryArray()
+
+
Gets the crash history array. +

+

+
+
+
+ +
Returns:
the crash history array
+
+
+
+ +

+log<