public abstract class TestSignalRecorder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TestSignalRecorder.Empty
With this class a member of
TestSignalRecorderSet can be built
which produces a separation line. |
static class |
TestSignalRecorder.Time |
Modifier and Type | Field and Description |
---|---|
static int |
lenClean
The length of the title of a line, after clean.
|
protected java.lang.String |
moduleName
Registered module name to build the line title.
|
protected int |
pos |
private java.util.List<java.lang.StringBuilder> |
sbs |
Constructor and Description |
---|
TestSignalRecorder(java.lang.String moduleName)
Each module with several output lines need an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
int |
addSignals(int time)
Simple for with bAdd = true, see
#addSignals(int, boolean) |
abstract int |
addSignals(int time,
int lenCurr,
boolean bAdd)
This operation should be implemented to add the necessary signals to all existing lines
which are created or cleaned in the overridden
clean() and registered with registerLine(StringBuilder, String) . |
protected static boolean |
checkLen(java.lang.StringBuilder sb,
int zTime)
This operation can be used to decide whether the StringBuilder has place for a new longer information,
for example a bus value (hexa).
|
void |
clean()
This operation should be overridden in a kind that all buffers should be created and reseted
using the
registerLine(StringBuilder, String) operation. |
protected void |
endSignals(int pos)
This operation fills all registered StringBuilder to the same length.
|
java.lang.StringBuilder |
getLine(java.lang.String id) |
void |
output(java.lang.Appendable out)
This operation outputs all lines.
|
protected void |
registerLine(java.lang.StringBuilder ob,
java.lang.String signaleName)
Helper operation to resets one line.
|
abstract void |
registerLines() |
public static int lenClean
protected final java.lang.String moduleName
protected int pos
private java.util.List<java.lang.StringBuilder> sbs
public TestSignalRecorder(java.lang.String moduleName)
moduleName
- as start for the line.protected void registerLine(java.lang.StringBuilder ob, java.lang.String signaleName)
ob
- any of the output buffersignaleName
- the signal name on start of line will be combinded with the module name of the constructor.public final void clean()
registerLine(StringBuilder, String)
operation.
Example/Template: public abstract void registerLines()
public abstract int addSignals(int time, int lenCurr, boolean bAdd) throws java.io.IOException
clean()
and registered with registerLine(StringBuilder, String)
.
Usage example/pattern:(at)Override public int addSignals ( int time, boolean bAdd ) throws IOException { BlinkingLedCt mdl = BlinkingLedCt.this; int zCurr = this.sbCt.length(); // current length for this time int zAdd = 0; // >0 then position of new length for this time if(mdl.ref.clkDiv.q.ce) { // because the own states switches only with this ce, the signals should also recorded only then. if(mdl.q.ctLow == 1) { // on this condition this.wrCt = 5; // switch on, write 5 steps info } if(--this.wrCt >0) { // if one of the 5 infos shouls be written: StringFunctions_C.appendHex(this.sbCtLow, mdl.q.ctLow,4).append(' '); //append info StringFunctions_C.appendHex(this.sbCt, mdl.q.ct,2); //append info if(checkLen(this.sbtime, zCurr)) { // add the time information if here is space. StringFunctions_C.appendIntPict(this.sbtime, time, "33'331.111.11"); // append time info } zAdd = this.sbCtLow.length(); //length of buffers for new time determined by the sbCtLow, the longest entry. } else if(this.wrCt ==0) { // end of the 5 steps, append .... as separation this.sbCtLow.append("..... "); zAdd = this.sbCtLow.length(); //length of buffers for new time determined by the sbCtLow, the longest entry. } }// if ce return zAdd; // will be used in TestSignalRecorderSet.addSignals(zAdd) to set all lines to this length }//addSignalsHere signals are only added if the ce of the other module is set. Elsewhere the operation returns 0. This is sensible because signals either changes only with this ce, or they are interesting only in ce steps.
time
- the system time may be used for outputlenCurr
- the current length of the StringBuilder lines before adding for this timestamp.
This parameter can be used for checkLen(StringBuilder, int)
.bAdd
- true then other TestSignalsRecorders have added an information in this step time before.
This information can be used to decide whether to add.
But it depends on the order of registering in TestSignalRecorderSet.registerRecorder(TestSignalRecorder)
.
If you want to use this function, this test generator is subordinate, it accepts the behavior of the recorders before
delivered in the return value of this operation.
If the return value of all called before addSignals(...) operation is 0, then this value is false
on usage of TestSignalRecorderSet.addSignals(int)
.java.io.IOException
public final int addSignals(int time) throws java.io.IOException
#addSignals(int, boolean)
java.io.IOException
protected void endSignals(int pos) throws java.io.IOException
TestSignalRecorderSet.addSignals(int)
.java.io.IOException
protected static boolean checkLen(java.lang.StringBuilder sb, int zTime)
#addSignals(int, boolean)
sb
- the StringBuilder should be used for appendzTime
- The length of relevant other StringBuilder lines for this time step.
It is the length before writing an information to the other StringBuilder in this step time,
not the position after writing as used for endSignals(int)
.
It means it should be gathered first before fill any other buffer, see example on #addSignals(int, boolean)
.
If the sb.length()
of this StringBuilder is lesser,
then firstly the content is padded with spaces to ensure the same position as given for zTime.
But this is also done if endSignals(int)
was called also for this buffer.public void output(java.lang.Appendable out) throws java.io.IOException
out
- java.io.IOException
public java.lang.StringBuilder getLine(java.lang.String id)