cleans interfaces up
This commit is contained in:
parent
bba4349e1e
commit
299f76323f
@ -142,6 +142,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
|
@ -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 {
|
||||
|
@ -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){
|
||||
|
@ -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<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
||||
try {
|
||||
|
@ -26,8 +26,6 @@ public class SQLiteDatabase implements IDatabase {
|
||||
|
||||
protected String dbFileName;
|
||||
|
||||
protected IWaveformDb waveformDb;
|
||||
|
||||
protected HashMap<String, Object> 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<String, Object>();
|
||||
}
|
||||
|
||||
@ -96,7 +93,7 @@ public class SQLiteDatabase implements IDatabase {
|
||||
|
||||
@Override
|
||||
public IWaveformDb getWaveformDb() {
|
||||
return waveformDb;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -143,6 +143,10 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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<value.length()) {
|
||||
switch (value.charAt(stringIndex++)) {
|
||||
case 'z':
|
||||
decodedValues.setValue(convertedIndex, BitValue.Z);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
decodedValues.setValue(convertedIndex, BitValue.ONE);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
decodedValues.setValue(convertedIndex, BitValue.ZERO);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
decodedValues.setValue(convertedIndex, BitValue.X);
|
||||
break;
|
||||
|
||||
default:
|
||||
decodedValues.setValue(convertedIndex, BitValue.X);
|
||||
}
|
||||
} else {
|
||||
decodedValues.setValue(convertedIndex, BitValue.ZERO);
|
||||
}
|
||||
}
|
||||
decodedValues = BitVector.fromString(netWidth, value);
|
||||
}
|
||||
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
||||
}
|
||||
|
@ -100,9 +100,13 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKind() {
|
||||
|
@ -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<value.length()) {
|
||||
switch (value.charAt(stringIndex++)) {
|
||||
case 'z':
|
||||
bv.setValue(convertedIndex, BitValue.Z);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
bv.setValue(convertedIndex, BitValue.ONE);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
bv.setValue(convertedIndex, BitValue.ZERO);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
bv.setValue(convertedIndex, BitValue.X);
|
||||
break;
|
||||
|
||||
default:
|
||||
bv.setValue(convertedIndex, BitValue.X);
|
||||
}
|
||||
} else {
|
||||
bv.setValue(convertedIndex, BitValue.ZERO);
|
||||
}
|
||||
}
|
||||
return bv;
|
||||
}
|
||||
/**
|
||||
* Sets the value.
|
||||
*
|
||||
|
@ -78,4 +78,11 @@ public interface IWaveform extends IHierNode {
|
||||
*/
|
||||
public int getRowCount();
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public interface IWaveformDbLoader {
|
||||
* @param inputFile the input file
|
||||
* @throws InputFormatException the input format exception
|
||||
*/
|
||||
public void load(IWaveformDb db, File inputFile) throws InputFormatException;
|
||||
public void load(File inputFile) throws InputFormatException;
|
||||
|
||||
/**
|
||||
* Gets the max time.
|
||||
|
@ -135,7 +135,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
|
||||
IWaveformDbLoader loader = loaderFactory.getLoader();
|
||||
loader.addPropertyChangeListener(this);
|
||||
try {
|
||||
loader.load(this, inp);
|
||||
loader.load(inp);
|
||||
} catch (Exception e) {
|
||||
LOG.error("error loading file "+inp.getName(), e);
|
||||
retval=false;
|
||||
|
@ -139,7 +139,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
@ -77,7 +77,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
Loading…
Reference in New Issue
Block a user