From a077389b83713af51b5ba7c5567cbeb80a3d55d8 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 24 Feb 2021 08:46:19 +0000 Subject: [PATCH 01/12] add dispose check in case view is closed while loading db --- .../scviewer/e4/application/parts/DesignBrowser.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java index 4b47c91..22314cd 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java @@ -133,10 +133,11 @@ public class DesignBrowser { treeViewer.refresh(); }); } else if(IHierNode.LOADING_FINISHED.equals(evt.getPropertyName())) { - treeViewer.getTree().getDisplay().asyncExec(() -> { - treeViewer.update(waveformViewerPart.getDatabase(), null); - DesignBrowser.this.updateButtons(); - }); + if(!treeViewer.getControl().isDisposed()) + treeViewer.getTree().getDisplay().asyncExec(() -> { + treeViewer.update(waveformViewerPart.getDatabase(), null); + DesignBrowser.this.updateButtons(); + }); } }; @@ -596,6 +597,7 @@ public class DesignBrowser { * Apply. */ public void apply() { + if(treeViewer.getControl().isDisposed()) return; treeViewer.setExpandedElements(expandedElements); treeViewer.setSelection(treeSelection, true); txTableViewer.setSelection(tableSelection, true); From c41dd646da20a3592bd0903c984c91ff10c8c0f3 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 26 Feb 2021 11:57:54 +0000 Subject: [PATCH 02/12] add TreeMap facade --- .../feature.xml | 4 + .../database/sqlite/AbstractTxStream.java | 10 +- .../database/text/AbstractTxStream.java | 8 +- .../ui/swt/internal/ArrowPainter.java | 2 +- .../ui/swt/internal/SignalPainter.java | 10 +- .../ui/swt/internal/StreamPainter.java | 11 +- .../ui/swt/internal/WaveformView.java | 8 +- .../scviewer/database/vcd/VCDDbLoader.java | 7 +- .../scviewer/database/vcd/VCDSignal.java | 10 +- .../minres/scviewer/database/EventList.java | 100 ++++++++++++++++++ .../minres/scviewer/database/IEventList.java | 40 +++++++ .../minres/scviewer/database/IWaveform.java | 3 +- .../scviewer.product | 4 - 13 files changed, 178 insertions(+), 39 deletions(-) create mode 100644 plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java create mode 100644 plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java diff --git a/features/com.minres.scviewer.e4.platform.feature/feature.xml b/features/com.minres.scviewer.e4.platform.feature/feature.xml index 574cc69..5909688 100644 --- a/features/com.minres.scviewer.e4.platform.feature/feature.xml +++ b/features/com.minres.scviewer.e4.platform.feature/feature.xml @@ -29,6 +29,10 @@ id="org.eclipse.emf.common" version="0.0.0"/> + + 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 86a2ff6..8186585 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 @@ -14,12 +14,12 @@ import java.sql.SQLException; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.NavigableMap; -import java.util.TreeMap; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; +import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationTypeFactory; @@ -35,7 +35,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { private Integer maxConcurrency; - private TreeMap events; + private IEventList events; private List usedRelationsList; @@ -71,9 +71,9 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { } @Override - public NavigableMap getEvents(){ + public IEventList getEvents(){ if(events==null){ - events=new TreeMap<>(); + events=new EventList<>(); for(Entry entry:getTransactions().entrySet()){ putEvent(new TxEvent(EventKind.BEGIN, entry.getValue())); putEvent(new TxEvent(EventKind.END, entry.getValue())); 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 b71c974..7c6371c 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 @@ -15,11 +15,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; 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; import com.minres.scviewer.database.tx.ITx; @@ -39,7 +39,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { protected TextDbLoader loader; /** The events. */ - TreeMap events = new TreeMap<>(); + IEventList events = new EventList(); /** The max concurrency. */ private int rowCount = -1; @@ -89,7 +89,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @return the events */ @Override - public NavigableMap getEvents() { + public IEventList getEvents() { return events; } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java index f867b70..7a817d3 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java @@ -83,7 +83,7 @@ public class ArrowPainter implements IPainter { } private int getConcurrencyIndex(ITx tx) { - IEvent[] eventList = tx.getStream().getEvents().floorEntry(tx.getBeginTime()).getValue(); + IEvent[] eventList = tx.getStream().getEventsBeforeTime(tx.getBeginTime()); Optional res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst(); return res.isPresent()? res.get():0; } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java index 40a5bc9..d4469c2 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java @@ -13,7 +13,6 @@ package com.minres.scviewer.database.ui.swt.internal; import java.util.Arrays; import java.util.Collection; import java.util.Map.Entry; -import java.util.NavigableMap; import javax.swing.JPanel; @@ -27,6 +26,7 @@ import org.eclipse.swt.graphics.Rectangle; 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.ui.TrackEntry; import com.minres.scviewer.database.ui.WaveformColors; @@ -112,7 +112,7 @@ public class SignalPainter extends TrackPainter { proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); proj.setLineStyle(SWT.LINE_SOLID); proj.setLineWidth(1); - NavigableMap entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true); + IEventList entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true); SignalChange left = new SignalChange(first); SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first); maxPosX = area.x + area.width; @@ -161,7 +161,7 @@ public class SignalPainter extends TrackPainter { } while (left.time < endTime); } - private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap entries) { + private SignalStencil getStencil(GC gc, SignalChange left, IEventList entries) { IEvent val = left.value; if(val instanceof BitVector) { BitVector bv = (BitVector) val; @@ -253,7 +253,7 @@ public class SignalPainter extends TrackPainter { private long maxVal; private long minVal; double yRange = (yOffsetB-yOffsetT); - public MultiBitStencilAnalog(NavigableMap entries, Object left, boolean continous, boolean signed) { + public MultiBitStencilAnalog(IEventList entries, Object left, boolean continous, boolean signed) { this.continous=continous; this.signed=signed; Collection values = entries.values(); @@ -358,7 +358,7 @@ public class SignalPainter extends TrackPainter { boolean continous=true; - public RealStencil(NavigableMap entries, Object left, boolean continous) { + public RealStencil(IEventList entries, Object left, boolean continous) { this.continous=continous; Collection values = entries.values(); minVal=(Double) left; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java index 1d451fe..33a4d9f 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java @@ -11,7 +11,6 @@ package com.minres.scviewer.database.ui.swt.internal; import java.util.Map.Entry; -import java.util.NavigableMap; import java.util.TreeMap; import org.eclipse.swt.SWT; @@ -21,6 +20,7 @@ import org.eclipse.swt.graphics.Rectangle; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITxEvent; @@ -36,6 +36,7 @@ public class StreamPainter extends TrackPainter{ private IWaveform stream; private int txBase; private int txHeight; + // TODO: remove TreeMap usage private TreeMap seenTx; public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) { @@ -87,7 +88,7 @@ public class StreamPainter extends TrackPainter{ drawTx(proj, area, ((ITxEvent)txEvent).getTransaction(), ((ITxEvent)txEvent).getRowIndex(), false); }else{ seenTx.clear(); - NavigableMap entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true); + IEventList entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true); ITxEvent highlighed=null; proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1; @@ -157,7 +158,7 @@ public class StreamPainter extends TrackPainter{ Entry firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor()); if(firstTx!=null){ do { - ITx tx = getTxFromEntry(lane, point.x, firstTx); + ITx tx = getTxFromEntry(lane, point.x, firstTx.getValue()); if(tx!=null) return tx; firstTx=stream.getEvents().lowerEntry(firstTx.getKey()); }while(firstTx!=null); @@ -173,11 +174,11 @@ public class StreamPainter extends TrackPainter{ this.stream = stream; } - protected ITx getTxFromEntry(int lane, int offset, Entry firstTx) { + protected ITx getTxFromEntry(int lane, int offset, IEvent[] firstTx) { long timePoint=offset*waveCanvas.getScaleFactor(); long timePointLow=(offset-5)*waveCanvas.getScaleFactor(); long timePointHigh=(offset+5)*waveCanvas.getScaleFactor(); - for(IEvent e:firstTx.getValue()){ + for(IEvent e:firstTx){ if(e instanceof ITxEvent) { ITxEvent evt = (ITxEvent) e; ITx tx=evt.getTransaction(); diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java index 3ab9cca..2f10f9e 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java @@ -21,7 +21,6 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; -import java.util.NavigableMap; import java.util.NoSuchElementException; import java.util.Optional; import java.util.TreeMap; @@ -79,6 +78,7 @@ import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.DoubleVal; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.WaveformType; @@ -259,11 +259,11 @@ public class WaveformView implements IWaveformView { Entry ceilEntry = null; if (o instanceof TrackEntry) { TrackEntry entry = (TrackEntry) o; - NavigableMap map = entry.waveform.getEvents(); + IEventList map = entry.waveform.getEvents(); floorEntry = map.floorEntry(time); ceilEntry = map.ceilingEntry(time); } else if (o instanceof ITx) { - NavigableMap map = ((ITx) o).getStream().getEvents(); + IEventList map = ((ITx) o).getStream().getEvents(); floorEntry = map.floorEntry(time); ceilEntry = map.ceilingEntry(time); } @@ -958,7 +958,7 @@ public class WaveformView implements IWaveformView { return; TrackEntry sel = currentWaveformSelection.get(0); long time = getCursorTime(); - NavigableMap map = null; + IEventList map = null; if (sel.waveform.getType() == WaveformType.TRANSACTION || sel.waveform.getType() == WaveformType.SIGNAL) { map = sel.waveform.getEvents(); } 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 0481975..ee5ce50 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 @@ -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 events =waveform.getEvents(); + IEventList 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 events = (TreeMap) ((VCDSignal)s).getEvents(); + IEventList events = ((VCDSignal)s).getEvents(); if(events.size()>0 && events.lastKey() extends HierNode implements IWaveform { private final int width; - private NavigableMap values; + private IEventList values; public VCDSignal(String name) { this(0, name, 1); @@ -42,7 +42,7 @@ public class VCDSignal extends HierNode implements IWaveform { fullName=name; this.id=id; this.width=width; - this.values=new TreeMap<>(); + this.values=new EventList<>(); } public VCDSignal(VCDSignal o, int id, String name) { @@ -80,7 +80,7 @@ public class VCDSignal extends HierNode implements IWaveform { } @Override - public NavigableMap getEvents() { + public IEventList getEvents() { return values; } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java new file mode 100644 index 0000000..f059d35 --- /dev/null +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java @@ -0,0 +1,100 @@ +package com.minres.scviewer.database; + +import java.util.Collection; +import java.util.Map.Entry; +import java.util.NavigableMap; +import java.util.TreeMap; + +public class EventList implements IEventList{ + + NavigableMap backing ; + + public EventList() { + backing=new TreeMap<>(); + } + + public EventList(NavigableMap subMap) { + backing=subMap; + } + + @Override + public Entry floorEntry(K key) { + return backing.floorEntry(key); + } + + @Override + public Entry ceilingEntry(K key) { + return backing.ceilingEntry(key); + } + + @Override + public Entry firstEntry() { + return backing.firstEntry(); + } + + @Override + public Entry lastEntry() { + return backing.lastEntry(); + } + + @Override + public V get(K key) { + return backing.get(key); + } + + @Override + public Entry higherEntry(K key) { + return backing.higherEntry(key); + } + + @Override + public Entry lowerEntry(K key) { + return backing.lowerEntry(key); + } + + @Override + public IEventList subMap(K key, boolean b, K key2, boolean c) { + return new EventList( backing.subMap(key, b, key2, c)); + } + + @Override + public int size() { + return backing.size(); + } + + @Override + public Collection keys() { + return backing.keySet(); + } + + @Override + public Collection values() { + return backing.values(); + } + + @Override + public boolean containsKey(K key) { + return backing.containsKey(key); + } + + @Override + public V put(K key, V value) { + return backing.put(key, value); + } + + @Override + public Collection> entrySet() { + return backing.entrySet(); + } + + @Override + public boolean isEmpty() { + return backing.isEmpty(); + } + + @Override + public K lastKey() { + return backing.lastKey(); + } + +} diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java new file mode 100644 index 0000000..d94e81a --- /dev/null +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java @@ -0,0 +1,40 @@ +package com.minres.scviewer.database; + +import java.util.Collection; +import java.util.Map.Entry; + +public interface IEventList { + + Entry floorEntry(K key); + + Entry ceilingEntry(K key); + + Entry firstEntry(); + + Entry lastEntry(); + + V get(K key); + + Entry higherEntry(K key); + + Entry lowerEntry(K key); + + IEventList subMap(K key, boolean b, K key2, boolean c); + + int size(); + + Collection keys(); + + Collection values(); + + boolean containsKey(K key); + + V put(K key, V value); + + Collection> entrySet(); + + boolean isEmpty(); + + K lastKey(); + +} diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java index c96b04a..a35ddd5 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java @@ -10,7 +10,6 @@ *******************************************************************************/ package com.minres.scviewer.database; -import java.util.NavigableMap; // TODO: Auto-generated Javadoc /** @@ -40,7 +39,7 @@ public interface IWaveform extends IHierNode { * * @return the events */ - public NavigableMap getEvents(); + public IEventList getEvents(); /** * Gets the events at time. diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 547dc2e..a821eb7 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -51,17 +51,13 @@ - - - - From 68918689e7bf7b5aaf2de25c1941cbfeaea8f749 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 12:26:07 +0000 Subject: [PATCH 03/12] add explicit event list --- .../database/sqlite/AbstractTxStream.java | 11 +- .../database/text/AbstractTxStream.java | 14 +- .../ui/swt/internal/SignalPainter.java | 44 ++-- .../ui/swt/internal/StreamPainter.java | 20 +- .../ui/swt/internal/WaveformCanvas.java | 5 +- .../ui/swt/internal/WaveformView.java | 45 ++-- .../scviewer/database/vcd/VCDDbLoader.java | 7 +- .../scviewer/database/vcd/VCDSignal.java | 13 +- .../META-INF/MANIFEST.MF | 1 + .../minres/scviewer/database/EventEntry.java | 28 +++ .../minres/scviewer/database/EventList.java | 222 +++++++++++++----- .../minres/scviewer/database/IEventList.java | 98 +++++--- .../minres/scviewer/database/IWaveform.java | 2 +- .../WaveformPopupMenuContribution.java | 2 +- .../e4/application/parts/TransactionList.java | 8 +- .../e4/application/parts/WaveformViewer.java | 15 +- .../database/test/DatabaseServicesTest.java | 11 +- .../scviewer/database/test/EventListTest.java | 198 ++++++++++++++++ 18 files changed, 560 insertions(+), 184 deletions(-) create mode 100644 plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java create mode 100644 tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java 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 8186585..2132faa 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 @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IEvent; @@ -35,7 +36,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { private Integer maxConcurrency; - private IEventList events; + private IEventList events; private List usedRelationsList; @@ -71,9 +72,9 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { } @Override - public IEventList getEvents(){ + public IEventList getEvents(){ if(events==null){ - events=new EventList<>(); + events=new EventList(); for(Entry entry:getTransactions().entrySet()){ putEvent(new TxEvent(EventKind.BEGIN, entry.getValue())); putEvent(new TxEvent(EventKind.END, entry.getValue())); @@ -114,11 +115,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { @Override public IEvent[] getEventsBeforeTime(Long time) { - Entry e = events.floorEntry(time); + EventEntry e = events.floorEntry(time); if(e==null) return new IEvent[]{}; else - return events.floorEntry(time).getValue(); + return events.floorEntry(time).events; } @Override 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 7c6371c..562de54 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 @@ -14,8 +14,8 @@ package com.minres.scviewer.database.text; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.Map.Entry; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IEvent; @@ -39,7 +39,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { protected TextDbLoader loader; /** The events. */ - IEventList events = new EventList(); + IEventList events = new EventList(); /** The max concurrency. */ private int rowCount = -1; @@ -89,7 +89,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @return the events */ @Override - public IEventList getEvents() { + public IEventList getEvents() { return events; } @@ -112,11 +112,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { */ @Override public IEvent[] getEventsBeforeTime(Long time) { - Entry e = events.floorEntry(time); + EventEntry e = events.floorEntry(time); if (e == null) return new IEvent[] {}; else - return events.floorEntry(time).getValue(); + return events.floorEntry(time).events; } /** @@ -159,8 +159,8 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { return; ArrayList rowEndTime = new ArrayList<>(); HashMap rowByTxId = new HashMap<>(); - for(Entry entry: events.entrySet()) { - for(IEvent evt:entry.getValue()) { + for(EventEntry entry: events) { + for(IEvent evt:entry.events) { TxEvent txEvt = (TxEvent) evt; ITx tx = txEvt.getTransaction(); int rowIdx = 0; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java index d4469c2..8bfd10a 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java @@ -12,7 +12,6 @@ package com.minres.scviewer.database.ui.swt.internal; import java.util.Arrays; import java.util.Collection; -import java.util.Map.Entry; import javax.swing.JPanel; @@ -25,6 +24,7 @@ import org.eclipse.swt.graphics.Rectangle; import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.DoubleVal; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; @@ -37,16 +37,16 @@ public class SignalPainter extends TrackPainter { IEvent value; boolean fromMap; - public SignalChange(Entry entry) { - time = entry.getKey(); - value = entry.getValue()[0]; + public SignalChange(EventEntry entry) { + time = entry.timestamp; + value = entry.events[0]; fromMap = true; } - public void set(Entry entry, Long actTime) { + public void set(EventEntry entry, Long actTime) { if (entry != null) { - time = entry.getKey(); - value = entry.getValue()[0]; + time = entry.timestamp; + value = entry.events[0]; fromMap = true; } else { time = actTime; @@ -100,8 +100,8 @@ public class SignalPainter extends TrackPainter { long beginTime = beginPos*scaleFactor; long endTime = beginTime + area.width*scaleFactor; - Entry first = signal.getEvents().floorEntry(beginTime); - Entry last = signal.getEvents().floorEntry(endTime); + EventEntry first = signal.getEvents().floorEntry(beginTime); + EventEntry last = signal.getEvents().floorEntry(endTime); if (first == null) { if (last == null) return; @@ -112,7 +112,7 @@ public class SignalPainter extends TrackPainter { proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); proj.setLineStyle(SWT.LINE_SOLID); proj.setLineWidth(1); - IEventList entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true); + IEventList entries = signal.getEvents().subMap(first.timestamp, false, last.timestamp); SignalChange left = new SignalChange(first); SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first); maxPosX = area.x + area.width; @@ -153,15 +153,15 @@ public class SignalPainter extends TrackPainter { if (xSigChangeEndPos == xSigChangeBeginPos) { multiple = true; long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor(); - Entry entry = entries.floorEntry(eTime); - if(entry!=null && entry.getKey()> right.time) + EventEntry entry = entries.floorEntry(eTime); + if(entry!=null && entry.timestamp> right.time) right.set(entry, endTime); xSigChangeEndPos = getXPosEnd(eTime); } } while (left.time < endTime); } - private SignalStencil getStencil(GC gc, SignalChange left, IEventList entries) { + private SignalStencil getStencil(GC gc, SignalChange left, IEventList entries) { IEvent val = left.value; if(val instanceof BitVector) { BitVector bv = (BitVector) val; @@ -253,15 +253,15 @@ public class SignalPainter extends TrackPainter { private long maxVal; private long minVal; double yRange = (yOffsetB-yOffsetT); - public MultiBitStencilAnalog(IEventList entries, Object left, boolean continous, boolean signed) { + public MultiBitStencilAnalog(IEventList entries, Object left, boolean continous, boolean signed) { this.continous=continous; this.signed=signed; - Collection values = entries.values(); + Collection ievents = entries.entrySet(); minVal=signed?((BitVector)left).toSignedValue():((BitVector)left).toUnsignedValue(); - if(!values.isEmpty()) { + if(!ievents.isEmpty()) { maxVal=minVal; - for (IEvent[] tp : entries.values()) - for(IEvent e: tp) { + for (EventEntry tp : ievents) + for(IEvent e: tp.events) { long v = signed?((BitVector)e).toSignedValue():((BitVector)e).toUnsignedValue(); maxVal=Math.max(maxVal, v); minVal=Math.min(minVal, v); @@ -358,15 +358,15 @@ public class SignalPainter extends TrackPainter { boolean continous=true; - public RealStencil(IEventList entries, Object left, boolean continous) { + public RealStencil(IEventList entries, Object left, boolean continous) { this.continous=continous; - Collection values = entries.values(); + Collection values = entries.entrySet(); minVal=(Double) left; range=2.0; if(!values.isEmpty()) { double maxVal=minVal; - for (IEvent[] val : entries.values()) - for(IEvent e:val) { + for (EventEntry val : values) + for(IEvent e:val.events) { double v = ((DoubleVal)e).value; if(Double.isNaN(maxVal)) maxVal=v; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java index 33a4d9f..39c96f2 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java @@ -10,7 +10,6 @@ *******************************************************************************/ package com.minres.scviewer.database.ui.swt.internal; -import java.util.Map.Entry; import java.util.TreeMap; import org.eclipse.swt.SWT; @@ -18,9 +17,9 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IEvent; -import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITxEvent; @@ -72,8 +71,8 @@ public class StreamPainter extends TrackPainter{ long beginTime = beginPos*scaleFactor; long endTime = beginTime + area.width*scaleFactor; - Entry firstTx=stream.getEvents().floorEntry(beginTime); - Entry lastTx=stream.getEvents().ceilingEntry(endTime); + EventEntry firstTx=stream.getEvents().floorEntry(beginTime); + EventEntry lastTx=stream.getEvents().ceilingEntry(endTime); if(firstTx==null) firstTx = stream.getEvents().firstEntry(); if(lastTx==null) lastTx=stream.getEvents().lastEntry(); proj.setFillRule(SWT.FILL_EVEN_ODD); @@ -84,16 +83,15 @@ public class StreamPainter extends TrackPainter{ for( int y1=area.y+trackHeight/2; y1 entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true); ITxEvent highlighed=null; proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1; - for(Entry entry: entries.entrySet()) - for(IEvent e:entry.getValue()){ + for(EventEntry entry: stream.getEvents().subMap(firstTx.timestamp, true, lastTx.timestamp)) + for(IEvent e:entry.events){ ITxEvent evt = (ITxEvent) e; ITx tx = evt.getTransaction(); if(selectedId==tx.getId()) @@ -155,12 +153,12 @@ public class StreamPainter extends TrackPainter{ public ITx getClicked(Point point) { int lane=point.y/waveCanvas.styleProvider.getTrackHeight(); - Entry firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor()); + EventEntry firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor()); if(firstTx!=null){ do { - ITx tx = getTxFromEntry(lane, point.x, firstTx.getValue()); + ITx tx = getTxFromEntry(lane, point.x, firstTx.events); if(tx!=null) return tx; - firstTx=stream.getEvents().lowerEntry(firstTx.getKey()); + firstTx=stream.getEvents().lowerEntry(firstTx.timestamp); }while(firstTx!=null); } return null; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java index fb5d59f..e96ee6c 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java @@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.ScrollBar; import com.google.common.collect.Lists; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.RelationType; @@ -427,8 +428,8 @@ public class WaveformCanvas extends Canvas { } for (IWaveformPainter painter : wave2painterMap.values()) { if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) { - Entry entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime()); - Optional res = Arrays.stream(entry.getValue()).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst(); + EventEntry entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime()); + Optional res = Arrays.stream(entry.events).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst(); if(res.isPresent()) { int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * ((ITxEvent)res.get()).getRowIndex(); int bottom = top + styleProvider.getTrackHeight(); diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java index 2f10f9e..9158736 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java @@ -76,6 +76,7 @@ import org.eclipse.wb.swt.SWTResourceManager; import com.google.common.collect.Lists; import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.DoubleVal; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEventList; @@ -255,29 +256,29 @@ public class WaveformView implements IWaveformView { long time = waveformCanvas.getTimeForOffset(p.x); long scaling = 5 * waveformCanvas.getScaleFactor(); for (Object o : waveformCanvas.getElementsAt(p)) { - Entry floorEntry = null; - Entry ceilEntry = null; + EventEntry floorEntry = null; + EventEntry ceilEntry = null; if (o instanceof TrackEntry) { TrackEntry entry = (TrackEntry) o; - IEventList map = entry.waveform.getEvents(); + IEventList map = entry.waveform.getEvents(); floorEntry = map.floorEntry(time); ceilEntry = map.ceilingEntry(time); } else if (o instanceof ITx) { - IEventList map = ((ITx) o).getStream().getEvents(); + IEventList map = ((ITx) o).getStream().getEvents(); floorEntry = map.floorEntry(time); ceilEntry = map.ceilingEntry(time); } - if (floorEntry != null && time - floorEntry.getKey() > scaling) + if (floorEntry != null && time - floorEntry.timestamp > scaling) floorEntry = null; - if (ceilEntry != null && ceilEntry.getKey() - time > scaling) + if (ceilEntry != null && ceilEntry.timestamp - time > scaling) ceilEntry = null; if (ceilEntry == null && floorEntry != null) { - time = floorEntry.getKey(); + time = floorEntry.timestamp; } else if (ceilEntry != null && floorEntry == null) { - time = ceilEntry.getKey(); + time = ceilEntry.timestamp; } else if (ceilEntry != null && floorEntry != null) { - time = time - floorEntry.getKey() < ceilEntry.getKey() - time ? floorEntry.getKey() - : ceilEntry.getKey(); + time = time - floorEntry.timestamp < ceilEntry.timestamp - time ? floorEntry.timestamp + : ceilEntry.timestamp; } } return time; @@ -580,10 +581,10 @@ public class WaveformView implements IWaveformView { } } else if (entry.waveform.getType() == WaveformType.TRANSACTION) { ITx[] resultsList = new ITx[entry.waveform.getRowCount()]; - Entry firstTx = entry.waveform.getEvents().floorEntry(time); + EventEntry firstTx = entry.waveform.getEvents().floorEntry(time); if (firstTx != null) { do { - for (IEvent e : firstTx.getValue()) { + for (IEvent e : firstTx.events) { if (e instanceof ITxEvent) { ITxEvent evt = ((ITxEvent) e); ITx tx = evt.getTransaction(); @@ -593,7 +594,7 @@ public class WaveformView implements IWaveformView { resultsList[evt.getRowIndex()] = evt.getTransaction(); } } - firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey()); + firstTx = entry.waveform.getEvents().lowerEntry(firstTx.timestamp); } while (firstTx != null && !isArrayFull(resultsList)); boolean separator = false; StringBuilder sb = new StringBuilder(); @@ -854,11 +855,11 @@ public class WaveformView implements IWaveformView { } } if (transaction == null) { - Entry entry = selectedWaveform.waveform.getEvents() + EventEntry entry = selectedWaveform.waveform.getEvents() .higherEntry(currentTxSelection.getBeginTime()); if (entry != null) do { - for (IEvent evt : entry.getValue()) { + for (IEvent evt : entry.events) { if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)) { transaction = ((ITxEvent) evt).getTransaction(); @@ -866,7 +867,7 @@ public class WaveformView implements IWaveformView { } } if (transaction == null) - entry = selectedWaveform.waveform.getEvents().higherEntry(entry.getKey()); + entry = selectedWaveform.waveform.getEvents().higherEntry(entry.timestamp); } while (entry != null && transaction == null); } } else if (direction == GotoDirection.PREV) { @@ -883,11 +884,11 @@ public class WaveformView implements IWaveformView { } } if (transaction == null) { - Entry entry = selectedWaveform.waveform.getEvents() + EventEntry entry = selectedWaveform.waveform.getEvents() .lowerEntry(currentTxSelection.getBeginTime()); if (entry != null) do { - for (IEvent evt : Lists.reverse(Arrays.asList(entry.getValue()))) { + for (IEvent evt : Lists.reverse(Arrays.asList(entry.events))) { if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)) { transaction = ((ITxEvent) evt).getTransaction(); @@ -895,7 +896,7 @@ public class WaveformView implements IWaveformView { } } if (transaction == null) - entry = selectedWaveform.waveform.getEvents().lowerEntry(entry.getKey()); + entry = selectedWaveform.waveform.getEvents().lowerEntry(entry.timestamp); } while (entry != null && transaction == null); } } @@ -958,14 +959,14 @@ public class WaveformView implements IWaveformView { return; TrackEntry sel = currentWaveformSelection.get(0); long time = getCursorTime(); - IEventList map = null; + IEventList map = null; if (sel.waveform.getType() == WaveformType.TRANSACTION || sel.waveform.getType() == WaveformType.SIGNAL) { map = sel.waveform.getEvents(); } if (map != null) { - Entry entry = direction == GotoDirection.PREV ? map.lowerEntry(time) : map.higherEntry(time); + EventEntry entry = direction == GotoDirection.PREV ? map.lowerEntry(time) : map.higherEntry(time); if (entry != null) { - time = entry.getKey(); + time = entry.timestamp; setCursorTime(time); waveformCanvas.reveal(time); waveformCanvas.redraw(); 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 ee5ce50..3a8c39f 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 @@ -26,7 +26,6 @@ import java.util.zip.GZIPInputStream; 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; @@ -117,16 +116,16 @@ 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) { - IEventList events =waveform.getEvents(); + IEventList 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) { - IEventList events = ((VCDSignal)s).getEvents(); + IEventList events = ((VCDSignal)s).getEvents(); if(events.size()>0 && events.lastKey())s).addSignalChange(maxTime, (BitVector) val); } else if(val instanceof DoubleVal) diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java index 46ab266..6bfd9fd 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java @@ -10,8 +10,7 @@ *******************************************************************************/ package com.minres.scviewer.database.vcd; -import java.util.Map.Entry; - +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IEvent; @@ -27,7 +26,7 @@ public class VCDSignal extends HierNode implements IWaveform { private final int width; - private IEventList values; + private IEventList values; public VCDSignal(String name) { this(0, name, 1); @@ -42,7 +41,7 @@ public class VCDSignal extends HierNode implements IWaveform { fullName=name; this.id=id; this.width=width; - this.values=new EventList<>(); + this.values=new EventList(); } public VCDSignal(VCDSignal o, int id, String name) { @@ -80,7 +79,7 @@ public class VCDSignal extends HierNode implements IWaveform { } @Override - public IEventList getEvents() { + public IEventList getEvents() { return values; } @@ -91,11 +90,11 @@ public class VCDSignal extends HierNode implements IWaveform { @Override public IEvent[] getEventsBeforeTime(Long time) { - Entry e = values.floorEntry(time); + EventEntry e = values.floorEntry(time); if(e==null) return new IEvent[] {}; else - return values.floorEntry(time).getValue(); + return values.floorEntry(time).events; } @Override diff --git a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF index 952a33d..ce92e9f 100644 --- a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF @@ -10,3 +10,4 @@ Export-Package: com.minres.scviewer.database, Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml Automatic-Module-Name: com.minres.scviewer.database +Require-Bundle: org.eclipse.collections;bundle-version="10.4.0" diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java new file mode 100644 index 0000000..b719625 --- /dev/null +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java @@ -0,0 +1,28 @@ +package com.minres.scviewer.database; + +public class EventEntry implements Comparable{ + public long timestamp; // unsigned + public IEvent[] events = null; + + + public EventEntry(long timestamp) { + this.timestamp = timestamp; + } + + + public EventEntry(long timestamp, IEvent[] events) { + this.timestamp = timestamp; + this.events = events; + } + + + @Override + public int compareTo(EventEntry o) { + return Long.compareUnsigned(timestamp, o.timestamp); + } + + @Override + public String toString() { + return String.format("e.%d@%d", events.length,timestamp); + } +} diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java index f059d35..74cb340 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java @@ -1,100 +1,196 @@ package com.minres.scviewer.database; +import java.util.ArrayList; import java.util.Collection; -import java.util.Map.Entry; -import java.util.NavigableMap; -import java.util.TreeMap; +import java.util.Collections; -public class EventList implements IEventList{ +public class EventList implements IEventList { - NavigableMap backing ; + ArrayList store = new ArrayList<>(); + int start = 0; + int end = store.size(); + boolean unmodifiable = false; + + public class Iterator implements java.util.Iterator { + + EventList list; + + private int pos; + + public Iterator(EventList list) { + this.list=list; + this.pos=-1; + } + @Override + public boolean hasNext() { + return pos<(list.end-1); + } + + @Override + public EventEntry next() { + if(hasNext()) { + pos++; + return list.store.get(pos); + } else + return null; + } + + @Override + public void remove() { + list.store.remove(pos); + } + + } + public EventList() { - backing=new TreeMap<>(); } - public EventList(NavigableMap subMap) { - backing=subMap; + private EventList(ArrayList store , int start, int end) { + this.store=store; + this.start=start; + this.end=end; + this.unmodifiable=true; } @Override - public Entry floorEntry(K key) { - return backing.floorEntry(key); + public IEventList subMap(long from, boolean includeFrom, long to) { + //the index of the first element greater than the key, or list.size() + int beginIndex = Collections.binarySearch(store, new EventEntry(from)); + int startIndex = beginIndex < 0? -(beginIndex + 1): beginIndex; + int endIndex = Collections.binarySearch(store, new EventEntry(to)); + endIndex = endIndex < 0? -(endIndex + 1): endIndex+1; + if(beginIndex>0 && !includeFrom) + return new EventList(store, startIndex+1, endIndex); + else + return new EventList(store, startIndex, endIndex); } - - @Override - public Entry ceilingEntry(K key) { - return backing.ceilingEntry(key); - } - - @Override - public Entry firstEntry() { - return backing.firstEntry(); - } - - @Override - public Entry lastEntry() { - return backing.lastEntry(); - } - - @Override - public V get(K key) { - return backing.get(key); - } - - @Override - public Entry higherEntry(K key) { - return backing.higherEntry(key); - } - - @Override - public Entry lowerEntry(K key) { - return backing.lowerEntry(key); - } - - @Override - public IEventList subMap(K key, boolean b, K key2, boolean c) { - return new EventList( backing.subMap(key, b, key2, c)); - } - + @Override public int size() { - return backing.size(); + return end-start; } @Override - public Collection keys() { - return backing.keySet(); + public boolean containsKey(long key) { + int index = Collections.binarySearch(store, new EventEntry(key)); + return index>=0 && index>=start && index values() { - return backing.values(); + public IEvent[] get(long key) { + int index = Collections.binarySearch(store, new EventEntry(key)); + if(index<0) return null; + return index>=start && index> entrySet() { - return backing.entrySet(); + public Collection entrySet() { + if(start != 0 || end != store.size()) + return Collections.unmodifiableList(store.subList(start, end)); + else + return Collections.unmodifiableList(store); } @Override public boolean isEmpty() { - return backing.isEmpty(); + return start==end || store.isEmpty(); } @Override - public K lastKey() { - return backing.lastKey(); + public long firstKey() { + return store.get(start).timestamp; + } + + @Override + public long lastKey() { + return store.get(end-1).timestamp; + } + + // Navigable map functions + @Override + public EventEntry firstEntry() { + return store.get(start); + } + + @Override + public EventEntry lastEntry() { + return store.get(end-1); + } + + @Override + public EventEntry floorEntry(long key) { + int index = Collections.binarySearch(store, new EventEntry(key)); + if(index==-1) return null; + // < 0 if element is not in the list, see Collections.binarySearch + if (index < 0) { + index = -(index + 2); + } + if(index>=end) + return store.get(end-1); + return index=end? null: store.get(index); + } + + @Override + public EventEntry lowerEntry(long key) { + int index = Collections.binarySearch(store, new EventEntry(key)); + // < 0 if element is not in the list, see Collections.binarySearch + if (index < 0) + index = -(index + 1); + index--; + if(index>=end) + return store.get(end-1); + return index>=end || index=end || index iterator() { + return new Iterator(this); } } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java index d94e81a..ddc2459 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java @@ -1,40 +1,84 @@ package com.minres.scviewer.database; import java.util.Collection; -import java.util.Map.Entry; -public interface IEventList { - - Entry floorEntry(K key); - - Entry ceilingEntry(K key); - - Entry firstEntry(); - - Entry lastEntry(); - - V get(K key); - - Entry higherEntry(K key); - - Entry lowerEntry(K key); - - IEventList subMap(K key, boolean b, K key2, boolean c); +public interface IEventList extends Iterable { int size(); - Collection keys(); - - Collection values(); + Collection entrySet(); - boolean containsKey(K key); + boolean containsKey(long key); - V put(K key, V value); + IEvent[] get(long key); - Collection> entrySet(); + IEvent[] put(long key, IEvent[] value); + + long firstKey(); + + long lastKey(); boolean isEmpty(); - - K lastKey(); - + /** + * Returns a key-value mapping associated with the greatest key less + * than or equal to the given key, or null if there is no such key. + * + * @param key + * @return + */ + EventEntry floorEntry(long key); + /** + * Returns a key-value mapping associated with the least key greater + * than or equal to the given key, or null if there is no such key. + * + * @param key + * @return + */ + EventEntry ceilingEntry(long key); + /** + * Returns a key-value mapping associated with the least key in this map, + * or null if the map is empty. + * + * @return + */ + EventEntry firstEntry(); + /** + * Returns a key-value mapping associated with the least key in this map, + * or null if the map is empty. + * + * @return + */ + EventEntry lastEntry(); + /** + * Returns a key-value mapping associated with the least key strictly greater + * than the given key, or null if there is no such key. + * + * @param key + * @return + */ + EventEntry higherEntry(long key); + /** + * Returns a key-value mapping associated with the greatest key strictly less + * than the given key, or null if there is no such key. + * + * @param key + * @return + */ + EventEntry lowerEntry(long key); + /** + * Returns a view of the portion of this map whose keys range from + * {@code fromKey} to {@code toKey}. If {@code fromKey} and + * {@code toKey} are equal, the returned map is empty unless + * {@code fromInclusive} is true. The + * returned map is backed by this map, so changes in the returned map are + * reflected in this map, and vice-versa. The returned map supports all + * optional map operations that this map supports. + * + * @param fromKey low endpoint of the keys in the returned map + * @param fromInclusive {@code true} if the low endpoint + * is to be included in the returned view + * @param toKey high endpoint of the keys in the returned map (inclusive) + */ + IEventList subMap(long key, boolean b, long key2); + } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java index a35ddd5..ef3b2ee 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java @@ -39,7 +39,7 @@ public interface IWaveform extends IHierNode { * * @return the events */ - public IEventList getEvents(); + public IEventList getEvents(); /** * Gets the events at time. diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java index 58cf2a2..b85191a 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java @@ -40,7 +40,7 @@ public class WaveformPopupMenuContribution { if(elem instanceof TrackEntry) { TrackEntry e = (TrackEntry) elem; if(e.waveform.getType() == WaveformType.SIGNAL) { - Object o = e.waveform.getEvents().firstEntry().getValue()[0]; + Object o = e.waveform.getEvents().firstEntry().events[0]; if(checkForDouble && o instanceof DoubleVal) return true; else if(o instanceof BitVector && ((BitVector)o).getWidth()>1) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java index be0abe4..805af8b 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java @@ -32,8 +32,8 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Text; import com.minres.scviewer.database.DataType; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; -import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.WaveformType; import com.minres.scviewer.database.tx.ITx; @@ -249,8 +249,10 @@ public class TransactionList extends Composite { }catch(SecurityException e){} updateThread = new Thread(()-> { final ConcurrentHashMap propNames=new ConcurrentHashMap<>(); - Collection values = stream.getEvents().values(); - final List txList = values.parallelStream().map(Arrays::asList) + Collection values = stream.getEvents().entrySet(); + final List txList = values.parallelStream() + .map(e->e.events) + .map(Arrays::asList) .flatMap(List::stream) .filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) .map(evt-> { diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java index d6ede73..e629583 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java @@ -815,9 +815,18 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis String trackentryName = state.get(SELECTED_TRACKENTRY_NAME); //get TrackEntry Object based on name and TX Object by id and put into selectionList trackEntries.stream().filter(e->trackentryName.equals(e.waveform.getFullName())).forEach(trackEntry -> - trackEntry.waveform.getEvents().values().stream().filter(Objects::nonNull).forEach(entries-> - Arrays.stream(entries).filter(e->e instanceof ITxEvent && txId.equals(((ITxEvent)e).getTransaction().getId())).forEach(event -> - waveformPane.setSelection(new StructuredSelection(new Object[] {((ITxEvent)event).getTransaction(), trackEntry}))))); + trackEntry.waveform.getEvents().entrySet().stream() + .map(e->e.events) + .filter(Objects::nonNull) + .forEach(entries-> + Arrays.stream(entries) + .filter(e->e instanceof ITxEvent && txId.equals(((ITxEvent)e).getTransaction().getId())) + .forEach(event -> + waveformPane.setSelection(new StructuredSelection( + new Object[] {((ITxEvent)event).getTransaction(), trackEntry})) + ) + ) + ); } catch (NumberFormatException e) { } } diff --git a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java index 35b9c93..53e02a5 100644 --- a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java +++ b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java @@ -16,13 +16,12 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.util.List; -import java.util.Map.Entry; import org.junit.After; import org.junit.Before; import org.junit.Test; -import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; @@ -50,11 +49,11 @@ public class DatabaseServicesTest { assertEquals(14, waves.size()); assertEquals(2, waveformDb.getChildNodes().size()); IWaveform bus_data_wave = waves.get(0); - Entry bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L); - assertEquals("01111000", bus_data_entry.getValue()[0].toString()); + EventEntry bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L); + assertEquals("01111000", bus_data_entry.events[0].toString()); IWaveform rw_wave = waves.get(2); - Entry rw_entry = rw_wave.getEvents().floorEntry(2360000000L); - assertEquals("1", rw_entry.getValue()[0].toString()); + EventEntry rw_entry = rw_wave.getEvents().floorEntry(2360000000L); + assertEquals("1", rw_entry.events[0].toString()); } @Test diff --git a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java new file mode 100644 index 0000000..f82faa1 --- /dev/null +++ b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java @@ -0,0 +1,198 @@ +package com.minres.scviewer.database.test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.stream.Collectors; + +import org.junit.Test; + +import com.minres.scviewer.database.EventList; +import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; + +public class EventListTest { + + EventList createList(int[] times) { + EventList list = new EventList(); + for(int time: times) + list.put(time, new IEvent[] {}); + return list; + } + + Long[] getTimestamps(IEventList list) { + return list.entrySet().stream().map(e->e.timestamp).collect(Collectors.toList()).toArray(new Long[] {}); + } + + @Test + public void testInsertion() throws Exception { + IEventList list = createList(new int[] {5, 7, 3, 6, 2, 0}); + assertEquals(6, list.size()); + assertArrayEquals(new Long[]{0L, 2L, 3L, 5L, 6L, 7L}, getTimestamps(list)); + } + + @Test + public void testSublist() throws Exception { + IEventList list = createList(new int[] {5, 7, 3, 8, 2, 0}); + { + IEventList subList = list.subMap(3, true, 5); + assertEquals(2, subList.size()); + assertArrayEquals(new Long[]{3L, 5L}, getTimestamps(subList)); + } { + IEventList subList = list.subMap(3, false, 5); + assertEquals(1, subList.size()); + assertArrayEquals(new Long[]{5L}, getTimestamps(subList)); + } { + IEventList subList = list.subMap(4, true, 6); + assertEquals(1, subList.size()); + assertArrayEquals(new Long[]{5L}, getTimestamps(subList)); + } { + IEventList subList = list.subMap(4, false, 6); + assertEquals(1, subList.size()); + assertArrayEquals(new Long[]{5L}, getTimestamps(subList)); + } { + IEventList subList = list.subMap(4, true, 9); + assertEquals(3, subList.size()); + assertArrayEquals(new Long[]{5L, 7L, 8L}, getTimestamps(subList)); + } { + IEventList subList = list.subMap(4, false, 9); + assertEquals(3, subList.size()); + assertArrayEquals(new Long[]{5L, 7L, 8L}, getTimestamps(subList)); + } + } + + @Test + public void testEntries() throws Exception { + IEventList list = createList(new int[] {2, 5, 8, 11}); + assertEquals(2, list.firstEntry().timestamp); + assertEquals(11, list.lastEntry().timestamp); + + assertNull(list.floorEntry(1)); + assertEquals(2, list.floorEntry(2).timestamp); + assertEquals(2, list.floorEntry(3).timestamp); + assertEquals(2, list.floorEntry(4).timestamp); + assertEquals(5, list.floorEntry(5).timestamp); + assertEquals(5, list.floorEntry(6).timestamp); + assertEquals(8, list.floorEntry(10).timestamp); + assertEquals(11, list.floorEntry(11).timestamp); + assertEquals(11, list.floorEntry(12).timestamp); + + assertEquals(2, list.ceilingEntry(1).timestamp); + assertEquals(2, list.ceilingEntry(2).timestamp); + assertEquals(5, list.ceilingEntry(3).timestamp); + assertEquals(5, list.ceilingEntry(4).timestamp); + assertEquals(5, list.ceilingEntry(5).timestamp); + assertEquals(8, list.ceilingEntry(6).timestamp); + assertEquals(11, list.ceilingEntry(10).timestamp); + assertEquals(11, list.ceilingEntry(11).timestamp); + assertNull(list.ceilingEntry(12)); + + assertNull(list.lowerEntry(1)); + assertNull(list.lowerEntry(2)); + assertEquals(2, list.lowerEntry(3).timestamp); + assertEquals(2, list.lowerEntry(4).timestamp); + assertEquals(2, list.lowerEntry(5).timestamp); + assertEquals(5, list.lowerEntry(6).timestamp); + assertEquals(8, list.lowerEntry(10).timestamp); + assertEquals(8, list.lowerEntry(11).timestamp); + assertEquals(11, list.lowerEntry(12).timestamp); + + assertEquals(2, list.higherEntry(1).timestamp); + assertEquals(5, list.higherEntry(2).timestamp); + assertEquals(5, list.higherEntry(3).timestamp); + assertEquals(5, list.higherEntry(4).timestamp); + assertEquals(8, list.higherEntry(5).timestamp); + assertEquals(8, list.higherEntry(6).timestamp); + assertEquals(11, list.higherEntry(10).timestamp); + assertNull(list.higherEntry(11)); + assertNull(list.higherEntry(12)); + } + + @Test + public void testSubListEntries() throws Exception { + IEventList fullList = createList(new int[] {2, 5, 8, 11}); + IEventList list = fullList.subMap(5, true, 8); + + assertEquals(5, list.firstEntry().timestamp); + assertEquals(8, list.lastEntry().timestamp); + + assertNull(list.floorEntry(1)); + assertNull(list.floorEntry(2)); + assertNull(list.floorEntry(3)); + assertNull(list.floorEntry(4)); + assertEquals(5, list.floorEntry(5).timestamp); + assertEquals(5, list.floorEntry(6).timestamp); + assertEquals(8, list.floorEntry(10).timestamp); + assertEquals(8, list.floorEntry(11).timestamp); + assertEquals(8, list.floorEntry(12).timestamp); + + assertEquals(5, list.ceilingEntry(1).timestamp); + assertEquals(5, list.ceilingEntry(2).timestamp); + assertEquals(5, list.ceilingEntry(3).timestamp); + assertEquals(5, list.ceilingEntry(4).timestamp); + assertEquals(5, list.ceilingEntry(5).timestamp); + assertEquals(8, list.ceilingEntry(6).timestamp); + assertEquals(8, list.ceilingEntry(8).timestamp); + assertNull(list.ceilingEntry(10)); + assertNull(list.ceilingEntry(11)); + assertNull(list.ceilingEntry(12)); + + assertNull(list.lowerEntry(1)); + assertNull(list.lowerEntry(2)); + assertNull(list.lowerEntry(3)); + assertNull(list.lowerEntry(4)); + assertNull(list.lowerEntry(5)); + assertEquals(5, list.lowerEntry(6).timestamp); + assertEquals(8, list.lowerEntry(10).timestamp); + assertEquals(8, list.lowerEntry(11).timestamp); + assertEquals(8, list.lowerEntry(12).timestamp); + + assertEquals(5, list.higherEntry(1).timestamp); + assertEquals(5, list.higherEntry(2).timestamp); + assertEquals(5, list.higherEntry(3).timestamp); + assertEquals(5, list.higherEntry(4).timestamp); + assertEquals(8, list.higherEntry(5).timestamp); + assertEquals(8, list.higherEntry(6).timestamp); + assertNull(list.higherEntry(8)); + assertNull(list.higherEntry(10)); + assertNull(list.higherEntry(11)); + assertNull(list.higherEntry(12)); + } + + @Test + public void testInterface() throws Exception { + EventList emptyList = new EventList(); + IEventList populatedList = createList(new int[] {0, 2, 3, 5, 6, 7}); + assertEquals(0, emptyList.size()); + assertEquals(6, populatedList.size()); + assertTrue(emptyList.isEmpty()); + assertFalse(populatedList.isEmpty()); + assertFalse(emptyList.containsKey(5)); + assertTrue(populatedList.containsKey(5)); + assertFalse(populatedList.containsKey(8)); + assertNull(emptyList.get(5)); + assertNotNull(populatedList.get(5)); + assertNull(populatedList.get(8)); + } + + @Test + public void testInterfaceSublist() throws Exception { + IEventList fullList = createList(new int[] {0, 2, 3, 5, 6, 7}); + IEventList emptyList = fullList.subMap(3, false, 4); + IEventList populatedList = fullList.subMap(2, true, 6); + assertEquals(0, emptyList.size()); + assertEquals(4, populatedList.size()); + assertTrue(emptyList.isEmpty()); + assertFalse(populatedList.isEmpty()); + assertFalse(emptyList.containsKey(5)); + assertTrue(populatedList.containsKey(5)); + assertFalse(populatedList.containsKey(8)); + assertNull(emptyList.get(5)); + assertNotNull(populatedList.get(5)); + assertNull(populatedList.get(7)); + } +} From 5df91dbaa80df12bdc2cbb127aeb5aa20d71eab4 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 13:33:15 +0000 Subject: [PATCH 04/12] adapt painter --- .../database/ui/swt/internal/SignalPainter.java | 15 +++++---------- .../database/ui/swt/internal/StreamPainter.java | 13 ++++++++----- .../minres/scviewer/database/vcd/VCDDbLoader.java | 3 ++- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java index 8bfd10a..449e884 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java @@ -101,20 +101,15 @@ public class SignalPainter extends TrackPainter { long endTime = beginTime + area.width*scaleFactor; EventEntry first = signal.getEvents().floorEntry(beginTime); - EventEntry last = signal.getEvents().floorEntry(endTime); - if (first == null) { - if (last == null) - return; + if (first == null) first = signal.getEvents().firstEntry(); - } else if (last == null) { - last = signal.getEvents().lastEntry(); - } + beginTime = first.timestamp; proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); proj.setLineStyle(SWT.LINE_SOLID); proj.setLineWidth(1); - IEventList entries = signal.getEvents().subMap(first.timestamp, false, last.timestamp); - SignalChange left = new SignalChange(first); - SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first); + IEventList entries = signal.getEvents().subMap(beginTime, true, endTime); + SignalChange left = new SignalChange(entries.firstEntry()); + SignalChange right = new SignalChange(entries.size() > 1 ? entries.higherEntry(left.time) : entries.firstEntry()); maxPosX = area.x + area.width; yOffsetT = this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y; yOffsetM = this.waveCanvas.styleProvider.getTrackHeight() / 2 + area.y; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java index 39c96f2..3e3fb28 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java @@ -19,7 +19,9 @@ import org.eclipse.swt.graphics.Rectangle; import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; +import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITxEvent; @@ -71,10 +73,11 @@ public class StreamPainter extends TrackPainter{ long beginTime = beginPos*scaleFactor; long endTime = beginTime + area.width*scaleFactor; - EventEntry firstTx=stream.getEvents().floorEntry(beginTime); - EventEntry lastTx=stream.getEvents().ceilingEntry(endTime); - if(firstTx==null) firstTx = stream.getEvents().firstEntry(); - if(lastTx==null) lastTx=stream.getEvents().lastEntry(); + IEventList events = stream.getEvents(); + EventEntry firstTx = events.floorEntry(beginTime); + EventEntry lastTx = events.ceilingEntry(endTime); + if(firstTx==null) firstTx = events.firstEntry(); + if(lastTx==null) lastTx = events.lastEntry(); proj.setFillRule(SWT.FILL_EVEN_ODD); proj.setLineStyle(SWT.LINE_SOLID); proj.setLineWidth(1); @@ -90,7 +93,7 @@ public class StreamPainter extends TrackPainter{ ITxEvent highlighed=null; proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE)); long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1; - for(EventEntry entry: stream.getEvents().subMap(firstTx.timestamp, true, lastTx.timestamp)) + for(EventEntry entry: events.subMap(firstTx.timestamp, true, lastTx.timestamp)) for(IEvent e:entry.events){ ITxEvent evt = (ITxEvent) e; ITx tx = evt.getTransaction(); 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 3a8c39f..03fbc96 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 @@ -113,7 +113,8 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { moduleStack=null; throw new InputFormatException(e.toString()); } - if(!res) throw new InputFormatException("Could not parse VCD file"); + if(!res) + throw new InputFormatException("Could not parse VCD file"); // calculate max time of this database for(IWaveform waveform:signals) { IEventList events =waveform.getEvents(); From b7301733f01feb69c23309c7e7fe9264b698ff9d Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 13:47:37 +0000 Subject: [PATCH 05/12] some more refactoring --- .../scviewer/database/sqlite/AbstractTxStream.java | 11 +---------- .../scviewer/database/text/AbstractTxStream.java | 9 +-------- .../com/minres/scviewer/database/vcd/VCDSignal.java | 10 +--------- .../com/minres/scviewer/database/EventEntry.java | 13 +++++++++++++ .../src/com/minres/scviewer/database/EventList.java | 10 +++++----- .../com/minres/scviewer/database/IEventList.java | 2 +- .../scviewer/database/test/EventListTest.java | 3 +-- 7 files changed, 23 insertions(+), 35 deletions(-) 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 2132faa..37d3c34 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 @@ -84,16 +84,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { } private void putEvent(TxEvent ev){ - Long time = ev.getTime(); - if(events.containsKey(time)) { - IEvent[] oldV = events.get(time); - IEvent[] newV = new IEvent[oldV.length+1]; - System.arraycopy(oldV, 0, newV, 0, oldV.length); - newV[oldV.length]=ev; - events.put(time, newV); - } else { - events.put(time, new IEvent[] {ev}); - } + events.put(ev.getTime(), ev); } protected abstract Map getTransactions(); 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 562de54..a5c98ac 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 @@ -73,14 +73,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @param evt the evt */ public void addEvent(ITxEvent evt) { - if (!events.containsKey(evt.getTime())) - events.put(evt.getTime(), new IEvent[] { evt }); - else { - IEvent[] evts = events.get(evt.getTime()); - IEvent[] newEvts = Arrays.copyOf(evts, evts.length + 1); - newEvts[evts.length] = evt; - events.put(evt.getTime(), newEvts); - } + events.put(evt.getTime(), evt); } /** diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java index 6bfd9fd..bb950f3 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java @@ -67,15 +67,7 @@ public class VCDSignal extends HierNode implements IWaveform { } public void addSignalChange(Long time, T value){ - if(values.containsKey(time)) { - IEvent[] oldV = values.get(time); - IEvent[] newV = new IEvent[oldV.length+1]; - System.arraycopy(oldV, 0, newV, 0, oldV.length); - newV[oldV.length]=value; - values.put(time, newV); - } else { - values.put(time, new IEvent[] {value}); - } + values.put(time, value); } @Override diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java index b719625..ac4f2f6 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventEntry.java @@ -1,5 +1,7 @@ package com.minres.scviewer.database; +import java.util.Arrays; + public class EventEntry implements Comparable{ public long timestamp; // unsigned public IEvent[] events = null; @@ -25,4 +27,15 @@ public class EventEntry implements Comparable{ public String toString() { return String.format("e.%d@%d", events.length,timestamp); } + + + public void append(IEvent value) { + if(events.length==0) + events = new IEvent[] {value}; + else { + int idx = events.length; + events = Arrays.copyOf(events, idx+1); + events[idx]=value; + } + } } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java index 74cb340..84228fd 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java @@ -1,6 +1,7 @@ package com.minres.scviewer.database; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -85,24 +86,23 @@ public class EventList implements IEventList { } @Override - public IEvent[] put(long key, IEvent[] value) { + public void put(long key, IEvent value) { if(unmodifiable) throw new UnsupportedOperationException(); - EventEntry e = new EventEntry(key, value); if(store.size()==0 || store.get(store.size()-1).timestamp < key) { - store.add(e); + store.add(new EventEntry(key, new IEvent[] {value})); } else { int index = Collections.binarySearch(store, new EventEntry(key)); // < 0 if element is not in the list, see Collections.binarySearch if (index < 0) { + EventEntry e = new EventEntry(key, new IEvent[] {value}); index = -(index + 1); store.add(index, e); } else { // Insertion index is index of existing element, to add new element behind it increase index - store.set(index, e); + store.get(index).append(value); } } end=store.size(); - return e.events; } @Override diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java index ddc2459..7561c16 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IEventList.java @@ -12,7 +12,7 @@ public interface IEventList extends Iterable { IEvent[] get(long key); - IEvent[] put(long key, IEvent[] value); + void put(long key, IEvent value); long firstKey(); diff --git a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java index f82faa1..21db15f 100644 --- a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java +++ b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/EventListTest.java @@ -12,7 +12,6 @@ import java.util.stream.Collectors; import org.junit.Test; import com.minres.scviewer.database.EventList; -import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEventList; public class EventListTest { @@ -20,7 +19,7 @@ public class EventListTest { EventList createList(int[] times) { EventList list = new EventList(); for(int time: times) - list.put(time, new IEvent[] {}); + list.put(time, null); return list; } From 45c1396e0e604111c78725034bdb8dcc8f0a23bf Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 13:59:00 +0000 Subject: [PATCH 06/12] move interface to primitive types --- .../database/sqlite/AbstractTxStream.java | 4 ++-- .../database/sqlite/SQLiteDbLoader.java | 2 +- .../minres/scviewer/database/sqlite/Tx.java | 18 +++++++++--------- .../scviewer/database/sqlite/TxEvent.java | 2 +- .../scviewer/database/sqlite/TxGenerator.java | 4 ++-- .../scviewer/database/sqlite/TxStream.java | 6 +++--- .../database/text/AbstractTxStream.java | 6 +++--- .../scviewer/database/text/TextDbLoader.java | 2 +- .../com/minres/scviewer/database/text/Tx.java | 10 +++++----- .../minres/scviewer/database/text/TxEvent.java | 2 +- .../scviewer/database/text/TxGenerator.java | 2 +- .../scviewer/database/text/TxStream.java | 2 +- .../scviewer/database/vcd/VCDDbLoader.java | 2 +- .../scviewer/database/vcd/VCDSignal.java | 8 ++++---- .../minres/scviewer/database/EventList.java | 1 - .../minres/scviewer/database/IWaveform.java | 6 +++--- .../minres/scviewer/database/IWaveformDb.java | 2 +- .../scviewer/database/IWaveformDbLoader.java | 2 +- .../scviewer/database/internal/WaveformDb.java | 4 ++-- .../com/minres/scviewer/database/tx/ITx.java | 6 +++--- .../minres/scviewer/database/tx/ITxEvent.java | 2 +- .../e4/application/parts/TransactionList.java | 2 +- .../txTableTree/AttributeLabelProvider.java | 2 +- .../ui/views/sections/RelatedProperty.java | 4 ++-- .../database/test/DatabaseServicesTest.java | 6 +++--- 25 files changed, 53 insertions(+), 54 deletions(-) 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 37d3c34..cb46eff 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 @@ -90,7 +90,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { protected abstract Map getTransactions(); @Override - public IEvent[] getEventsAtTime(Long time) { + public IEvent[] getEventsAtTime(long time) { return getEvents().get(time); } @@ -105,7 +105,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { } @Override - public IEvent[] getEventsBeforeTime(Long time) { + public IEvent[] getEventsBeforeTime(long time) { EventEntry e = events.floorEntry(time); if(e==null) return new IEvent[]{}; 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 cb13a1f..cf027af 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 @@ -48,7 +48,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader { protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); @Override - public Long getMaxTime() { + public long getMaxTime() { SQLiteDatabaseSelectHandler handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class, database, "time = (SELECT MAX(time) FROM ScvTxEvent)"); try { diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/Tx.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/Tx.java index d3ed2ec..634818b 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/Tx.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/Tx.java @@ -37,8 +37,8 @@ public class Tx implements ITx { private TxGenerator trGenerator; private ScvTx scvTx; private List attributes; - private Long begin; - private Long end; + private long begin=-1; + private long end=-1; private List incoming; private List outgoing; @@ -50,7 +50,7 @@ public class Tx implements ITx { } @Override - public Long getId() { + public long getId() { return (long) scvTx.getId(); } @@ -69,8 +69,8 @@ public class Tx implements ITx { } @Override - public Long getBeginTime() { - if(begin==null){ + public long getBeginTime() { + if(begin<0){ SQLiteDatabaseSelectHandler handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class, database, "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal()); try { @@ -85,8 +85,8 @@ public class Tx implements ITx { } @Override - public Long getEndTime() { - if(end==null){ + public long getEndTime() { + if(end<0){ SQLiteDatabaseSelectHandler handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class, database, "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal()); try { @@ -178,11 +178,11 @@ public class Tx implements ITx { @Override public int compareTo(ITx o) { - int res = this.getBeginTime().compareTo(o.getBeginTime()); + int res = Long.compare(this.getBeginTime(), o.getBeginTime()); if(res!=0) return res; else - return this.getId().compareTo(o.getId()); + return Long.compare(this.getId(), o.getId()); } @Override diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxEvent.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxEvent.java index b52bc41..14d5b6f 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxEvent.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxEvent.java @@ -28,7 +28,7 @@ public class TxEvent implements ITxEvent { } @Override - public Long getTime() { + public long getTime() { return type==EventKind.BEGIN?tx.getBeginTime():tx.getEndTime(); } diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxGenerator.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxGenerator.java index 45002a4..c773d84 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxGenerator.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxGenerator.java @@ -39,7 +39,7 @@ public class TxGenerator extends AbstractTxStream { } @Override - public Long getId() { + public long getId() { return (long) scvGenerator.getId(); } @@ -50,7 +50,7 @@ public class TxGenerator extends AbstractTxStream { @Override public boolean isSame(IWaveform other) { - return(other instanceof TxGenerator && this.getId().equals(other.getId())); + return(other instanceof TxGenerator && this.getId() == other.getId()); } @Override diff --git a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxStream.java b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxStream.java index 35da3e4..a628600 100644 --- a/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxStream.java +++ b/plugins/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/TxStream.java @@ -49,7 +49,7 @@ public class TxStream extends AbstractTxStream { } @Override - public Long getId() { + public long getId() { return (long) scvStream.getId(); } @@ -89,13 +89,13 @@ public class TxStream extends AbstractTxStream { } @Override - public IEvent[] getEventsAtTime(Long time) { + public IEvent[] getEventsAtTime(long time) { return getEvents().get(time); } @Override public boolean isSame(IWaveform other) { - return(other instanceof TxStream && this.getId().equals(other.getId())); + return(other instanceof TxStream && this.getId() == other.getId()); } @Override 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 a5c98ac..111552f 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 @@ -93,7 +93,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @return the events at time */ @Override - public IEvent[] getEventsAtTime(Long time) { + public IEvent[] getEventsAtTime(long time) { return events.get(time); } @@ -104,7 +104,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @return the events before time */ @Override - public IEvent[] getEventsBeforeTime(Long time) { + public IEvent[] getEventsBeforeTime(long time) { EventEntry e = events.floorEntry(time); if (e == null) return new IEvent[] {}; @@ -128,7 +128,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { * @return the id */ @Override - public Long getId() { + public long getId() { return id; } 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 0ec1809..c1afaa9 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 @@ -131,7 +131,7 @@ public class TextDbLoader implements IWaveformDbLoader { * @return the max time */ @Override - public Long getMaxTime() { + public long getMaxTime() { return maxTime; } diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/Tx.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/Tx.java index 9b1b9d6..88af0bf 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/Tx.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/Tx.java @@ -102,11 +102,11 @@ class Tx implements ITx { */ @Override public int compareTo(ITx o) { - int res = getBeginTime().compareTo(o.getBeginTime()); + int res = Long.compare(getBeginTime(), o.getBeginTime()); if (res != 0) return res; else - return getId().compareTo(o.getId()); + return Long.compare(getId(), o.getId()); } /** @@ -150,7 +150,7 @@ class Tx implements ITx { * @return the id */ @Override - public Long getId() { + public long getId() { return getScvTx().id; } @@ -180,7 +180,7 @@ class Tx implements ITx { * @return the begin time */ @Override - public Long getBeginTime() { + public long getBeginTime() { if (beginTime < 0) { ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx(); beginTime = tx.beginTime; @@ -195,7 +195,7 @@ class Tx implements ITx { * @return the end time */ @Override - public Long getEndTime() { + public long getEndTime() { if (endTime < 0) { ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx(); beginTime = tx.beginTime; diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxEvent.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxEvent.java index 5758e8e..607b25f 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxEvent.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxEvent.java @@ -95,7 +95,7 @@ class TxEvent implements ITxEvent { * @return the time */ @Override - public Long getTime() { + public long getTime() { return time; } diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java index a6597d1..3dbd7e4 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java @@ -52,7 +52,7 @@ class TxGenerator extends AbstractTxStream { */ @Override public boolean isSame(IWaveform other) { - return (other instanceof TxGenerator && this.getId().equals(other.getId())); + return (other instanceof TxGenerator && this.getId()==other.getId()); } /** diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxStream.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxStream.java index 47e8112..2b07cad 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxStream.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxStream.java @@ -42,7 +42,7 @@ class TxStream extends AbstractTxStream { */ @Override public boolean isSame(IWaveform other) { - return (other instanceof TxStream && this.getId().equals(other.getId())); + return (other instanceof TxStream && this.getId() == other.getId()); } /** 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 03fbc96..1bf27e9 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 @@ -146,7 +146,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { * @see com.minres.scviewer.database.ITrDb#getMaxTime() */ @Override - public Long getMaxTime() { + public long getMaxTime() { return maxTime; } diff --git a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java index bb950f3..68b0127 100644 --- a/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java +++ b/plugins/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java @@ -62,7 +62,7 @@ public class VCDSignal extends HierNode implements IWaveform { } @Override - public Long getId() { + public long getId() { return id; } @@ -76,12 +76,12 @@ public class VCDSignal extends HierNode implements IWaveform { } @Override - public IEvent[] getEventsAtTime(Long time) { + public IEvent[] getEventsAtTime(long time) { return values.get(time); } @Override - public IEvent[] getEventsBeforeTime(Long time) { + public IEvent[] getEventsBeforeTime(long time) { EventEntry e = values.floorEntry(time); if(e==null) return new IEvent[] {}; @@ -91,7 +91,7 @@ public class VCDSignal extends HierNode implements IWaveform { @Override public boolean isSame(IWaveform other) { - return( other instanceof VCDSignal && this.getId().equals(other.getId())); + return( other instanceof VCDSignal && this.getId() == other.getId()); } @Override diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java index 84228fd..c5a7fea 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/EventList.java @@ -1,7 +1,6 @@ package com.minres.scviewer.database; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java index ef3b2ee..a558c1b 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveform.java @@ -24,7 +24,7 @@ public interface IWaveform extends IHierNode { * * @return the id */ - public Long getId(); + public long getId(); /** * Checks if is same. @@ -47,7 +47,7 @@ public interface IWaveform extends IHierNode { * @param time the time * @return the events at time */ - public IEvent[] getEventsAtTime(Long time); + public IEvent[] getEventsAtTime(long time); /** * Gets the events before time. @@ -55,7 +55,7 @@ public interface IWaveform extends IHierNode { * @param time the time * @return the events before time */ - public IEvent[] getEventsBeforeTime(Long time); + public IEvent[] getEventsBeforeTime(long time); /** * Gets the type. diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java index f4e60fa..3534a9a 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java @@ -23,7 +23,7 @@ public interface IWaveformDb extends IHierNode { * * @return the max time */ - public Long getMaxTime(); + public long getMaxTime(); /** * Gets the stream by name. diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDbLoader.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDbLoader.java index 740f6cf..3a56058 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDbLoader.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDbLoader.java @@ -69,7 +69,7 @@ public interface IWaveformDbLoader { * * @return the max time */ - public Long getMaxTime(); + public long getMaxTime(); /** * Gets the all waves. diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java index c4d829f..49aaf4a 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java @@ -45,7 +45,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL private Map waveforms; /** The max time. */ - private Long maxTime; + private long maxTime = -1; /** * Bind. @@ -90,7 +90,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL * @return the max time */ @Override - public Long getMaxTime() { + public long getMaxTime() { return maxTime; } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITx.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITx.java index f539270..c9c69a5 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITx.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITx.java @@ -25,7 +25,7 @@ public interface ITx extends Comparable { * * @return the id */ - public Long getId(); + public long getId(); /** * Gets the stream. @@ -46,14 +46,14 @@ public interface ITx extends Comparable { * * @return the begin time */ - public Long getBeginTime(); + public long getBeginTime(); /** * Gets the end time. * * @return the end time */ - public Long getEndTime(); + public long getEndTime(); /** * Gets the attributes. diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITxEvent.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITxEvent.java index 9f417a9..2bd5f33 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITxEvent.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/tx/ITxEvent.java @@ -22,7 +22,7 @@ public interface ITxEvent extends IEvent { * * @return the time */ - public Long getTime(); + public long getTime(); /** * Gets the transaction. diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java index 805af8b..1bfa169 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java @@ -260,7 +260,7 @@ public class TransactionList extends Composite { tx.getAttributes().forEach(attr -> propNames.put(attr.getName(), attr.getDataType())); return tx; }) - .sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime())) + .sorted((t1, t2)-> Long.compare(t1.getBeginTime(),t2.getBeginTime())) .collect(Collectors.toList()); final List newAttrNames=propNames.entrySet().stream() .sorted((e1,e2)->e1.getKey().compareTo(e2.getKey())) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java index 10e4b33..9daf7bf 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java @@ -69,7 +69,7 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe ITx iTx = (ITx) element; switch(field){ case NAME: - return new StyledString(iTx.getId().toString()); + return new StyledString(String.format("%d", iTx.getId())); case TX_TIME: return new StyledString(waveformViewerPart.getScaledTime(iTx.getBeginTime())); case TYPE: diff --git a/plugins/com.minres.scviewer.ui/src/com/minres/scviewer/ui/views/sections/RelatedProperty.java b/plugins/com.minres.scviewer.ui/src/com/minres/scviewer/ui/views/sections/RelatedProperty.java index 1833506..4ae1ecf 100644 --- a/plugins/com.minres.scviewer.ui/src/com/minres/scviewer/ui/views/sections/RelatedProperty.java +++ b/plugins/com.minres.scviewer.ui/src/com/minres/scviewer/ui/views/sections/RelatedProperty.java @@ -182,9 +182,9 @@ public class RelatedProperty extends AbstractPropertySection implements ISelecti else if (columnIndex == 2 && element instanceof ITxRelation){ ITxRelation rel = (ITxRelation) element; if(rel.getTarget()==iTr) - return ((ITxRelation) element).getSource().getId().toString(); + return String.format("%d", ((ITxRelation) element).getSource().getId()); else - return ((ITxRelation) element).getTarget().getId().toString(); + return String.format("%d", ((ITxRelation) element).getTarget().getId()); } else return null; diff --git a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java index 53e02a5..21c3ac4 100644 --- a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java +++ b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java @@ -76,11 +76,11 @@ public class DatabaseServicesTest { assertEquals(3, waveforms.size()); assertEquals(1, waveformDb.getChildNodes().size()); for(IWaveform w:waveforms) { - if(w.getId().equals(1l)) { + if(w.getId()==1) { assertEquals(2, w.getRowCount()); - } else if(w.getId().equals(2l)) { + } else if(w.getId()==2l) { assertEquals(1, w.getRowCount()); - } else if(w.getId().equals(3l)) { + } else if(w.getId()==3l) { assertEquals(1, w.getRowCount()); } } From d1b3a91979dd842737be218cd8158305da3d86a8 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 14:00:29 +0000 Subject: [PATCH 07/12] fix warning and left-overs --- .../src/com/minres/scviewer/database/text/AbstractTxStream.java | 1 - .../minres/scviewer/database/ui/swt/internal/StreamPainter.java | 1 - plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF | 1 - 3 files changed, 3 deletions(-) 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 111552f..4ea449d 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 @@ -12,7 +12,6 @@ package com.minres.scviewer.database.text; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import com.minres.scviewer.database.EventEntry; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java index 3e3fb28..75780da 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java @@ -19,7 +19,6 @@ import org.eclipse.swt.graphics.Rectangle; import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventKind; -import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IWaveform; diff --git a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF index ce92e9f..952a33d 100644 --- a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF @@ -10,4 +10,3 @@ Export-Package: com.minres.scviewer.database, Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml Automatic-Module-Name: com.minres.scviewer.database -Require-Bundle: org.eclipse.collections;bundle-version="10.4.0" From d0e1e8801f2cfc3ca830ccbf0886167d557934b6 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 19:13:17 +0000 Subject: [PATCH 08/12] update version numbers --- features/com.minres.scviewer.database.feature/pom.xml | 2 +- features/com.minres.scviewer.feature/pom.xml | 2 +- plugins/com.minres.scviewer.database.sqlite/pom.xml | 2 +- .../com.minres.scviewer.database.text/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.database.text/pom.xml | 4 ++-- .../com.minres.scviewer.database.ui.swt/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.database.ui.swt/pom.xml | 4 ++-- plugins/com.minres.scviewer.database.vcd/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.database.vcd/pom.xml | 4 ++-- plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.database/pom.xml | 4 ++-- .../com.minres.scviewer.e4.application/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.e4.application/pom.xml | 2 +- plugins/com.minres.scviewer.ui/pom.xml | 2 +- pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/scviewer.product | 2 +- releng/com.minres.scviewer.target/pom.xml | 2 +- releng/com.minres.scviewer.updateSite/pom.xml | 2 +- tests/com.minres.scviewer.database.test/META-INF/MANIFEST.MF | 2 +- tests/com.minres.scviewer.database.test/pom.xml | 4 ++-- 21 files changed, 28 insertions(+), 28 deletions(-) diff --git a/features/com.minres.scviewer.database.feature/pom.xml b/features/com.minres.scviewer.database.feature/pom.xml index a71c197..ea25b11 100644 --- a/features/com.minres.scviewer.database.feature/pom.xml +++ b/features/com.minres.scviewer.database.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. 3.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.feature/pom.xml b/features/com.minres.scviewer.feature/pom.xml index 9263cb2..ad64afc 100644 --- a/features/com.minres.scviewer.feature/pom.xml +++ b/features/com.minres.scviewer.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. 1.1.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.sqlite/pom.xml b/plugins/com.minres.scviewer.database.sqlite/pom.xml index 93d5a94..5df3451 100644 --- a/plugins/com.minres.scviewer.database.sqlite/pom.xml +++ b/plugins/com.minres.scviewer.database.sqlite/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.text/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database.text/META-INF/MANIFEST.MF index 34b35ae..5c2244e 100644 --- a/plugins/com.minres.scviewer.database.text/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database.text/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Textual transaction database Bundle-SymbolicName: com.minres.scviewer.database.text -Bundle-Version: 3.0.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.osgi.framework;version="1.3.0" diff --git a/plugins/com.minres.scviewer.database.text/pom.xml b/plugins/com.minres.scviewer.database.text/pom.xml index 67c7bd8..d3971c3 100644 --- a/plugins/com.minres.scviewer.database.text/pom.xml +++ b/plugins/com.minres.scviewer.database.text/pom.xml @@ -2,11 +2,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.minres.scviewer.database.text - 3.0.0-SNAPSHOT + 4.0.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.ui.swt/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database.ui.swt/META-INF/MANIFEST.MF index ab9940b..a00e2e4 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database.ui.swt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SWT database widget Bundle-SymbolicName: com.minres.scviewer.database.ui.swt -Bundle-Version: 3.0.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.swt;bundle-version="3.103.1", diff --git a/plugins/com.minres.scviewer.database.ui.swt/pom.xml b/plugins/com.minres.scviewer.database.ui.swt/pom.xml index bd0c939..836a34a 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/pom.xml +++ b/plugins/com.minres.scviewer.database.ui.swt/pom.xml @@ -5,8 +5,8 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. - 3.0.0-SNAPSHOT + 4.0.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.vcd/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database.vcd/META-INF/MANIFEST.MF index d973f97..7a1dbaf 100644 --- a/plugins/com.minres.scviewer.database.vcd/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database.vcd/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: VCD signal database Bundle-SymbolicName: com.minres.scviewer.database.vcd -Bundle-Version: 2.2.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0", diff --git a/plugins/com.minres.scviewer.database.vcd/pom.xml b/plugins/com.minres.scviewer.database.vcd/pom.xml index 0dfde7f..dfad617 100644 --- a/plugins/com.minres.scviewer.database.vcd/pom.xml +++ b/plugins/com.minres.scviewer.database.vcd/pom.xml @@ -1,11 +1,11 @@ 4.0.0 com.minres.scviewer.database.vcd - 2.2.0-SNAPSHOT + 4.0.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF index 952a33d..0b7dec7 100644 --- a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Waveform database Bundle-SymbolicName: com.minres.scviewer.database -Bundle-Version: 3.0.0.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.minres.scviewer.database, diff --git a/plugins/com.minres.scviewer.database/pom.xml b/plugins/com.minres.scviewer.database/pom.xml index aa6fdb0..ac9aa04 100644 --- a/plugins/com.minres.scviewer.database/pom.xml +++ b/plugins/com.minres.scviewer.database/pom.xml @@ -4,9 +4,9 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin - 3.0.0-SNAPSHOT + 4.0.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index 5faa250..b1d0326 100644 --- a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true -Bundle-Version: 2.12.2 +Bundle-Version: 2.13.0 Bundle-Vendor: %Bundle-Vendor Require-Bundle: javax.inject;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.11.1", diff --git a/plugins/com.minres.scviewer.e4.application/pom.xml b/plugins/com.minres.scviewer.e4.application/pom.xml index 425998b..f81be42 100644 --- a/plugins/com.minres.scviewer.e4.application/pom.xml +++ b/plugins/com.minres.scviewer.e4.application/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.ui/pom.xml b/plugins/com.minres.scviewer.ui/pom.xml index 13dccec..79856d2 100644 --- a/plugins/com.minres.scviewer.ui/pom.xml +++ b/plugins/com.minres.scviewer.ui/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-plugin diff --git a/pom.xml b/pom.xml index 60594b7..ed8eb1e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 pom releng/com.minres.scviewer.target @@ -67,7 +67,7 @@ com.minres.scviewer com.minres.scviewer.target - 2.12.2 + 2.13.0 diff --git a/products/com.minres.scviewer.e4.product/pom.xml b/products/com.minres.scviewer.e4.product/pom.xml index be0b7c4..fea2e34 100644 --- a/products/com.minres.scviewer.e4.product/pom.xml +++ b/products/com.minres.scviewer.e4.product/pom.xml @@ -6,11 +6,11 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. com.minres.scviewer.e4.product - 2.12.2 + 2.13.0 eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index a821eb7..b35d3c8 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + diff --git a/releng/com.minres.scviewer.target/pom.xml b/releng/com.minres.scviewer.target/pom.xml index 3e05b67..0edf361 100644 --- a/releng/com.minres.scviewer.target/pom.xml +++ b/releng/com.minres.scviewer.target/pom.xml @@ -12,7 +12,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. diff --git a/releng/com.minres.scviewer.updateSite/pom.xml b/releng/com.minres.scviewer.updateSite/pom.xml index 1a6e8a5..131bd9c 100644 --- a/releng/com.minres.scviewer.updateSite/pom.xml +++ b/releng/com.minres.scviewer.updateSite/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. diff --git a/tests/com.minres.scviewer.database.test/META-INF/MANIFEST.MF b/tests/com.minres.scviewer.database.test/META-INF/MANIFEST.MF index e7011d3..514f11a 100644 --- a/tests/com.minres.scviewer.database.test/META-INF/MANIFEST.MF +++ b/tests/com.minres.scviewer.database.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SCViewer database tests Bundle-SymbolicName: com.minres.scviewer.database.test -Bundle-Version: 1.0.1.qualifier +Bundle-Version: 4.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: com.minres.scviewer.database, diff --git a/tests/com.minres.scviewer.database.test/pom.xml b/tests/com.minres.scviewer.database.test/pom.xml index 7e2f7f9..9058cff 100644 --- a/tests/com.minres.scviewer.database.test/pom.xml +++ b/tests/com.minres.scviewer.database.test/pom.xml @@ -2,11 +2,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.minres.scviewer.database.test - 1.0.1-SNAPSHOT + 4.0.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. eclipse-test-plugin From 0135631a3ed2f52c76bb8e5a671aa11e1586d26b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 27 Feb 2021 19:13:28 +0000 Subject: [PATCH 09/12] update version numbers --- features/com.minres.scviewer.e4.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.platform.feature/pom.xml | 2 +- features/com.minres.scviewer.ui.feature/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/com.minres.scviewer.e4.feature/pom.xml b/features/com.minres.scviewer.e4.feature/pom.xml index 85349da..d57ec1c 100644 --- a/features/com.minres.scviewer.e4.feature/pom.xml +++ b/features/com.minres.scviewer.e4.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.platform.feature/pom.xml b/features/com.minres.scviewer.e4.platform.feature/pom.xml index 0488e5b..5dbe3e1 100644 --- a/features/com.minres.scviewer.e4.platform.feature/pom.xml +++ b/features/com.minres.scviewer.e4.platform.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.ui.feature/pom.xml b/features/com.minres.scviewer.ui.feature/pom.xml index 191d165..a39b1bc 100644 --- a/features/com.minres.scviewer.ui.feature/pom.xml +++ b/features/com.minres.scviewer.ui.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.12.2 + 2.13.0 ../.. 1.1.0-SNAPSHOT From f337a9411267db46736fd20cdc2830d0858fa88c Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 2 Mar 2021 19:32:09 +0100 Subject: [PATCH 10/12] fix full name display of generators --- .../minres/scviewer/database/text/TextDbLoader.java | 4 +++- .../com/minres/scviewer/database/text/TxGenerator.java | 10 ++++++++++ .../minres/scviewer/database/internal/WaveformDb.java | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) 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 c1afaa9..855d9c3 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 @@ -167,7 +167,9 @@ public class TextDbLoader implements IWaveformDbLoader { */ @Override public Collection getAllWaves() { - return new ArrayList<>(txStreams.values()); + ArrayList ret = new ArrayList<>(txStreams.values()); + ret.addAll(txGenerators.values()); + return ret; } /** diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java index 3dbd7e4..64c4b3f 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TxGenerator.java @@ -82,5 +82,15 @@ class TxGenerator extends AbstractTxStream { public String getKind() { return stream.getKind(); } + + /** + * Gets the full hierarchical name. + * + * @return the full name + */ + @Override + public String getFullName() { + return ((AbstractTxStream)parent).getFullName()+"."+name; + } } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java index 49aaf4a..3331e36 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java @@ -189,6 +189,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL if (IWaveformDbLoader.SIGNAL_ADDED.equals(evt.getPropertyName()) || IWaveformDbLoader.STREAM_ADDED.equals(evt.getPropertyName())) { IWaveform waveform = (IWaveform) evt.getNewValue(); + waveforms.put(waveform.getFullName(), waveform); putInHierarchy(waveform); pcs.firePropertyChange(IHierNode.WAVEFORMS, null, waveforms); pcs.firePropertyChange(IHierNode.CHILDS, null, childNodes); From 6ab8fd232e6538c4cffa3c5f84c05a803be55f0b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 2 Mar 2021 19:32:21 +0100 Subject: [PATCH 11/12] fix CLI handling --- .../minres/scviewer/e4/application/E4LifeCycle.java | 2 ++ .../scviewer/e4/application/parts/WaveformViewer.java | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java index 812260c..be6d932 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java @@ -61,6 +61,8 @@ public class E4LifeCycle { final Options opt = new Options(args, 0, Integer.MAX_VALUE); opt.getSet() .addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE) + .addOption("launcher.defaultAction", Separator.BLANK, Multiplicity.ZERO_OR_ONE) + .addOption("launcher.openFile", Multiplicity.ZERO_OR_ONE) .addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE); if (!opt.check(Options.DEFAULT_SET, true, false)) { logger.error(opt.getCheckErrors()); diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java index e629583..54e71b3 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java @@ -577,7 +577,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis } else sync.asyncExec(()->{ waveformPane.setMaxTime(database.getMaxTime()); - if (state != null) + if(partConfig!=null && !partConfig.isEmpty()) + loadState(partConfig); + if (state != null && !state.isEmpty()) restoreWaveformViewerState(state); fileChecker = null; if (checkForUpdates) @@ -630,13 +632,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis if (file.exists()) filesToLoad.add(file); } - if(partConfig!=null) { - this.partConfig=partConfig; - } + this.partConfig=partConfig; if (!filesToLoad.isEmpty()) loadDatabase(persistedState); - if(partConfig!=null && !partConfig.isEmpty()) - loadState(partConfig); } /** From 64b10970a8a45f3306ba03bac64e3e71c6fc390b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 2 Mar 2021 21:42:54 +0100 Subject: [PATCH 12/12] add gzip files to file dialog filter --- .../src/com/minres/scviewer/e4/application/messages.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index ca29482..27b8b44 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -9,7 +9,7 @@ DesignBrowser_8=Insert before LoadingWaveformDb_0=Database loading... LoadStoreSettingsHandler_2=*.scview LoadStoreSettingsHandler_3=SCViewer.scview -OpenHandler_0=*.vcd;*.txdb;*.txlog;*.fbrdb +OpenHandler_0=*.vcd;*.vcd.gz;*.txdb;*.txdb.gz;*.txlog;*.fbrdb QuitHandler_0=Confirmation QuitHandler_1=Do you want to exit? RelationTypeToolControl_0=------------