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);
|
||||
updateTransactions(txId, scvTx);
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime));
|
||||
gen.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.getType()));
|
||||
} else {
|
||||
stream.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime));
|
||||
stream.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime, stream.getType()));
|
||||
gen.addEvent(new TxEvent(this, EventKind.BEGIN, txId, scvTx.beginTime, gen.getType()));
|
||||
stream.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime, stream.getType()));
|
||||
gen.addEvent(new TxEvent(this, EventKind.END, txId, scvTx.endTime, gen.getType()));
|
||||
}
|
||||
break;
|
||||
default: { // skip over 7:begin attr, 8:record attr, 9:end attr
|
||||
|
||||
+6
-12
@@ -26,6 +26,8 @@ class TxEvent implements ITxEvent {
|
||||
/** The kind. */
|
||||
final EventKind kind;
|
||||
|
||||
private final WaveformType waveformType;
|
||||
|
||||
/** The transaction. */
|
||||
final long transaction;
|
||||
|
||||
@@ -40,12 +42,14 @@ class TxEvent implements ITxEvent {
|
||||
* @param kind the kind
|
||||
* @param transaction the transaction
|
||||
* @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.kind = kind;
|
||||
this.transaction = transaction;
|
||||
this.time = time;
|
||||
this.waveformType = waveformType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +60,7 @@ class TxEvent implements ITxEvent {
|
||||
*/
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.STREAM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the kind.
|
||||
*
|
||||
|
||||
+6
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import com.minres.scviewer.database.DirectionType;
|
||||
import com.minres.scviewer.database.IEventList;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
|
||||
/**
|
||||
* The Class TxGenerator.
|
||||
@@ -45,6 +46,11 @@ class TxGenerator extends AbstractTxStream {
|
||||
stream.addChild(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.GENERATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is same.
|
||||
*
|
||||
|
||||
-5
@@ -57,11 +57,6 @@ public class TxEvent implements ITxEvent {
|
||||
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.STREAM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowIndex() {
|
||||
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.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||
@@ -39,6 +40,11 @@ public class TxGenerator extends AbstractTxStream {
|
||||
stream.addChild(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.GENERATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return (long) scvGenerator.getId();
|
||||
|
||||
+6
-6
@@ -421,13 +421,13 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
gen.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.getType()));
|
||||
} else {
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime, stream.getType()));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime, gen.getType()));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime, stream.getType()));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime, gen.getType()));
|
||||
}
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
|
||||
+6
-12
@@ -26,6 +26,8 @@ class TxEvent implements ITxEvent {
|
||||
/** The kind. */
|
||||
final EventKind kind;
|
||||
|
||||
private final WaveformType waveformType;
|
||||
|
||||
/** The transaction. */
|
||||
final long transaction;
|
||||
|
||||
@@ -40,12 +42,14 @@ class TxEvent implements ITxEvent {
|
||||
* @param kind the kind
|
||||
* @param transaction the transaction
|
||||
* @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.kind = kind;
|
||||
this.transaction = transaction;
|
||||
this.time = time;
|
||||
this.waveformType = waveformType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +60,7 @@ class TxEvent implements ITxEvent {
|
||||
*/
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.STREAM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the kind.
|
||||
*
|
||||
|
||||
+6
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
import com.minres.scviewer.database.DirectionType;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
|
||||
/**
|
||||
* The Class TxGenerator.
|
||||
@@ -45,6 +46,11 @@ class TxGenerator extends AbstractTxStream {
|
||||
stream.addChild(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.GENERATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is same.
|
||||
*
|
||||
|
||||
+5
-5
@@ -633,7 +633,7 @@ public class WaveformView implements IWaveformView {
|
||||
private void addPainter(boolean even, TrackEntry streamEntry) {
|
||||
streamEntry.height = styleProvider.getTrackHeight();
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.STREAM) {
|
||||
if (streamEntry.waveform.getType().isTransaction()) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
@@ -690,7 +690,7 @@ public class WaveformView implements IWaveformView {
|
||||
else
|
||||
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()];
|
||||
EventEntry firstTx = entry.waveform.getEvents().floorEntry(time);
|
||||
if (firstTx != null) {
|
||||
@@ -956,7 +956,7 @@ public class WaveformView implements IWaveformView {
|
||||
return;
|
||||
TrackEntry selectedWaveform = currentWaveformSelection.size() == 1 ? currentWaveformSelection.get(0)
|
||||
: 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)) {
|
||||
ITx transaction = null;
|
||||
if (direction == GotoDirection.NEXT) {
|
||||
@@ -1078,7 +1078,7 @@ public class WaveformView implements IWaveformView {
|
||||
TrackEntry sel = currentWaveformSelection.get(0);
|
||||
long time = getCursorTime();
|
||||
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();
|
||||
}
|
||||
if (map != null) {
|
||||
@@ -1634,7 +1634,7 @@ public class WaveformView implements IWaveformView {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -238,16 +238,6 @@ public class BitVector implements IEvent {
|
||||
return EventKind.SINGLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.SIGNAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate.
|
||||
*
|
||||
|
||||
@@ -37,16 +37,6 @@ public class DoubleVal implements IEvent {
|
||||
return EventKind.SINGLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.SIGNAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate.
|
||||
*
|
||||
|
||||
@@ -30,11 +30,4 @@ public interface IEvent {
|
||||
*/
|
||||
public EventKind getKind();
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public WaveformType getType();
|
||||
|
||||
}
|
||||
+7
-2
@@ -19,10 +19,15 @@ public enum WaveformType {
|
||||
SIGNAL,
|
||||
/** The transaction stream. */
|
||||
STREAM,
|
||||
/** The transaction stream. */
|
||||
/** The transaction generator. */
|
||||
GENERATOR,
|
||||
/** The filter. */
|
||||
FILTER,
|
||||
/** 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.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
public class SearchHandler {
|
||||
@@ -32,7 +31,7 @@ public class SearchHandler {
|
||||
Object[] elem = ((StructuredSelection)sel).toArray();
|
||||
if(elem.length ==0) return false;
|
||||
TrackEntry e = findTrackEntry(elem);
|
||||
return e!=null && e.waveform.getType()==WaveformType.STREAM;
|
||||
return e!=null && e.waveform.getType().isTransaction();
|
||||
}
|
||||
}
|
||||
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.EventKind;
|
||||
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.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
@@ -237,7 +236,7 @@ public class TransactionList extends Composite {
|
||||
}
|
||||
|
||||
public void setInput(TrackEntry trackEntry) {
|
||||
if(trackEntry==null || trackEntry.waveform.getType()!=WaveformType.STREAM) {
|
||||
if(trackEntry==null || !trackEntry.waveform.getType().isTransaction()) {
|
||||
attrNames.clear();
|
||||
tableViewer.setInput(emptyList);
|
||||
} 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();
|
||||
}
|
||||
|
||||
public void removeSelectedStreamsFromList() {
|
||||
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){
|
||||
switch(((IWaveform) element).getType()) {
|
||||
case STREAM:
|
||||
case GENERATOR:
|
||||
return stream;
|
||||
case FILTER:
|
||||
break;
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||
}else if(element instanceof IWaveform){
|
||||
switch(((IWaveform) element).getType()) {
|
||||
case STREAM:
|
||||
case GENERATOR:
|
||||
return stream;
|
||||
case FILTER:
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user