Merge branch 'release/2.12.0'
This commit is contained in:
commit
5604c3ee5e
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -39,14 +39,14 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
|
||||
private List<RelationType> usedRelationsList;
|
||||
|
||||
public AbstractTxStream(IDatabase database, String name, long streamId) {
|
||||
protected AbstractTxStream(IDatabase database, String name, long streamId) {
|
||||
super(name);
|
||||
this.database=database;
|
||||
this.streamId=streamId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
public int getRowCount() {
|
||||
if(maxConcurrency==null){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
|
||||
|
@ -126,4 +126,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
public void calculateConcurrency() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -99,7 +99,6 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||
|
||||
@Override
|
||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||
dispose();
|
||||
database=new SQLiteDatabase(file.getAbsolutePath(), db);
|
||||
database.setData("TIMERESOLUTION", 1L);
|
||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
||||
|
|
|
@ -28,7 +28,6 @@ import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
|||
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
|
||||
public class Tx implements ITx {
|
||||
|
@ -61,12 +60,11 @@ public class Tx implements ITx {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITxGenerator getGenerator() {
|
||||
public IWaveform getGenerator() {
|
||||
return trGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConcurrencyIndex() {
|
||||
int getConcurrencyIndex() {
|
||||
return scvTx.getConcurrencyLevel();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,4 +56,10 @@ public class TxEvent implements ITxEvent {
|
|||
public WaveformType getType() {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowIndex() {
|
||||
return ((Tx)tx).getConcurrencyIndex();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,9 +22,8 @@ import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
|||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
public class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
public class TxGenerator extends AbstractTxStream {
|
||||
|
||||
private TxStream stream;
|
||||
|
||||
|
@ -44,11 +43,6 @@ public class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
|||
return (long) scvGenerator.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return scvGenerator.getName();
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
|||
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
public class TxStream extends AbstractTxStream {
|
||||
|
||||
|
@ -54,7 +53,7 @@ public class TxStream extends AbstractTxStream {
|
|||
return (long) scvStream.getId();
|
||||
}
|
||||
|
||||
public List<ITxGenerator> getGenerators() {
|
||||
public List<IWaveform> getGenerators() {
|
||||
if(generators==null){
|
||||
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<>(
|
||||
ScvGenerator.class, database, "stream="+scvStream.getId());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -13,15 +13,16 @@ package com.minres.scviewer.database.text;
|
|||
|
||||
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.EventKind;
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
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;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +39,8 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
/** The events. */
|
||||
TreeMap<Long, IEvent[]> events = new TreeMap<>();
|
||||
|
||||
/** The concurrency calculated. */
|
||||
boolean concurrencyCalculated = false;
|
||||
/** The max concurrency. */
|
||||
private int rowCount = -1;
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract tx stream.
|
||||
|
@ -48,7 +49,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
* @param id the id
|
||||
* @param name the name
|
||||
*/
|
||||
public AbstractTxStream(TextDbLoader loader, Long id, String name) {
|
||||
protected AbstractTxStream(TextDbLoader loader, Long id, String name) {
|
||||
super(name);
|
||||
this.loader = loader;
|
||||
this.id = id;
|
||||
|
@ -77,8 +78,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
*/
|
||||
@Override
|
||||
public NavigableMap<Long, IEvent[]> getEvents() {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
return events;
|
||||
}
|
||||
|
||||
|
@ -90,8 +89,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
*/
|
||||
@Override
|
||||
public IEvent[] getEventsAtTime(Long time) {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
return events.get(time);
|
||||
}
|
||||
|
||||
|
@ -103,8 +100,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
*/
|
||||
@Override
|
||||
public IEvent[] getEventsBeforeTime(Long time) {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
Entry<Long, IEvent[]> e = events.floorEntry(time);
|
||||
if (e == null)
|
||||
return new IEvent[] {};
|
||||
|
@ -132,28 +127,59 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
|||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
if (rowCount<0)
|
||||
calculateConcurrency();
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
synchronized void calculateConcurrency() {
|
||||
if (concurrencyCalculated)
|
||||
void calculateConcurrency() {
|
||||
if (rowCount>=0)
|
||||
return;
|
||||
ArrayList<Long> rowendtime = new ArrayList<>();
|
||||
events.entrySet().stream().forEach(entry -> {
|
||||
IEvent[] values = entry.getValue();
|
||||
Arrays.asList(values).stream().filter(e -> e.getKind() == EventKind.BEGIN).forEach(evt -> {
|
||||
Tx tx = (Tx) ((TxEvent) evt).getTransaction();
|
||||
ArrayList<Long> rowEndTime = new ArrayList<>();
|
||||
HashMap<Long, Integer> rowByTxId = new HashMap<>();
|
||||
for(Entry<Long, IEvent[]> entry: events.entrySet()) {
|
||||
for(IEvent evt:entry.getValue()) {
|
||||
TxEvent txEvt = (TxEvent) evt;
|
||||
ITx tx = txEvt.getTransaction();
|
||||
int rowIdx = 0;
|
||||
for (; rowIdx < rowendtime.size() && rowendtime.get(rowIdx) > tx.getBeginTime(); rowIdx++)
|
||||
;
|
||||
if (rowendtime.size() <= rowIdx)
|
||||
rowendtime.add(tx.getEndTime());
|
||||
else
|
||||
rowendtime.set(rowIdx, tx.getEndTime());
|
||||
tx.setConcurrencyIndex(rowIdx);
|
||||
});
|
||||
});
|
||||
concurrencyCalculated = true;
|
||||
switch(evt.getKind()) {
|
||||
case END:
|
||||
Long txId = txEvt.getTransaction().getId();
|
||||
txEvt.setConcurrencyIndex(rowByTxId.get(txId));
|
||||
rowByTxId.remove(txId);
|
||||
break;
|
||||
case SINGLE:
|
||||
for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++);
|
||||
if (rowEndTime.size() <= rowIdx)
|
||||
rowEndTime.add(tx.getEndTime());
|
||||
else
|
||||
rowEndTime.set(rowIdx, tx.getEndTime());
|
||||
((TxEvent) evt).setConcurrencyIndex(rowIdx);
|
||||
break;
|
||||
case BEGIN:
|
||||
for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++);
|
||||
if (rowEndTime.size() <= rowIdx)
|
||||
rowEndTime.add(tx.getEndTime());
|
||||
else
|
||||
rowEndTime.set(rowIdx, tx.getEndTime());
|
||||
((TxEvent) evt).setConcurrencyIndex(rowIdx);
|
||||
rowByTxId.put(tx.getId(), rowIdx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rowCount=rowEndTime.size()>0?rowEndTime.size():1;
|
||||
getChildNodes().parallelStream().forEach(c -> ((TxGenerator)c).calculateConcurrency());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,14 +28,13 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
|
||||
import org.mapdb.DB;
|
||||
import org.mapdb.DB.HashMapMaker;
|
||||
import org.mapdb.DB.TreeMapSink;
|
||||
import org.mapdb.DBMaker;
|
||||
import org.mapdb.HTreeMap;
|
||||
import org.mapdb.Serializer;
|
||||
|
@ -106,6 +105,26 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
/** The Constant x. */
|
||||
static final byte[] x = "scv_tr_stream".getBytes();
|
||||
|
||||
/**
|
||||
* Adds the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max time.
|
||||
*
|
||||
|
@ -116,8 +135,29 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
return maxTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transaction.
|
||||
*
|
||||
* @param txId the tx id
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction(long txId) {
|
||||
if (txCache.containsKey(txId))
|
||||
return txCache.get(txId);
|
||||
if(transactions.containsKey(txId)) {
|
||||
Tx tx = new Tx(this, transactions.get(txId));
|
||||
txCache.put(txId, tx);
|
||||
return tx;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public ScvTx getScvTx(long id) {
|
||||
return transactions.get(id);
|
||||
if(transactions.containsKey(id))
|
||||
return transactions.get(id);
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,6 +170,15 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
return new ArrayList<>(txStreams.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all relation types.
|
||||
*
|
||||
* @return the all relation types
|
||||
*/
|
||||
public Collection<RelationType> getAllRelationTypes() {
|
||||
return relationTypes.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can load.
|
||||
*
|
||||
|
@ -156,6 +205,22 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is gzipped.
|
||||
*
|
||||
* @param f the f
|
||||
* @return true, if is gzipped
|
||||
*/
|
||||
private static boolean isGzipped(File f) {
|
||||
try (InputStream is = new FileInputStream(f)) {
|
||||
byte[] signature = new byte[2];
|
||||
int nread = is.read(signature); // read the gzip signature
|
||||
return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
|
@ -188,28 +253,14 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
TextDbParser parser = new TextDbParser(this);
|
||||
try {
|
||||
|
||||
// parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
|
||||
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
|
||||
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
||||
// transactions = parser.txSink.create();
|
||||
transactions = parser.txSink;
|
||||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
|
||||
} catch (Exception e) {
|
||||
throw new InputFormatException(e.toString());
|
||||
}
|
||||
for (TxStream stream : txStreams.values()) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
stream.calculateConcurrency();
|
||||
} catch (Exception e) {
|
||||
/* don't let exceptions bubble up */ }
|
||||
}
|
||||
};
|
||||
threads.add(t);
|
||||
t.start();
|
||||
}
|
||||
txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,31 +282,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is gzipped.
|
||||
*
|
||||
* @param f the f
|
||||
* @return true, if is gzipped
|
||||
*/
|
||||
private static boolean isGzipped(File f) {
|
||||
try (InputStream is = new FileInputStream(f)) {
|
||||
byte[] signature = new byte[2];
|
||||
int nread = is.read(signature); // read the gzip signature
|
||||
return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all relation types.
|
||||
*
|
||||
* @return the all relation types
|
||||
*/
|
||||
public Collection<RelationType> getAllRelationTypes() {
|
||||
return relationTypes.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TextDbParser.
|
||||
*/
|
||||
|
@ -321,6 +347,11 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
}
|
||||
if (curLine != null)
|
||||
parseLine(curLine, nextLine);
|
||||
for(Entry<Long, ScvTx> e: transactionById.entrySet()) {
|
||||
ScvTx scvTx = e.getValue();
|
||||
scvTx.endTime=loader.maxTime;
|
||||
txSink.put(e.getKey(), scvTx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,8 +399,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
|
||||
Long.parseLong(tokens[3]) * stringToScale(tokens[4]));
|
||||
loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime;
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
stream.setConcurrency(stream.getConcurrency() + 1);
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
|
@ -391,18 +420,14 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
TxEvent evt = new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime);
|
||||
stream.addEvent(evt);
|
||||
gen.addEvent(evt);
|
||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
} else {
|
||||
TxEvent begEvt = new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime);
|
||||
stream.addEvent(begEvt);
|
||||
gen.addEvent(begEvt);
|
||||
TxEvent endEvt = new TxEvent(loader, EventKind.END, id, scvTx.endTime);
|
||||
stream.addEvent(endEvt);
|
||||
gen.addEvent(endEvt);
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
}
|
||||
stream.setConcurrency(stream.getConcurrency() - 1);
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
|
@ -521,38 +546,4 @@ public class TextDbLoader implements IWaveformDbLoader {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transaction.
|
||||
*
|
||||
* @param txId the tx id
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction(long txId) {
|
||||
if (txCache.containsKey(txId))
|
||||
return txCache.get(txId);
|
||||
Tx tx = new Tx(this, txId);
|
||||
txCache.put(txId, tx);
|
||||
return tx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.stream.Collectors;
|
|||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
|
||||
/**
|
||||
|
@ -29,9 +28,15 @@ class Tx implements ITx {
|
|||
|
||||
/** The loader. */
|
||||
private final TextDbLoader loader;
|
||||
|
||||
private ScvTx scvTx =null;
|
||||
|
||||
/** The id. */
|
||||
private long id;
|
||||
private final long id;
|
||||
|
||||
private final long generatorId;
|
||||
|
||||
private final long streamId;
|
||||
|
||||
/** The begin time. */
|
||||
long beginTime = -1;
|
||||
|
@ -39,9 +44,6 @@ class Tx implements ITx {
|
|||
/** The end time. */
|
||||
long endTime = -1;
|
||||
|
||||
/** The concurrency index. */
|
||||
private int concurrencyIndex;
|
||||
|
||||
/**
|
||||
* Instantiates a new tx.
|
||||
*
|
||||
|
@ -51,6 +53,10 @@ class Tx implements ITx {
|
|||
public Tx(TextDbLoader loader, ScvTx scvTx) {
|
||||
this.loader = loader;
|
||||
id = scvTx.id;
|
||||
generatorId=scvTx.generatorId;
|
||||
streamId=scvTx.streamId;
|
||||
beginTime=scvTx.beginTime;
|
||||
endTime=scvTx.endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,9 +65,11 @@ class Tx implements ITx {
|
|||
* @param loader the loader
|
||||
* @param txId the tx id
|
||||
*/
|
||||
public Tx(TextDbLoader loader, long txId) {
|
||||
public Tx(TextDbLoader loader, long id, long generatorId, long streamId) {
|
||||
this.loader = loader;
|
||||
id = txId;
|
||||
this.id = id;
|
||||
this.generatorId=generatorId;
|
||||
this.streamId = streamId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +121,7 @@ class Tx implements ITx {
|
|||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
return this.loader.getScvTx(id).equals(((Tx) obj).loader.getScvTx(id));
|
||||
return this.getScvTx().equals(((Tx) obj).getScvTx());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,7 +131,7 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return loader.getScvTx(id).hashCode();
|
||||
return getScvTx().hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,7 +151,7 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public Long getId() {
|
||||
return loader.getScvTx(id).id;
|
||||
return getScvTx().id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +161,7 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return loader.txStreams.get(loader.getScvTx(id).streamId);
|
||||
return loader.txStreams.get(streamId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,8 +170,8 @@ class Tx implements ITx {
|
|||
* @return the generator
|
||||
*/
|
||||
@Override
|
||||
public ITxGenerator getGenerator() {
|
||||
return loader.txGenerators.get(loader.getScvTx(id).generatorId);
|
||||
public IWaveform getGenerator() {
|
||||
return loader.txGenerators.get(generatorId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,8 +181,11 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public Long getBeginTime() {
|
||||
if (beginTime < 0)
|
||||
beginTime = loader.getScvTx(id).beginTime;
|
||||
if (beginTime < 0) {
|
||||
ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx();
|
||||
beginTime = tx.beginTime;
|
||||
endTime = tx.endTime;
|
||||
}
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
|
@ -185,8 +196,11 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public Long getEndTime() {
|
||||
if (endTime < 0)
|
||||
endTime = loader.getScvTx(id).endTime;
|
||||
if (endTime < 0) {
|
||||
ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx();
|
||||
beginTime = tx.beginTime;
|
||||
endTime = tx.endTime;
|
||||
}
|
||||
return endTime;
|
||||
}
|
||||
|
||||
|
@ -196,26 +210,7 @@ class Tx implements ITx {
|
|||
* @param time the new end time
|
||||
*/
|
||||
void setEndTime(Long time) {
|
||||
loader.getScvTx(id).endTime = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
@Override
|
||||
public int getConcurrencyIndex() {
|
||||
return concurrencyIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the concurrency index.
|
||||
*
|
||||
* @param idx the new concurrency index
|
||||
*/
|
||||
void setConcurrencyIndex(int idx) {
|
||||
concurrencyIndex = idx;
|
||||
getScvTx().endTime = time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,7 +220,12 @@ class Tx implements ITx {
|
|||
*/
|
||||
@Override
|
||||
public List<ITxAttribute> getAttributes() {
|
||||
return loader.getScvTx(id).attributes;
|
||||
return getScvTx().attributes;
|
||||
}
|
||||
|
||||
private ScvTx getScvTx() {
|
||||
if(scvTx==null)
|
||||
scvTx=loader.getScvTx(id);
|
||||
return scvTx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class TxEvent implements ITxEvent {
|
|||
/** The time. */
|
||||
final long time;
|
||||
|
||||
private int concurrencyIdx=-1;
|
||||
/**
|
||||
* Instantiates a new tx event.
|
||||
*
|
||||
|
@ -107,4 +108,13 @@ class TxEvent implements ITxEvent {
|
|||
public ITx getTransaction() {
|
||||
return loader.getTransaction(transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowIndex() {
|
||||
return concurrencyIdx;
|
||||
}
|
||||
|
||||
public void setConcurrencyIndex(int idx) {
|
||||
concurrencyIdx=idx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
/**
|
||||
* The Class TxGenerator.
|
||||
*/
|
||||
class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
class TxGenerator extends AbstractTxStream {
|
||||
|
||||
/** The stream. */
|
||||
TxStream stream;
|
||||
|
@ -45,16 +44,6 @@ class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
|||
stream.addChild(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stream.
|
||||
*
|
||||
* @return the stream
|
||||
*/
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is same.
|
||||
*
|
||||
|
@ -94,13 +83,4 @@ class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
|||
return stream.getKind();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return stream.getWidth();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,40 +55,4 @@ class TxStream extends AbstractTxStream {
|
|||
return kind;
|
||||
}
|
||||
|
||||
/** The max concurrency. */
|
||||
private int maxConcurrency = 0;
|
||||
|
||||
/** The concurrency. */
|
||||
private int concurrency = 0;
|
||||
|
||||
/**
|
||||
* Sets the concurrency.
|
||||
*
|
||||
* @param concurrency the new concurrency
|
||||
*/
|
||||
void setConcurrency(int concurrency) {
|
||||
this.concurrency = concurrency;
|
||||
if (concurrency > maxConcurrency)
|
||||
maxConcurrency = concurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the concurrency.
|
||||
*
|
||||
* @return the concurrency
|
||||
*/
|
||||
int getConcurrency() {
|
||||
return this.concurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return maxConcurrency;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
@ -21,8 +23,12 @@ import org.eclipse.swt.graphics.Point;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
|
@ -78,6 +84,12 @@ public class ArrowPainter implements IPainter {
|
|||
}
|
||||
}
|
||||
|
||||
private int getConcurrencyIndex(ITx tx) {
|
||||
IEvent[] eventList = tx.getStream().getEvents().floorEntry(tx.getBeginTime()).getValue();
|
||||
Optional<Integer> res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst();
|
||||
return res.isPresent()? res.get():0;
|
||||
}
|
||||
|
||||
protected void calculateGeometries() {
|
||||
deferUpdate = false;
|
||||
iRect.clear();
|
||||
|
@ -88,9 +100,9 @@ public class ArrowPainter implements IPainter {
|
|||
deferUpdate = true;
|
||||
return;
|
||||
}
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * getConcurrencyIndex(tx),
|
||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
||||
|
@ -99,19 +111,48 @@ public class ArrowPainter implements IPainter {
|
|||
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
|
||||
for (ITxRelation iTxRelation : relations) {
|
||||
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
||||
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * otherTx.getConcurrencyIndex(),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
Rectangle bb = createLinkEntry(otherTx, otherTx.getStream());
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
} else {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof IWaveform) {
|
||||
bb = createLinkEntry(otherTx, (IWaveform) gen);
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle createLinkEntry(ITx otherTx, IWaveform iWaveform) {
|
||||
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
if(painter==null) {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof IWaveform) {
|
||||
painter = waveCanvas.wave2painterMap.get(gen);
|
||||
if(painter!=null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(painter!=null) {
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
return new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(Projection proj, Rectangle clientRect) {
|
||||
yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2;
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
@ -37,19 +36,18 @@ public class StreamPainter extends TrackPainter{
|
|||
private IWaveform stream;
|
||||
private int txBase;
|
||||
private int txHeight;
|
||||
private TreeSet<ITx> seenTx;
|
||||
private TreeMap<ITx, ITxEvent> seenTx;
|
||||
|
||||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = waveCanvas;
|
||||
this.stream=trackEntry.waveform;
|
||||
this.seenTx=new TreeSet<>();
|
||||
this.seenTx=new TreeMap<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getWidth();
|
||||
int trackHeight=trackEntry.height/stream.getRowCount();
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
|
@ -65,8 +63,8 @@ public class StreamPainter extends TrackPainter{
|
|||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
Entry<Long, IEvent[]> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, IEvent[]> 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);
|
||||
|
@ -77,46 +75,51 @@ public class StreamPainter extends TrackPainter{
|
|||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||
for(IEvent txEvent: firstTx.getValue())
|
||||
drawTx(proj, area, ((ITxEvent)txEvent).getTransaction(), ((ITxEvent)txEvent).getRowIndex(), false);
|
||||
}else{
|
||||
seenTx.clear();
|
||||
NavigableMap<Long, IEvent[]> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||
boolean highlighed=false;
|
||||
ITxEvent highlighed=null;
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1;
|
||||
for(Entry<Long, IEvent[]> entry: entries.entrySet())
|
||||
for(IEvent evt:entry.getValue()){
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
highlighed|=selectedId==tx.getId();
|
||||
for(IEvent e:entry.getValue()){
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx = evt.getTransaction();
|
||||
if(selectedId==tx.getId())
|
||||
highlighed=evt;
|
||||
switch(evt.getKind()) {
|
||||
case BEGIN:
|
||||
seenTx.add(tx);
|
||||
seenTx.put(tx, evt);
|
||||
break;
|
||||
case END:
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
seenTx.remove(tx);
|
||||
break;
|
||||
case SINGLE:
|
||||
drawTx(proj, area, tx, false);
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(ITx tx:seenTx){
|
||||
drawTx(proj, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
seenTx.entrySet().stream().forEach(e -> {
|
||||
drawTx(proj, area, e.getKey(), e.getValue().getRowIndex(), false);
|
||||
});
|
||||
|
||||
if(highlighed!=null){
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE_HIGHLITE));
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
drawTx(proj, area, highlighed.getTransaction(), highlighed.getRowIndex(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, int concurrencyIndex, boolean highlighted ) {
|
||||
// compute colors
|
||||
Color[] transColor = waveCanvas.styleProvider.computeColor( tx.getGenerator().getName());
|
||||
|
||||
proj.setBackground(transColor[highlighted?1:0]);
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
int offset = concurrencyIndex*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
|
||||
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
|
||||
|
@ -164,25 +167,19 @@ public class StreamPainter extends TrackPainter{
|
|||
|
||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
|
||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)&&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
// now with some fuzziness
|
||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointLow=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) &&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
for(IEvent e:firstTx.getValue()){
|
||||
if(e instanceof ITxEvent) {
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx=evt.getTransaction();
|
||||
if(
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()==timePoint) ||
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()>timePointLow && evt.getTime()<timePointHigh) ||
|
||||
(evt.getKind()==EventKind.BEGIN && evt.getRowIndex()==lane && evt.getTime()<=timePoint && tx.getEndTime()>=timePoint)
|
||||
){
|
||||
return tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
|
@ -32,9 +34,11 @@ import org.eclipse.swt.widgets.Event;
|
|||
import org.eclipse.swt.widgets.ScrollBar;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
|
@ -424,13 +428,17 @@ public class WaveformCanvas extends Canvas {
|
|||
}
|
||||
for (IWaveformPainter painter : wave2painterMap.values()) {
|
||||
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
|
||||
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * tx.getConcurrencyIndex();
|
||||
int bottom = top + styleProvider.getTrackHeight();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
Entry<Long, IEvent[]> entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime());
|
||||
Optional<IEvent> res = Arrays.stream(entry.getValue()).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();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -514,7 +514,7 @@ public class WaveformView implements IWaveformView {
|
|||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getWidth();
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
|
@ -579,17 +579,18 @@ public class WaveformView implements IWaveformView {
|
|||
entry.currentValue = Double.toString(val);
|
||||
}
|
||||
} else if (entry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
ITx[] resultsList = new ITx[entry.waveform.getWidth()];
|
||||
ITx[] resultsList = new ITx[entry.waveform.getRowCount()];
|
||||
Entry<Long, IEvent[]> firstTx = entry.waveform.getEvents().floorEntry(time);
|
||||
if (firstTx != null) {
|
||||
do {
|
||||
for (IEvent evt : firstTx.getValue()) {
|
||||
if (evt instanceof ITxEvent) {
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
for (IEvent e : firstTx.getValue()) {
|
||||
if (e instanceof ITxEvent) {
|
||||
ITxEvent evt = ((ITxEvent) e);
|
||||
ITx tx = evt.getTransaction();
|
||||
if ((evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)
|
||||
&& tx.getBeginTime() <= time && tx.getEndTime() >= time
|
||||
&& resultsList[tx.getConcurrencyIndex()] == null)
|
||||
resultsList[tx.getConcurrencyIndex()] = ((ITxEvent) evt).getTransaction();
|
||||
&& resultsList[evt.getRowIndex()] == null)
|
||||
resultsList[evt.getRowIndex()] = evt.getTransaction();
|
||||
}
|
||||
}
|
||||
firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
||||
|
@ -1036,7 +1037,7 @@ public class WaveformView implements IWaveformView {
|
|||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
|
@ -1044,7 +1045,7 @@ public class WaveformView implements IWaveformView {
|
|||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||
}
|
||||
}
|
||||
|
@ -1065,7 +1066,7 @@ public class WaveformView implements IWaveformView {
|
|||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
|
@ -1073,7 +1074,7 @@ public class WaveformView implements IWaveformView {
|
|||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue,
|
||||
entry.getValue().selected);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -204,7 +204,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||
@Override
|
||||
public int getNetWidth(int intValue) {
|
||||
VCDSignal<?> signal = (VCDSignal<?>) signals.get(intValue);
|
||||
return signal.getWidth();
|
||||
return signal.getRowCount();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -109,7 +109,7 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
public int getRowCount() {
|
||||
return width;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -12,6 +12,7 @@ package com.minres.scviewer.database;
|
|||
|
||||
import java.util.NavigableMap;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface IWaveform.
|
||||
*
|
||||
|
@ -76,6 +77,6 @@ public interface IWaveform extends IHierNode {
|
|||
*
|
||||
* @return the width
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
public int getRowCount();
|
||||
|
||||
}
|
||||
|
|
|
@ -123,31 +123,31 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
|
|||
*/
|
||||
@Override
|
||||
public boolean load(File inp) {
|
||||
boolean retval = true;
|
||||
for (IWaveformDbLoader loader : loaders) {
|
||||
if (loader.canLoad(inp)) {
|
||||
loader.addPropertyChangeListener(this);
|
||||
try {
|
||||
loader.addPropertyChangeListener(this);
|
||||
loader.load(this, inp);
|
||||
loader.removePropertyChangeListener(this);
|
||||
for (IWaveform w : loader.getAllWaves()) {
|
||||
waveforms.put(w.getFullName(), w);
|
||||
}
|
||||
if (loader.getMaxTime() > maxTime) {
|
||||
maxTime = loader.getMaxTime();
|
||||
}
|
||||
if (name == null)
|
||||
name = getFileBasename(inp.getName());
|
||||
buildHierarchyNodes();
|
||||
relationTypes.addAll(loader.getAllRelationTypes());
|
||||
pcs.firePropertyChange(IHierNode.LOADING_FINISHED, null, null);
|
||||
loaded = true;
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
retval=false;
|
||||
}
|
||||
loader.removePropertyChangeListener(this);
|
||||
for (IWaveform w : loader.getAllWaves()) {
|
||||
waveforms.put(w.getFullName(), w);
|
||||
}
|
||||
if (loader.getMaxTime() > maxTime) {
|
||||
maxTime = loader.getMaxTime();
|
||||
}
|
||||
if (name == null)
|
||||
name = getFileBasename(inp.getName());
|
||||
buildHierarchyNodes();
|
||||
relationTypes.addAll(loader.getAllRelationTypes());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
pcs.firePropertyChange(IHierNode.LOADING_FINISHED, null, null);
|
||||
loaded = true;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ public interface ITx extends Comparable<ITx> {
|
|||
*
|
||||
* @return the generator
|
||||
*/
|
||||
public ITxGenerator getGenerator();
|
||||
public IWaveform getGenerator();
|
||||
|
||||
/**
|
||||
* Gets the begin time.
|
||||
|
@ -55,13 +55,6 @@ public interface ITx extends Comparable<ITx> {
|
|||
*/
|
||||
public Long getEndTime();
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
public int getConcurrencyIndex();
|
||||
|
||||
/**
|
||||
* Gets the attributes.
|
||||
*
|
||||
|
|
|
@ -30,4 +30,12 @@ public interface ITxEvent extends IEvent {
|
|||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction();
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
public int getRowIndex();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.tx;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
|
||||
/**
|
||||
* The Interface ITxGenerator.
|
||||
*/
|
||||
public interface ITxGenerator extends IWaveform {
|
||||
|
||||
/**
|
||||
* Gets the stream.
|
||||
*
|
||||
* @return the stream
|
||||
*/
|
||||
public IWaveform getStream();
|
||||
|
||||
}
|
|
@ -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.11.2.qualifier
|
||||
Bundle-Version: 2.12.0.qualifier
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 700 B |
Binary file not shown.
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 536 B |
Binary file not shown.
After Width: | Height: | Size: 688 B |
|
@ -3,11 +3,10 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -482,6 +482,7 @@ public class HeapStatus extends Composite {
|
|||
});
|
||||
}
|
||||
};
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ public class DesignBrowser {
|
|||
updateButtons();
|
||||
}
|
||||
});
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider(true));
|
||||
treeViewer.addFilter(treeAttributeFilter);
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
|
@ -252,7 +252,7 @@ public class DesignBrowser {
|
|||
updateButtons();
|
||||
}
|
||||
});
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider(false));
|
||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
txTableViewer.addFilter(tableAttributeFilter);
|
||||
txTableViewer.addDoubleClickListener(event -> {
|
||||
|
|
|
@ -37,7 +37,6 @@ 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;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
|
@ -78,6 +77,8 @@ public class TransactionList extends Composite {
|
|||
|
||||
private TableViewer tableViewer = null;
|
||||
|
||||
Thread updateThread = null;
|
||||
|
||||
private TableColumn valueColumn = null;
|
||||
|
||||
private AttributeLabelProvider valueLabelProvider = null;
|
||||
|
@ -86,8 +87,6 @@ public class TransactionList extends Composite {
|
|||
|
||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<>();
|
||||
|
||||
private List<ITx> eventList = new ArrayList<>();
|
||||
|
||||
private List<ITx> emptyList = new ArrayList<>();
|
||||
|
||||
TxFilter txFilter;
|
||||
|
@ -244,56 +243,48 @@ public class TransactionList extends Composite {
|
|||
} else if(stream != trackEntry.waveform) {
|
||||
stream=trackEntry.waveform;
|
||||
tableViewer.setInput(emptyList);
|
||||
new Thread() {
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
|
||||
private List<AttributeNameBean> getEntries() {
|
||||
return propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
eventList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
for(ITxAttribute attr: tx.getAttributes()) {
|
||||
propNames.put(attr.getName(), attr.getDataType());
|
||||
}
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tableViewer.setInput(eventList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(getEntries());
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null) {
|
||||
searchPropComboViewer.setInput(attrNames);
|
||||
Object sel = searchPropComboViewer.getElementAt(0);
|
||||
if(sel!=null) searchPropComboViewer.setSelection(new StructuredSelection(sel));
|
||||
}
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
try{
|
||||
if(updateThread!=null)
|
||||
updateThread.interrupt();
|
||||
}catch(SecurityException e){}
|
||||
updateThread = new Thread(()-> {
|
||||
final ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
final List<ITx> txList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
tx.getAttributes().forEach(attr -> propNames.put(attr.getName(), attr.getDataType()));
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
final List<AttributeNameBean> newAttrNames=propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(() -> {
|
||||
tableViewer.setInput(txList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(newAttrNames);
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null)
|
||||
searchPropComboViewer.refresh();
|
||||
if (viewPropComboViewer!=null)
|
||||
viewPropComboViewer.refresh();
|
||||
});
|
||||
updateThread=null;
|
||||
});
|
||||
updateThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchProps(String propName, DataType type, String propValue) {
|
||||
for(int i=0; i<attrNames.size(); ++i) {
|
||||
AttributeNameBean e = attrNames.get(i);
|
||||
if(propName.equals(e.getName()) && type.equals(e.getType())) {
|
||||
for(int i=0; i<searchPropComboViewer.getCombo().getItemCount(); ++i) {
|
||||
String itemName = searchPropComboViewer.getCombo().getItem(i);
|
||||
if(propName.equals(itemName)) {
|
||||
searchPropComboViewer.getCombo().select(i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -52,12 +52,17 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||
/**
|
||||
* Instantiates a new tx db label provider.
|
||||
*/
|
||||
public TxDbLabelProvider() {
|
||||
public TxDbLabelProvider(boolean isTree) {
|
||||
super();
|
||||
loadinDatabase=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
database=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
folder=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if(isTree) {
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream_hier.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
}
|
||||
signal=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
wave=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
@ -134,7 +139,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
@ -159,7 +164,13 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||
*/
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
return ((IHierNode)element).getName();
|
||||
if(element instanceof IWaveformDb){
|
||||
IWaveformDb db = (IWaveformDb) element;
|
||||
if(db.getName()== null)
|
||||
return "";
|
||||
return db.getName()+(db.isLoaded()?"":" (loading)");
|
||||
} else
|
||||
return ((IHierNode)element).getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
|
17
pom.xml
17
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>releng/com.minres.scviewer.target</module>
|
||||
|
@ -34,6 +34,19 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>parse-version</id>
|
||||
<goals>
|
||||
<goal>parse-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-maven-plugin</artifactId>
|
||||
|
@ -55,7 +68,7 @@
|
|||
<artifact>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.target</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
</artifact>
|
||||
</target>
|
||||
<environments>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<build>
|
||||
|
@ -46,7 +46,7 @@
|
|||
<products>
|
||||
<product>
|
||||
<id>product</id>
|
||||
<archiveFileName>SCViewer-${project.version}</archiveFileName>
|
||||
<archiveFileName>SCViewer-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</archiveFileName>
|
||||
<rootFolders>
|
||||
<macosx>SCViewer.app</macosx>
|
||||
</rootFolders>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.11.2.qualifier" useFeatures="true" includeLaunchers="true">
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.12.0.qualifier" useFeatures="true" includeLaunchers="true">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
@ -9,7 +9,7 @@
|
|||
<launcherArgs>
|
||||
<programArgs>-clearPersistedState
|
||||
</programArgs>
|
||||
<vmArgs>-Xmx1G -Dosgi.instance.area=@user.home/.scviewer -Dosgi.instance.area.default=@user.home/.scviewer
|
||||
<vmArgs>-Xmx2G -Dosgi.instance.area=@user.home/.scviewer -Dosgi.instance.area.default=@user.home/.scviewer
|
||||
</vmArgs>
|
||||
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
||||
</vmArgsMac>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.updateSite</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<build>
|
||||
|
@ -22,19 +21,6 @@
|
|||
<finalName>${project.artifactId}-${qualifiedVersion}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>parse-version</id>
|
||||
<goals>
|
||||
<goal>parse-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
|
@ -59,7 +45,7 @@
|
|||
<!-- Bintray package name -->
|
||||
<bintrayPackage>SCViewer</bintrayPackage>
|
||||
<!-- Bintray package version number -->
|
||||
<bintrayVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</bintrayVersion>
|
||||
<bintrayVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</bintrayVersion>
|
||||
<!-- remove any preexisting files -->
|
||||
<performDestroy>true</performDestroy>
|
||||
<!-- information used when creating the package -->
|
||||
|
|
|
@ -19,18 +19,18 @@
|
|||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||
<listEntry value="/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.minres.scviewer.database.test.DatabaseServicesTest"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.database.test">
|
||||
<implementation class="com.minres.scviewer.database.test.DatabaseServicesTest"/>
|
||||
<implementation class="com.minres.scviewer.database.test.TestWaveformDbFactory"/>
|
||||
<reference bind="setFactory" cardinality="1..1" interface="com.minres.scviewer.database.IWaveformDbFactory" name="IWaveformDbFactory" policy="static" unbind="unsetFactory"/>
|
||||
</scr:component>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.2-SNAPSHOT</version>
|
||||
<version>2.12.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
|
|
@ -25,28 +25,15 @@ import org.junit.Test;
|
|||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
|
||||
public class DatabaseServicesTest {
|
||||
|
||||
|
||||
private static IWaveformDbFactory waveformDbFactory;
|
||||
|
||||
private IWaveformDb waveformDb;
|
||||
|
||||
public synchronized void setFactory(IWaveformDbFactory service) {
|
||||
waveformDbFactory = service;
|
||||
}
|
||||
|
||||
public synchronized void unsetFactory(IWaveformDbFactory service) {
|
||||
if (waveformDbFactory == service) {
|
||||
waveformDbFactory = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
waveformDb=waveformDbFactory.getDatabase();
|
||||
waveformDb=TestWaveformDbFactory.getDatabase();
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -91,11 +78,11 @@ public class DatabaseServicesTest {
|
|||
assertEquals(1, waveformDb.getChildNodes().size());
|
||||
for(IWaveform w:waveforms) {
|
||||
if(w.getId().equals(1l)) {
|
||||
assertEquals(2, w.getWidth());
|
||||
assertEquals(2, w.getRowCount());
|
||||
} else if(w.getId().equals(2l)) {
|
||||
assertEquals(1, w.getWidth());
|
||||
assertEquals(1, w.getRowCount());
|
||||
} else if(w.getId().equals(3l)) {
|
||||
assertEquals(1, w.getWidth());
|
||||
assertEquals(1, w.getRowCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.minres.scviewer.database.test;
|
||||
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
|
||||
public class TestWaveformDbFactory {
|
||||
private static IWaveformDbFactory waveformDbFactory;
|
||||
|
||||
|
||||
public synchronized void setFactory(IWaveformDbFactory service) {
|
||||
waveformDbFactory = service;
|
||||
}
|
||||
|
||||
public synchronized void unsetFactory(IWaveformDbFactory service) {
|
||||
if (waveformDbFactory == service) {
|
||||
waveformDbFactory = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static IWaveformDb getDatabase() throws Exception {
|
||||
return waveformDbFactory.getDatabase();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue