add TreeMap facade
This commit is contained in:
@@ -20,8 +20,6 @@ import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Vector;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@@ -29,6 +27,7 @@ import com.google.common.collect.Iterables;
|
||||
import com.minres.scviewer.database.BitVector;
|
||||
import com.minres.scviewer.database.DoubleVal;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IEventList;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
@@ -118,14 +117,14 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||
if(!res) throw new InputFormatException("Could not parse VCD file");
|
||||
// calculate max time of this database
|
||||
for(IWaveform waveform:signals) {
|
||||
NavigableMap<Long, IEvent[]> events =waveform.getEvents();
|
||||
IEventList<Long, IEvent[]> events =waveform.getEvents();
|
||||
if(!events.isEmpty())
|
||||
maxTime= Math.max(maxTime, events.lastKey());
|
||||
}
|
||||
// extend signals to have a last value set at max time
|
||||
for(IWaveform s:signals){
|
||||
if(s instanceof VCDSignal<?>) {
|
||||
TreeMap<Long,?> events = (TreeMap<Long, ?>) ((VCDSignal<?>)s).getEvents();
|
||||
IEventList<Long, IEvent[]> events = ((VCDSignal<?>)s).getEvents();
|
||||
if(events.size()>0 && events.lastKey()<maxTime){
|
||||
Object val = events.lastEntry().getValue();
|
||||
if(val instanceof BitVector) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
package com.minres.scviewer.database.vcd;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.minres.scviewer.database.EventList;
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IEventList;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||
|
||||
private final int width;
|
||||
|
||||
private NavigableMap<Long, IEvent[]> values;
|
||||
private IEventList<Long, IEvent[]> values;
|
||||
|
||||
public VCDSignal(String name) {
|
||||
this(0, name, 1);
|
||||
@@ -42,7 +42,7 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||
fullName=name;
|
||||
this.id=id;
|
||||
this.width=width;
|
||||
this.values=new TreeMap<>();
|
||||
this.values=new EventList<>();
|
||||
}
|
||||
|
||||
public VCDSignal(VCDSignal<T> o, int id, String name) {
|
||||
@@ -80,7 +80,7 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<Long, IEvent[]> getEvents() {
|
||||
public IEventList<Long, IEvent[]> getEvents() {
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user