From 299f76323f551db964e48f13bceebf8b757d3f2b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 27 Feb 2023 13:07:10 +0100 Subject: [PATCH] cleans interfaces up --- .../database/ftr/AbstractTxStream.java | 5 +++ .../scviewer/database/ftr/FtrDbLoader.java | 2 +- .../database/sqlite/AbstractTxStream.java | 5 +++ .../database/sqlite/SQLiteDbLoader.java | 5 ++- .../database/sqlite/db/SQLiteDatabase.java | 7 ++-- .../database/text/AbstractTxStream.java | 4 +++ .../scviewer/database/text/TextDbLoader.java | 2 +- .../scviewer/database/vcd/VCDDbLoader.java | 4 +-- .../scviewer/database/vcd/VCDFileParser.java | 32 +++---------------- .../scviewer/database/vcd/VCDSignal.java | 6 +++- .../minres/scviewer/database/BitVector.java | 31 ++++++++++++++++++ .../minres/scviewer/database/IWaveform.java | 7 ++++ .../scviewer/database/IWaveformDbLoader.java | 2 +- .../database/internal/WaveformDb.java | 2 +- .../provider/TxDbLabelProvider.java | 2 +- .../views/provider/TxDbTreeLabelProvider.java | 2 +- 16 files changed, 73 insertions(+), 45 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java index 2dce2f3..4a64708 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java @@ -142,6 +142,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { return rowCount; } + @Override + public int getWidth() { + return 0; + } + /** * Calculate concurrency. */ diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index 483651f..d84610d 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -184,7 +184,7 @@ public class FtrDbLoader implements IWaveformDbLoader { * @throws InputFormatException the input format exception */ @Override - public void load(IWaveformDb db, File file) throws InputFormatException { + public void load(File file) throws InputFormatException { dispose(); this.file=file; try { diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/AbstractTxStream.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/AbstractTxStream.java index cb46eff..9b92b58 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/AbstractTxStream.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/AbstractTxStream.java @@ -71,6 +71,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { return maxConcurrency; } + @Override + public int getWidth() { + return 0; + } + @Override public IEventList getEvents(){ if(events==null){ diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java index 7a47697..ec70b55 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.List; import com.minres.scviewer.database.IWaveform; -import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; @@ -94,8 +93,8 @@ public class SQLiteDbLoader implements IWaveformDbLoader { // } @Override - public void load(IWaveformDb db, File file) throws InputFormatException { - database=new SQLiteDatabase(file.getAbsolutePath(), db); + public void load(File file) throws InputFormatException { + database=new SQLiteDatabase(file.getAbsolutePath()); database.setData("TIMERESOLUTION", 1L); SQLiteDatabaseSelectHandler handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database); try { diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/db/SQLiteDatabase.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/db/SQLiteDatabase.java index 5e1d31e..519c885 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/db/SQLiteDatabase.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/db/SQLiteDatabase.java @@ -26,8 +26,6 @@ public class SQLiteDatabase implements IDatabase { protected String dbFileName; - protected IWaveformDb waveformDb; - protected HashMap props; static { @@ -43,10 +41,9 @@ public class SQLiteDatabase implements IDatabase { } } - public SQLiteDatabase(String dbFileName, IWaveformDb waveformDb) { + public SQLiteDatabase(String dbFileName) { super(); this.dbFileName = dbFileName; - this.waveformDb = waveformDb; props = new HashMap(); } @@ -96,7 +93,7 @@ public class SQLiteDatabase implements IDatabase { @Override public IWaveformDb getWaveformDb() { - return waveformDb; + return null; } } diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java index a3660ae..6950203 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java @@ -143,6 +143,10 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { return rowCount; } + @Override + public int getWidth() { + return 0; + } /** * Calculate concurrency. */ diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java index 63796ec..563af11 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.java @@ -222,7 +222,7 @@ public class TextDbLoader implements IWaveformDbLoader { */ @SuppressWarnings("unchecked") @Override - public void load(IWaveformDb db, File file) throws InputFormatException { + public void load(File file) throws InputFormatException { dispose(); FileType fType = getFileType(file); if (file.length() < MEMMAP_LIMIT * (fType!=FileType.PLAIN ? 1 : 10) diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java index 8476df0..1801a50 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java @@ -71,7 +71,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { */ @SuppressWarnings("unchecked") @Override - public void load(IWaveformDb db, File file) throws InputFormatException { + public void load(File file) throws InputFormatException { dispose(); this.maxTime=0; boolean res = false; @@ -176,7 +176,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { @Override public int getNetWidth(int intValue) { VCDSignal signal = (VCDSignal) signals.get(intValue); - return signal.getRowCount(); + return signal.getWidth(); } /* (non-Javadoc) diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java index fdd3c4c..8976419 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java @@ -205,41 +205,17 @@ class VCDFileParser { else traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value)); } else { - BitVector decodedValues = new BitVector(netWidth); + BitVector decodedValues; if (value.equals("z") && netWidth > 1) { + decodedValues = new BitVector(netWidth); for (int i = 0; i < netWidth; i++) decodedValues.setValue(i, BitValue.Z); } else if (value.equals("x") && netWidth > 1) { + decodedValues = new BitVector(netWidth); for (int i = 0; i < netWidth; i++) decodedValues.setValue(i, BitValue.X); } else { - int stringIndex = 0; - for (int convertedIndex = netWidth -1; convertedIndex >=0; convertedIndex--) { - if(convertedIndex extends HierNode implements IWaveform { } @Override - public int getRowCount() { + public int getWidth() { return width; } + @Override + public int getRowCount() { + return 1; + } @Override public String getKind() { diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java index bf8c576..898230d 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java @@ -33,6 +33,37 @@ public class BitVector implements IEvent { packedValues[i] = 0; } + public static BitVector fromString(int netWidth, String value){ + BitVector bv = new BitVector(netWidth); + int stringIndex = 0; + for (int convertedIndex = netWidth -1; convertedIndex >=0; convertedIndex--) { + if(convertedIndex