|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamguardMVC.PamProcess
public abstract class PamProcess
PamProcess is an abstract class used as a supertype for the creation of processes which either convert one type of PamData into a new type or add existing information to already existing data
All PamProcesses are Listeners and implement the Observer Class from java.util
The first PamProcess to be created will often be something which generates raw data (either by reading an input device or by reading chunks of data from a file).
Each PamProcess will require a source of data, which apart from the top level processes which acquire data, will be a PamDataBlock. The PamProcess will generally subscribe to the PamDataBlock so that it is notified of any changes (i.e. new data) being added to that block.
The PamController ...
| Field Summary | |
|---|---|
protected ArrayList<PamDataBlock> |
outputDataBlocks
|
protected String |
processName
|
protected float |
sampleRate
|
| Constructor Summary | |
|---|---|
PamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock)
|
|
PamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock,
String processName)
|
|
| Method Summary | |
|---|---|
long |
absMillisecondsToSamples(long millis)
Convert a time in milli seconds to a number of samples. |
long |
absSamplesToMilliseconds(long samples)
Convert am ADC sample number to a millisecond time. |
void |
addOutputDataBlock(PamDataBlock outputDataBlock)
Adds an additional PamDataBlock to the process |
void |
changedThreading()
Function that gets called in every process (or all processes that are listed in PamControlledUnits) and re-sets up the data source using the correct threading model. |
void |
clearOldData()
Clears all data from all output data blocks of this process |
void |
destroyProcess()
Called from the PamControlled unit when a PamControlled unit is removed from the model. |
PamDataBlock |
getAncestorDataBlock(Class unitDataType)
Useful function to go back through the chain of data blocks and data units upstream of this process and look for a data block which has a particular data type. |
int |
getChainPosition()
|
double |
getCpuPercent()
|
int |
getNumOutputDataBlocks()
|
String |
getObserverName()
|
PamDataBlock |
getOutputDataBlock(int block)
Each process may produce multiple data blocks. |
PamControlledUnit |
getPamControlledUnit()
|
PamDataBlock |
getParentDataBlock()
|
PamProcess |
getParentProcess()
|
String |
getProcessName()
|
PamRawDataBlock |
getRawSourceDataBlock(float sampleRate)
Find the absolute source of raw audio data if one exists |
long |
getRequiredDataHistory(PamObservable o,
Object arg)
|
float |
getSampleRate()
|
PamDataBlock<PamDataUnit> |
getSourceDataBlock()
find the absolute source of data, if one exists. |
PamProcess |
getSourceProcess()
|
void |
makePamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock,
String processName)
|
void |
masterClockUpdate(long timeMilliseconds,
long sampleNumber)
|
void |
newData(PamObservable o,
PamDataUnit arg)
|
void |
noteNewSettings()
|
abstract void |
pamStart()
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway. |
abstract void |
pamStop()
Stops the process. |
void |
prepareProcess()
Called for each process before any of them receive the PamStart command |
long |
relMillisecondsToSamples(double millis)
Convert a number of milliseconds to a number of samples. |
long |
relSamplesToMilliseconds(long samples)
Convert a number of samples into a number of milliseconds |
void |
removeObservable(PamObservable observable)
Called when a PamDataBlock observed by this PamProcess is removed. |
void |
removeOutputDatablock(PamDataBlock outputDataBlock)
|
void |
setParentDataBlock(PamDataBlock newParentDataBlock)
|
void |
setProcessName(String processName)
|
void |
setSampleRate(float sampleRate,
boolean notify)
New sample rate |
void |
setupProcess()
called for every process once the systemmodel has been created. |
String |
toString()
|
void |
update(PamObservable o,
PamDataUnit arg)
Informs the PamObserver that new data have been added to the Observable class |
void |
updateData(PamObservable o,
PamDataUnit arg)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<PamDataBlock> outputDataBlocks
protected String processName
protected float sampleRate
| Constructor Detail |
|---|
public PamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock)
pamControlledUnit - Reference to the PamControlledUnit containing this process
(PamProcesses can only exist within PamControlledUnits, but a
PamControlledUnit can contain multiple PamProcesses)parentDataBlock - Source data block for this process (can be null for raw data
input devices)
public PamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock,
String processName)
| Method Detail |
|---|
public void destroyProcess()
public void makePamProcess(PamControlledUnit pamControlledUnit,
PamDataBlock parentDataBlock,
String processName)
public PamDataBlock getParentDataBlock()
public PamProcess getParentProcess()
public PamDataBlock getAncestorDataBlock(Class unitDataType)
unitDataType - class type of data in the sought after
data block (e.g. RawDataUnit.class
PamDataBlockpublic void setParentDataBlock(PamDataBlock newParentDataBlock)
newParentDataBlock - The parentDataBlock to set.public void changedThreading()
public void setProcessName(String processName)
processName - Sets the name of the processpublic String getProcessName()
public String getObserverName()
getObserverName in interface PamObserver
public void setSampleRate(float sampleRate,
boolean notify)
PamObserver
setSampleRate in interface PamObservernotify - Notify other PamObservers and PamObservables in the chain.
public void masterClockUpdate(long timeMilliseconds,
long sampleNumber)
masterClockUpdate in interface PamObserverpublic long relSamplesToMilliseconds(long samples)
samples - Number of ADC samples
public long absSamplesToMilliseconds(long samples)
samples - sample number (from start of run)
public long absMillisecondsToSamples(long millis)
millis - Current time in milliseconds
(UTC millseconds from the epoch - the standard Java way)
relMillisecondsToSamples(double)public long relMillisecondsToSamples(double millis)
millis - number of milliseconds
absMillisecondsToSamples(long)public void noteNewSettings()
noteNewSettings in interface PamObserverpublic float getSampleRate()
public PamProcess getSourceProcess()
public PamDataBlock<PamDataUnit> getSourceDataBlock()
If this is called from within acquisition, it will return null
It there is no raw data source, i.e. if the type is not PamRawDataBlock, then return null.
public PamRawDataBlock getRawSourceDataBlock(float sampleRate)
public int getChainPosition()
public PamDataBlock getOutputDataBlock(int block)
block - Index of the required block
public int getNumOutputDataBlocks()
public void addOutputDataBlock(PamDataBlock outputDataBlock)
outputDataBlock - Reference to a PamDataBlockpublic void removeOutputDatablock(PamDataBlock outputDataBlock)
public String toString()
toString in class Objectpublic void clearOldData()
public void prepareProcess()
public long getRequiredDataHistory(PamObservable o,
Object arg)
getRequiredDataHistory in interface PamObservero - PamObservable class requiring the dataarg - optional argument from PamObservable
public final void update(PamObservable o,
PamDataUnit arg)
PamObserver
update in interface PamObservero - Reference to the Observable (a PamDataBlock)arg - Reference to the new PamDataUnit
public void newData(PamObservable o,
PamDataUnit arg)
public void updateData(PamObservable o,
PamDataUnit arg)
public void setupProcess()
public double getCpuPercent()
public abstract void pamStart()
public abstract void pamStop()
public void removeObservable(PamObservable observable)
removeObservable in interface PamObserverpublic PamControlledUnit getPamControlledUnit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||