Classify streams and generators consistently across database loaders
This commit is contained in:
1 parent
591fe2c4c7
commit
6668151a53
19 files changed
+149
-81
No files matched your search
+6
-6
@@ -243,13 +243,13 @@ public class FtrDbLoader implements IWaveformDbLoader {
|
|||||||
FtrTx scvTx = new FtrTx(txId, stream.getId(), genId, startTime, endTime, blockId, blockOffset);
|
FtrTx scvTx = new FtrTx(txId, stream.getId(), genId, startTime, endTime, blockId, blockOffset);
|
||||||
updateTransactions(txId, scvTx);
|
updateTransactions(txId, scvTx);
|
||||||
if (scvTx.beginTime == scvTx.endTime) {
|
if (scvTx.beginTime == scvTx.endTime) {
|
||||||
stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime));
|
stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime));
|
gen.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime, gen.getType()));
|
||||||
} else {
|
} else {
|
||||||
stream.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime));
|
stream.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime));
|
gen.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime, gen.getType()));
|
||||||
stream.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime));
|
stream.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime));
|
gen.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime, gen.getType()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: { // skip over 7:begin attr, 8:record attr, 9:end attr
|
default: { // skip over 7:begin attr, 8:record attr, 9:end attr
|
||||||
|
|||||||
+6
-12
@@ -26,6 +26,8 @@ class TxEvent implements ITxEvent {
|
|||||||
/** The kind. */
|
/** The kind. */
|
||||||
final EventKind kind;
|
final EventKind kind;
|
||||||
|
|
||||||
|
private final WaveformType waveformType;
|
||||||
|
|
||||||
/** The transaction. */
|
/** The transaction. */
|
||||||
final long transaction;
|
final long transaction;
|
||||||
|
|
||||||
@@ -40,12 +42,14 @@ class TxEvent implements ITxEvent {
|
|||||||
* @param kind the kind
|
* @param kind the kind
|
||||||
* @param transaction the transaction
|
* @param transaction the transaction
|
||||||
* @param time the time
|
* @param time the time
|
||||||
|
* @param waveformType the type of the owning waveform
|
||||||
*/
|
*/
|
||||||
TxEvent(FtrDbLoader loader, EventKind kind, Long transaction, Long time) {
|
TxEvent(FtrDbLoader loader, EventKind kind, Long transaction, Long time, WaveformType waveformType) {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
this.waveformType = waveformType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +60,7 @@ class TxEvent implements ITxEvent {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ITxEvent duplicate() throws CloneNotSupportedException {
|
public ITxEvent duplicate() throws CloneNotSupportedException {
|
||||||
return new TxEvent(loader, kind, transaction, time);
|
return new TxEvent(loader, kind, transaction, time, waveformType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,16 +73,6 @@ class TxEvent implements ITxEvent {
|
|||||||
return kind.toString() + "@" + time + " of tx #" + transaction;
|
return kind.toString() + "@" + time + " of tx #" + transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type.
|
|
||||||
*
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.STREAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the kind.
|
* Gets the kind.
|
||||||
*
|
*
|
||||||
|
|||||||
+6
@@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
import com.minres.scviewer.database.DirectionType;
|
import com.minres.scviewer.database.DirectionType;
|
||||||
import com.minres.scviewer.database.IEventList;
|
import com.minres.scviewer.database.IEventList;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TxGenerator.
|
* The Class TxGenerator.
|
||||||
@@ -45,6 +46,11 @@ class TxGenerator extends AbstractTxStream {
|
|||||||
stream.addChild(this);
|
stream.addChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WaveformType getType() {
|
||||||
|
return WaveformType.GENERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is same.
|
* Checks if is same.
|
||||||
*
|
*
|
||||||
|
|||||||
-5
@@ -57,11 +57,6 @@ public class TxEvent implements ITxEvent {
|
|||||||
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.STREAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRowIndex() {
|
public int getRowIndex() {
|
||||||
return inGenerator ? tx.getConcurrencyIdxInGen() : tx.getConcurrencyIndxInStream();
|
return inGenerator ? tx.getConcurrencyIdxInGen() : tx.getConcurrencyIndxInStream();
|
||||||
|
|||||||
+6
@@ -18,6 +18,7 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import com.minres.scviewer.database.DirectionType;
|
import com.minres.scviewer.database.DirectionType;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
@@ -39,6 +40,11 @@ public class TxGenerator extends AbstractTxStream {
|
|||||||
stream.addChild(this);
|
stream.addChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WaveformType getType() {
|
||||||
|
return WaveformType.GENERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return (long) scvGenerator.getId();
|
return (long) scvGenerator.getId();
|
||||||
|
|||||||
+6
-6
@@ -421,13 +421,13 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||||||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||||
if (scvTx.beginTime == scvTx.endTime) {
|
if (scvTx.beginTime == scvTx.endTime) {
|
||||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime, gen.getType()));
|
||||||
} else {
|
} else {
|
||||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime, gen.getType()));
|
||||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime, stream.getType()));
|
||||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime, gen.getType()));
|
||||||
}
|
}
|
||||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|||||||
+6
-12
@@ -26,6 +26,8 @@ class TxEvent implements ITxEvent {
|
|||||||
/** The kind. */
|
/** The kind. */
|
||||||
final EventKind kind;
|
final EventKind kind;
|
||||||
|
|
||||||
|
private final WaveformType waveformType;
|
||||||
|
|
||||||
/** The transaction. */
|
/** The transaction. */
|
||||||
final long transaction;
|
final long transaction;
|
||||||
|
|
||||||
@@ -40,12 +42,14 @@ class TxEvent implements ITxEvent {
|
|||||||
* @param kind the kind
|
* @param kind the kind
|
||||||
* @param transaction the transaction
|
* @param transaction the transaction
|
||||||
* @param time the time
|
* @param time the time
|
||||||
|
* @param waveformType the type of the owning waveform
|
||||||
*/
|
*/
|
||||||
TxEvent(TextDbLoader loader, EventKind kind, Long transaction, Long time) {
|
TxEvent(TextDbLoader loader, EventKind kind, Long transaction, Long time, WaveformType waveformType) {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
this.waveformType = waveformType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +60,7 @@ class TxEvent implements ITxEvent {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ITxEvent duplicate() throws CloneNotSupportedException {
|
public ITxEvent duplicate() throws CloneNotSupportedException {
|
||||||
return new TxEvent(loader, kind, transaction, time);
|
return new TxEvent(loader, kind, transaction, time, waveformType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,16 +73,6 @@ class TxEvent implements ITxEvent {
|
|||||||
return kind.toString() + "@" + time + " of tx #" + transaction;
|
return kind.toString() + "@" + time + " of tx #" + transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type.
|
|
||||||
*
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.STREAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the kind.
|
* Gets the kind.
|
||||||
*
|
*
|
||||||
|
|||||||
+6
@@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.minres.scviewer.database.DirectionType;
|
import com.minres.scviewer.database.DirectionType;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TxGenerator.
|
* The Class TxGenerator.
|
||||||
@@ -45,6 +46,11 @@ class TxGenerator extends AbstractTxStream {
|
|||||||
stream.addChild(this);
|
stream.addChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WaveformType getType() {
|
||||||
|
return WaveformType.GENERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is same.
|
* Checks if is same.
|
||||||
*
|
*
|
||||||
|
|||||||
+5
-5
@@ -633,7 +633,7 @@ public class WaveformView implements IWaveformView {
|
|||||||
private void addPainter(boolean even, TrackEntry streamEntry) {
|
private void addPainter(boolean even, TrackEntry streamEntry) {
|
||||||
streamEntry.height = styleProvider.getTrackHeight();
|
streamEntry.height = styleProvider.getTrackHeight();
|
||||||
streamEntry.vOffset = tracksVerticalHeight;
|
streamEntry.vOffset = tracksVerticalHeight;
|
||||||
if (streamEntry.waveform.getType() == WaveformType.STREAM) {
|
if (streamEntry.waveform.getType().isTransaction()) {
|
||||||
streamEntry.currentValue = "";
|
streamEntry.currentValue = "";
|
||||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||||
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
@@ -690,7 +690,7 @@ public class WaveformView implements IWaveformView {
|
|||||||
else
|
else
|
||||||
entry.currentValue = Double.toString(val);
|
entry.currentValue = Double.toString(val);
|
||||||
}
|
}
|
||||||
} else if (entry.waveform.getType() == WaveformType.STREAM) {
|
} else if (entry.waveform.getType().isTransaction()) {
|
||||||
ITx[] resultsList = new ITx[entry.waveform.getRowCount()];
|
ITx[] resultsList = new ITx[entry.waveform.getRowCount()];
|
||||||
EventEntry firstTx = entry.waveform.getEvents().floorEntry(time);
|
EventEntry firstTx = entry.waveform.getEvents().floorEntry(time);
|
||||||
if (firstTx != null) {
|
if (firstTx != null) {
|
||||||
@@ -956,7 +956,7 @@ public class WaveformView implements IWaveformView {
|
|||||||
return;
|
return;
|
||||||
TrackEntry selectedWaveform = currentWaveformSelection.size() == 1 ? currentWaveformSelection.get(0)
|
TrackEntry selectedWaveform = currentWaveformSelection.size() == 1 ? currentWaveformSelection.get(0)
|
||||||
: getEntryFor(currentTxSelection);
|
: getEntryFor(currentTxSelection);
|
||||||
if (selectedWaveform.waveform.getType() == WaveformType.STREAM && currentTxSelection != null) {
|
if (selectedWaveform.waveform.getType().isTransaction() && currentTxSelection != null) {
|
||||||
if (relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)) {
|
if (relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)) {
|
||||||
ITx transaction = null;
|
ITx transaction = null;
|
||||||
if (direction == GotoDirection.NEXT) {
|
if (direction == GotoDirection.NEXT) {
|
||||||
@@ -1078,7 +1078,7 @@ public class WaveformView implements IWaveformView {
|
|||||||
TrackEntry sel = currentWaveformSelection.get(0);
|
TrackEntry sel = currentWaveformSelection.get(0);
|
||||||
long time = getCursorTime();
|
long time = getCursorTime();
|
||||||
IEventList map = null;
|
IEventList map = null;
|
||||||
if (sel.waveform.getType() == WaveformType.STREAM || sel.waveform.getType() == WaveformType.SIGNAL) {
|
if (sel.waveform.getType().isTransaction() || sel.waveform.getType() == WaveformType.SIGNAL) {
|
||||||
map = sel.waveform.getEvents();
|
map = sel.waveform.getEvents();
|
||||||
}
|
}
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
@@ -1634,7 +1634,7 @@ public class WaveformView implements IWaveformView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean waveformsContainsTx() {
|
public boolean waveformsContainsTx() {
|
||||||
return streams.stream().filter(e -> e.waveform.getType() == WaveformType.STREAM).findFirst().isPresent();
|
return streams.stream().filter(e -> e.waveform.getType().isTransaction()).findFirst().isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -238,16 +238,6 @@ public class BitVector implements IEvent {
|
|||||||
return EventKind.SINGLE;
|
return EventKind.SINGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type.
|
|
||||||
*
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.SIGNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate.
|
* Duplicate.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,16 +37,6 @@ public class DoubleVal implements IEvent {
|
|||||||
return EventKind.SINGLE;
|
return EventKind.SINGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type.
|
|
||||||
*
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.SIGNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate.
|
* Duplicate.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,11 +30,4 @@ public interface IEvent {
|
|||||||
*/
|
*/
|
||||||
public EventKind getKind();
|
public EventKind getKind();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type.
|
|
||||||
*
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
public WaveformType getType();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+7
-2
@@ -19,10 +19,15 @@ public enum WaveformType {
|
|||||||
SIGNAL,
|
SIGNAL,
|
||||||
/** The transaction stream. */
|
/** The transaction stream. */
|
||||||
STREAM,
|
STREAM,
|
||||||
/** The transaction stream. */
|
/** The transaction generator. */
|
||||||
GENERATOR,
|
GENERATOR,
|
||||||
/** The filter. */
|
/** The filter. */
|
||||||
FILTER,
|
FILTER,
|
||||||
/** The blank line. */
|
/** The blank line. */
|
||||||
EMPTY
|
EMPTY;
|
||||||
|
|
||||||
|
/** Whether this waveform contains transactions, in a stream or a generator. */
|
||||||
|
public boolean isTransaction() {
|
||||||
|
return this == STREAM || this == GENERATOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -17,7 +17,6 @@ import org.eclipse.jface.viewers.ISelection;
|
|||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.minres.scviewer.database.WaveformType;
|
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
public class SearchHandler {
|
public class SearchHandler {
|
||||||
@@ -32,7 +31,7 @@ public class SearchHandler {
|
|||||||
Object[] elem = ((StructuredSelection)sel).toArray();
|
Object[] elem = ((StructuredSelection)sel).toArray();
|
||||||
if(elem.length ==0) return false;
|
if(elem.length ==0) return false;
|
||||||
TrackEntry e = findTrackEntry(elem);
|
TrackEntry e = findTrackEntry(elem);
|
||||||
return e!=null && e.waveform.getType()==WaveformType.STREAM;
|
return e!=null && e.waveform.getType().isTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+1
-2
@@ -35,7 +35,6 @@ import com.minres.scviewer.database.DataType;
|
|||||||
import com.minres.scviewer.database.EventEntry;
|
import com.minres.scviewer.database.EventEntry;
|
||||||
import com.minres.scviewer.database.EventKind;
|
import com.minres.scviewer.database.EventKind;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.WaveformType;
|
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
import com.minres.scviewer.database.tx.ITx;
|
||||||
import com.minres.scviewer.database.tx.ITxEvent;
|
import com.minres.scviewer.database.tx.ITxEvent;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
@@ -237,7 +236,7 @@ public class TransactionList extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setInput(TrackEntry trackEntry) {
|
public void setInput(TrackEntry trackEntry) {
|
||||||
if(trackEntry==null || trackEntry.waveform.getType()!=WaveformType.STREAM) {
|
if(trackEntry==null || !trackEntry.waveform.getType().isTransaction()) {
|
||||||
attrNames.clear();
|
attrNames.clear();
|
||||||
tableViewer.setInput(emptyList);
|
tableViewer.setInput(emptyList);
|
||||||
} else if(stream != trackEntry.waveform) {
|
} else if(stream != trackEntry.waveform) {
|
||||||
|
|||||||
+2
-2
@@ -1030,13 +1030,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.STREAM).findFirst().isPresent());
|
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType().isTransaction()).findFirst().isPresent());
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSelectedStreamsFromList() {
|
public void removeSelectedStreamsFromList() {
|
||||||
waveformPane.deleteSelectedTracks();
|
waveformPane.deleteSelectedTracks();
|
||||||
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.STREAM).findFirst().isPresent());
|
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType().isTransaction()).findFirst().isPresent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -177,6 +177,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||||||
}else if(element instanceof IWaveform){
|
}else if(element instanceof IWaveform){
|
||||||
switch(((IWaveform) element).getType()) {
|
switch(((IWaveform) element).getType()) {
|
||||||
case STREAM:
|
case STREAM:
|
||||||
|
case GENERATOR:
|
||||||
return stream;
|
return stream;
|
||||||
case FILTER:
|
case FILTER:
|
||||||
break;
|
break;
|
||||||
|
|||||||
+1
@@ -63,6 +63,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||||||
}else if(element instanceof IWaveform){
|
}else if(element instanceof IWaveform){
|
||||||
switch(((IWaveform) element).getType()) {
|
switch(((IWaveform) element).getType()) {
|
||||||
case STREAM:
|
case STREAM:
|
||||||
|
case GENERATOR:
|
||||||
return stream;
|
return stream;
|
||||||
case FILTER:
|
case FILTER:
|
||||||
break;
|
break;
|
||||||
|
|||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
package com.minres.scviewer.database.test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.EventEntry;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
import com.minres.scviewer.database.ftr.FtrDbLoader;
|
||||||
|
import com.minres.scviewer.database.sqlite.SQLiteDbLoader;
|
||||||
|
import com.minres.scviewer.database.sqlite.TxStream;
|
||||||
|
import com.minres.scviewer.database.text.TextDbLoader;
|
||||||
|
|
||||||
|
public class WaveformTypeTest {
|
||||||
|
private void checkWaveform(IWaveform waveform, WaveformType expected) throws Exception {
|
||||||
|
assertEquals(expected, waveform.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void transactionTypesIncludeStreamsAndGenerators() {
|
||||||
|
for (WaveformType type : WaveformType.values())
|
||||||
|
assertEquals(type == WaveformType.STREAM || type == WaveformType.GENERATOR, type.isTransaction());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void ftrAndTextClassifyWaveformsBeforePublishingThem() throws Exception {
|
||||||
|
for (String input : new String[] {"my_db.ftr", "my_db_c.ftr", "my_db.txlog", "my_db_truncated.txlog"}) {
|
||||||
|
IWaveformDbLoader loader = input.endsWith("txlog") ? new TextDbLoader() : new FtrDbLoader();
|
||||||
|
List<PropertyChangeEvent> published = new ArrayList<>();
|
||||||
|
loader.addPropertyChangeListener(event -> {
|
||||||
|
if (IWaveformDbLoader.STREAM_ADDED.equals(event.getPropertyName())
|
||||||
|
|| IWaveformDbLoader.GENERATOR_ADDED.equals(event.getPropertyName())) {
|
||||||
|
WaveformType expected = IWaveformDbLoader.STREAM_ADDED.equals(event.getPropertyName())
|
||||||
|
? WaveformType.STREAM : WaveformType.GENERATOR;
|
||||||
|
assertEquals(expected, ((IWaveform) event.getNewValue()).getType());
|
||||||
|
published.add(event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
loader.load(TxTestSupport.input(input));
|
||||||
|
assertEquals(8, published.size());
|
||||||
|
for (IWaveform waveform : loader.getAllWaves())
|
||||||
|
checkWaveform(waveform, waveform.getParent() instanceof IWaveform
|
||||||
|
? WaveformType.GENERATOR : WaveformType.STREAM);
|
||||||
|
} finally { loader.dispose(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sqliteClassifiesStreamsAndLazilyLoadedGenerators() throws Exception {
|
||||||
|
SQLiteDbLoader loader = new SQLiteDbLoader();
|
||||||
|
try {
|
||||||
|
loader.load(TxTestSupport.input("my_sqldb.txdb"));
|
||||||
|
int streams = 0, generators = 0;
|
||||||
|
for (IWaveform stream : loader.getAllWaves()) {
|
||||||
|
streams++;
|
||||||
|
assertEquals(WaveformType.STREAM, stream.getType());
|
||||||
|
for (IWaveform generator : ((TxStream) stream).getGenerators()) {
|
||||||
|
generators++;
|
||||||
|
checkWaveform(generator, WaveformType.GENERATOR);
|
||||||
|
}
|
||||||
|
checkWaveform(stream, WaveformType.STREAM);
|
||||||
|
}
|
||||||
|
assertEquals(3, streams);
|
||||||
|
assertEquals(5, generators);
|
||||||
|
} finally { loader.dispose(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void vcdAndFstStillClassifySignalsCorrectly() throws Exception {
|
||||||
|
for (String input : new String[] {"my_db.vcd", "my_db.fst"}) {
|
||||||
|
IWaveformDb database = TestWaveformDbFactory.getDatabase();
|
||||||
|
try {
|
||||||
|
assertTrue(database.load(TxTestSupport.input(input)));
|
||||||
|
assertEquals(14, database.getAllWaves().size());
|
||||||
|
for (IWaveform signal : database.getAllWaves())
|
||||||
|
checkWaveform(signal, WaveformType.SIGNAL);
|
||||||
|
} finally { database.close(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user