Merge branch 'feature/generater_as_stream' into develop

This commit is contained in:
Eyck Jentzsch 2021-01-09 15:43:09 +01:00
commit 15fb825548
149 changed files with 2513 additions and 1215 deletions

View File

@ -12,7 +12,7 @@ text base recording.
</description> </description>
<copyright> <copyright>
Copyright (c) 2015 MINRES Technologies GmbH. Copyright (c) 2015-2021 MINRES Technologies GmbH.
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License are made available under the terms of the Eclipse Public License
v1.0 which accompanies this distribution, and is available at v1.0 which accompanies this distribution, and is available at

View File

@ -12,7 +12,7 @@ built-in text base recording.
</description> </description>
<copyright> <copyright>
Copyright (c) 2015 MINRES Technologies GmbH. Copyright (c) 2015-2021 MINRES Technologies GmbH.
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License are made available under the terms of the Eclipse Public License
v1.0 which accompanies this distribution, and is available at v1.0 which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others. # Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at

View File

@ -0,0 +1,129 @@
/*******************************************************************************
* 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.sqlite;
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.IWaveform;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.RelationTypeFactory;
import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.tx.ITx;
abstract class AbstractTxStream extends HierNode implements IWaveform {
protected IDatabase database;
private long streamId;
private Integer maxConcurrency;
private TreeMap<Long, IEvent[]> events;
private List<RelationType> usedRelationsList;
public AbstractTxStream(IDatabase database, String name, long streamId) {
super(name);
this.database=database;
this.streamId=streamId;
}
@Override
public int getWidth() {
if(maxConcurrency==null){
StringBuilder sb = new StringBuilder();
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
sb.append(streamId);
try(
java.sql.Connection connection = database.createConnection();
java.sql.Statement statement = connection.createStatement();
java.sql.ResultSet resultSet = statement.executeQuery(sb.toString());
) {
while (resultSet.next()) {
if(maxConcurrency==null) maxConcurrency=0;
Object value = resultSet.getObject("concurrencyLevel");
if(value!=null)
maxConcurrency=(Integer) value;
}
} catch (SQLException e) {
if(maxConcurrency==null) maxConcurrency=0;
}
maxConcurrency+=1;
}
return maxConcurrency;
}
@Override
public NavigableMap<Long, IEvent[]> getEvents(){
if(events==null){
events=new TreeMap<>();
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
putEvent(new TxEvent(EventKind.BEGIN, entry.getValue()));
putEvent(new TxEvent(EventKind.END, entry.getValue()));
}
}
return events;
}
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});
}
}
protected abstract Map<Integer, ITx> getTransactions();
@Override
public IEvent[] getEventsAtTime(Long time) {
return getEvents().get(time);
}
public void setRelationTypeList(List<RelationType> usedRelationsList){
this.usedRelationsList=usedRelationsList;
}
public RelationType getRelationType(String name) {
RelationType relType=RelationTypeFactory.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
return relType;
}
@Override
public IEvent[] getEventsBeforeTime(Long time) {
Entry<Long, IEvent[]> e = events.floorEntry(time);
if(e==null)
return new IEvent[]{};
else
return events.floorEntry(time).getValue();
}
@Override
public WaveformType getType() {
return WaveformType.TRANSACTION;
}
}

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,19 +10,33 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.sqlite; package com.minres.scviewer.database.sqlite;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.Map;
import java.util.TreeMap;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
import com.minres.scviewer.database.sqlite.tables.ScvGenerator; 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; import com.minres.scviewer.database.tx.ITxGenerator;
public class TxGenerator implements ITxGenerator { public class TxGenerator extends AbstractTxStream implements ITxGenerator {
private IWaveform stream; private TxStream stream;
private ScvGenerator scvGenerator; private ScvGenerator scvGenerator;
public TxGenerator(IWaveform stream, ScvGenerator scvGenerator) { private TreeMap<Integer, ITx> transactions;
public TxGenerator(IDatabase database, TxStream stream, ScvGenerator scvGenerator) {
super(database, scvGenerator.getName(), stream.getId());
this.stream=stream; this.stream=stream;
this.scvGenerator=scvGenerator; this.scvGenerator=scvGenerator;
stream.addChild(this);
} }
@Override @Override
@ -40,4 +54,32 @@ public class TxGenerator implements ITxGenerator {
return scvGenerator.getName(); return scvGenerator.getName();
} }
@Override
public boolean isSame(IWaveform other) {
return(other instanceof TxGenerator && this.getId().equals(other.getId()));
}
@Override
public String getKind() {
return stream.getKind();
}
@Override
protected Map<Integer, ITx> getTransactions() {
if(transactions==null){
transactions = new TreeMap<>();
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<>(ScvTx.class, database,
"stream="+stream.getId()+" and generator="+scvGenerator.getId());
try {
for(ScvTx scvTx:handler.selectObjects()){
transactions.put(scvTx.getId(), new Tx(database, (TxStream) stream, this, scvTx));
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException e) {
e.printStackTrace();
}
}
return transactions;
}
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,17 +16,10 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap; 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.IEvent;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.RelationTypeFactory;
import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.sqlite.db.IDatabase; import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler; import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
import com.minres.scviewer.database.sqlite.tables.ScvGenerator; import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
@ -35,9 +28,7 @@ import com.minres.scviewer.database.sqlite.tables.ScvTx;
import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITx;
import com.minres.scviewer.database.tx.ITxGenerator; import com.minres.scviewer.database.tx.ITxGenerator;
public class TxStream extends HierNode implements IWaveform { public class TxStream extends AbstractTxStream {
private IDatabase database;
private String fullName; private String fullName;
@ -47,15 +38,8 @@ public class TxStream extends HierNode implements IWaveform {
private TreeMap<Integer, ITx> transactions; private TreeMap<Integer, ITx> transactions;
private Integer maxConcurrency;
private TreeMap<Long, IEvent[]> events;
private List<RelationType> usedRelationsList;
public TxStream(IDatabase database, ScvStream scvStream) { public TxStream(IDatabase database, ScvStream scvStream) {
super(scvStream.getName()); super(database, scvStream.getName(), scvStream.getId());
this.database=database;
fullName=scvStream.getName(); fullName=scvStream.getName();
this.scvStream=scvStream; this.scvStream=scvStream;
} }
@ -77,7 +61,7 @@ public class TxStream extends HierNode implements IWaveform {
generators=new TreeMap<>(); generators=new TreeMap<>();
try { try {
for(ScvGenerator scvGenerator:handler.selectObjects()){ for(ScvGenerator scvGenerator:handler.selectObjects()){
generators.put(scvGenerator.getId(), new TxGenerator(this, scvGenerator)); generators.put(scvGenerator.getId(), new TxGenerator(database, this, scvGenerator));
} }
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException } catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException e) { | InvocationTargetException | SQLException | IntrospectionException e) {
@ -87,56 +71,6 @@ public class TxStream extends HierNode implements IWaveform {
return new ArrayList<>(generators.values()); return new ArrayList<>(generators.values());
} }
@Override
public int getWidth() {
if(maxConcurrency==null){
StringBuilder sb = new StringBuilder();
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
sb.append(scvStream.getId());
try(
java.sql.Connection connection = database.createConnection();
java.sql.Statement statement = connection.createStatement();
java.sql.ResultSet resultSet = statement.executeQuery(sb.toString());
) {
while (resultSet.next()) {
if(maxConcurrency==null) maxConcurrency=0;
Object value = resultSet.getObject("concurrencyLevel");
if(value!=null)
maxConcurrency=(Integer) value;
}
} catch (SQLException e) {
if(maxConcurrency==null) maxConcurrency=0;
}
maxConcurrency+=1;
}
return maxConcurrency;
}
@Override
public NavigableMap<Long, IEvent[]> getEvents(){
if(events==null){
events=new TreeMap<>();
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
putEvent(new TxEvent(EventKind.BEGIN, entry.getValue()));
putEvent(new TxEvent(EventKind.END, entry.getValue()));
}
}
return events;
}
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});
}
}
protected Map<Integer, ITx> getTransactions() { protected Map<Integer, ITx> getTransactions() {
if(transactions==null){ if(transactions==null){
if(generators==null) getGenerators(); if(generators==null) getGenerators();
@ -160,33 +94,13 @@ public class TxStream extends HierNode implements IWaveform {
return getEvents().get(time); return getEvents().get(time);
} }
public void setRelationTypeList(List<RelationType> usedRelationsList){
this.usedRelationsList=usedRelationsList;
}
public RelationType getRelationType(String name) {
RelationType relType=RelationTypeFactory.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
return relType;
}
@Override @Override
public boolean isSame(IWaveform other) { public boolean isSame(IWaveform other) {
return(other instanceof TxStream && this.getId().equals(other.getId())); return(other instanceof TxStream && this.getId().equals(other.getId()));
} }
@Override @Override
public IEvent[] getEventsBeforeTime(Long time) { public String getKind() {
Entry<Long, IEvent[]> e = events.floorEntry(time); return scvStream.getKind();
if(e==null)
return new IEvent[]{};
else
return events.floorEntry(time).getValue();
} }
@Override
public WaveformType getType() {
return WaveformType.TRANSACTION;
}
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -77,7 +77,6 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
* @throws InvocationTargetException * @throws InvocationTargetException
*/ */
public synchronized List<T> selectObjects() throws SQLException, public synchronized List<T> selectObjects() throws SQLException,
SecurityException, IllegalArgumentException,
InstantiationException, IllegalAccessException, InstantiationException, IllegalAccessException,
IntrospectionException, InvocationTargetException { IntrospectionException, InvocationTargetException {
@ -116,12 +115,11 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
* @throws InvocationTargetException * @throws InvocationTargetException
*/ */
private List<T> createObjects(ResultSet resultSet) private List<T> createObjects(ResultSet resultSet)
throws SecurityException, IllegalArgumentException, throws SQLException, InstantiationException,
SQLException, InstantiationException,
IllegalAccessException, IntrospectionException, IllegalAccessException, IntrospectionException,
InvocationTargetException { InvocationTargetException {
List<T> list = new ArrayList<T>(); List<T> list = new ArrayList<>();
while (resultSet.next()) { while (resultSet.next()) {

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others. # Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at

View File

@ -0,0 +1,159 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working
* Copyright (c) 2020 MINRES Technologies GmbH
* 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:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text;
import java.util.ArrayList;
import java.util.Arrays;
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.ITxEvent;
/**
* The Class AbstractTxStream.
*/
abstract class AbstractTxStream extends HierNode implements IWaveform {
/** The id. */
private Long id;
/** The loader. */
protected TextDbLoader loader;
/** The events. */
TreeMap<Long, IEvent[]> events = new TreeMap<>();
/** The concurrency calculated. */
boolean concurrencyCalculated = false;
/**
* Instantiates a new abstract tx stream.
*
* @param loader the loader
* @param id the id
* @param name the name
*/
public AbstractTxStream(TextDbLoader loader, Long id, String name) {
super(name);
this.loader = loader;
this.id = id;
}
/**
* Adds the event.
*
* @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);
}
}
/**
* Gets the events.
*
* @return the events
*/
@Override
public NavigableMap<Long, IEvent[]> getEvents() {
if (!concurrencyCalculated)
calculateConcurrency();
return events;
}
/**
* Gets the events at time.
*
* @param time the time
* @return the events at time
*/
@Override
public IEvent[] getEventsAtTime(Long time) {
if (!concurrencyCalculated)
calculateConcurrency();
return events.get(time);
}
/**
* Gets the events before time.
*
* @param time the time
* @return the events before time
*/
@Override
public IEvent[] getEventsBeforeTime(Long time) {
if (!concurrencyCalculated)
calculateConcurrency();
Entry<Long, IEvent[]> e = events.floorEntry(time);
if (e == null)
return new IEvent[] {};
else
return events.floorEntry(time).getValue();
}
/**
* Gets the type.
*
* @return the type
*/
@Override
public WaveformType getType() {
return WaveformType.TRANSACTION;
}
/**
* Gets the id.
*
* @return the id
*/
@Override
public Long getId() {
return id;
}
/**
* Calculate concurrency.
*/
synchronized void calculateConcurrency() {
if (concurrencyCalculated)
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();
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;
}
}

View File

@ -1,21 +1,43 @@
/*******************************************************************************
* Copyright (c) 2020 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.text; package com.minres.scviewer.database.text;
import java.io.Serializable; import java.io.Serializable;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
/**
* The Class ScvRelation.
*/
class ScvRelation implements Serializable { class ScvRelation implements Serializable {
/**
* /** The Constant serialVersionUID. */
*/
private static final long serialVersionUID = -347668857680574140L; private static final long serialVersionUID = -347668857680574140L;
/** The source. */
final long source; final long source;
/** The target. */
final long target; final long target;
/** The relation type. */
final RelationType relationType; final RelationType relationType;
/**
* Instantiates a new scv relation.
*
* @param relationType the relation type
* @param source the source
* @param target the target
*/
public ScvRelation(RelationType relationType, long source, long target) { public ScvRelation(RelationType relationType, long source, long target) {
this.source = source; this.source = source;
this.target = target; this.target = target;

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,32 +17,54 @@ import java.util.List;
import com.minres.scviewer.database.tx.ITxAttribute; import com.minres.scviewer.database.tx.ITxAttribute;
class ScvTx implements Serializable{ /**
* The Class ScvTx.
/** */
* class ScvTx implements Serializable {
*/
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -855200240003328221L; private static final long serialVersionUID = -855200240003328221L;
/** The id. */
final long id; final long id;
/** The generator id. */
final long generatorId; final long generatorId;
/** The stream id. */
final long streamId; final long streamId;
/** The begin time. */
long beginTime; long beginTime;
/** The end time. */
long endTime; long endTime;
/** The attributes. */
final List<ITxAttribute> attributes = new ArrayList<>(); final List<ITxAttribute> attributes = new ArrayList<>();
ScvTx(long id, long streamId, long generatorId, long begin){ /**
this.id=id; * Instantiates a new scv tx.
this.streamId=streamId; *
this.generatorId=generatorId; * @param id the id
this.beginTime=begin; * @param streamId the stream id
this.endTime=begin; * @param generatorId the generator id
* @param begin the begin
*/
ScvTx(long id, long streamId, long generatorId, long begin) {
this.id = id;
this.streamId = streamId;
this.generatorId = generatorId;
this.beginTime = begin;
this.endTime = begin;
}
/**
* Gets the id.
*
* @return the id
*/
Long getId() {
return id;
} }
Long getId() {return id;}
} }

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -47,101 +48,128 @@ import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.RelationTypeFactory; import com.minres.scviewer.database.RelationTypeFactory;
import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITx;
public class TextDbLoader implements IWaveformDbLoader{ /**
* The Class TextDbLoader.
*/
public class TextDbLoader implements IWaveformDbLoader {
private Long maxTime=0L; /** The max time. */
private Long maxTime = 0L;
DB mapDb=null; /** The map db. */
DB mapDb = null;
final List<String> attrValues = new ArrayList<>();
/** The attr values. */
final List<String> attrValues = new ArrayList<>();
/** The relation types. */
final Map<String, RelationType> relationTypes = UnifiedMap.newMap(); final Map<String, RelationType> relationTypes = UnifiedMap.newMap();
final Map<Long, TxStream> txStreams = UnifiedMap.newMap();
final Map<Long, TxGenerator> txGenerators = UnifiedMap.newMap();
Map<Long, ScvTx> transactions = null;
final Map<String, TxAttributeType> attributeTypes = UnifiedMap.newMap(); /** The tx streams. */
final Map<Long, TxStream> txStreams = UnifiedMap.newMap();
/** The tx generators. */
final Map<Long, TxGenerator> txGenerators = UnifiedMap.newMap();
/** The transactions. */
Map<Long, ScvTx> transactions = null;
/** The attribute types. */
final Map<String, TxAttributeType> attributeTypes = UnifiedMap.newMap();
/** The relations in. */
final HashMultimap<Long, ScvRelation> relationsIn = HashMultimap.create(); final HashMultimap<Long, ScvRelation> relationsIn = HashMultimap.create();
/** The relations out. */
final HashMultimap<Long, ScvRelation> relationsOut = HashMultimap.create(); final HashMultimap<Long, ScvRelation> relationsOut = HashMultimap.create();
HashMap<Long, Tx> txCache = new HashMap<>(); /** The tx cache. */
HashMap<Long, Tx> txCache = new HashMap<>();
List<Thread> threads = new ArrayList<>(); /** The threads. */
List<Thread> threads = new ArrayList<>();
@Override
/**
* Gets the max time.
*
* @return the max time
*/
@Override
public Long getMaxTime() { public Long getMaxTime() {
return maxTime; return maxTime;
} }
/**
* Gets the all waves.
*
* @return the all waves
*/
@Override @Override
public Collection<IWaveform> getAllWaves() { public Collection<IWaveform> getAllWaves() {
return new ArrayList<>(txStreams.values()); return new ArrayList<>(txStreams.values());
} }
/** The Constant x. */
static final byte[] x = "scv_tr_stream".getBytes(); static final byte[] x = "scv_tr_stream".getBytes();
/**
* Load.
*
* @param db the db
* @param file the file
* @return true, if successful
* @throws InputFormatException the input format exception
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean load(IWaveformDb db, File file) throws InputFormatException { public boolean load(IWaveformDb db, File file) throws InputFormatException {
dispose(); dispose();
if(file.isDirectory() || !file.exists()) return false; if (file.isDirectory() || !file.exists())
return false;
TextDbParser parser = new TextDbParser(this); TextDbParser parser = new TextDbParser(this);
boolean gzipped = isGzipped(file); boolean gzipped = isGzipped(file);
try { try {
if(!isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))) if (!isTxfile(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file)))
return false; return false;
} catch(Exception e) { } catch (Exception e) {
throw new InputFormatException(); throw new InputFormatException();
} }
if(file.length() < 75000000*(gzipped?1:10) || "memory".equals(System.getProperty("ScvBackingDB", "file"))) if (file.length() < 75000000 * (gzipped ? 1 : 10)
mapDb = DBMaker || "memory".equals(System.getProperty("ScvBackingDB", "file")))
.memoryDirectDB() mapDb = DBMaker.memoryDirectDB().allocateStartSize(512l * 1024l * 1024l)
.allocateStartSize(512l*1024l*1024l) .allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
.allocateIncrement(128l*1024l*1024l)
.cleanerHackEnable()
.make();
else { else {
File mapDbFile; File mapDbFile;
try { try {
mapDbFile = File.createTempFile("."+file.getName(), ".mapdb", null /*file.parentFile*/); mapDbFile = File.createTempFile("." + file.getName(), ".mapdb", null /* file.parentFile */);
Files.delete(Paths.get(mapDbFile.getPath())); Files.delete(Paths.get(mapDbFile.getPath()));
} catch (IOException e1) { } catch (IOException e1) {
return false; return false;
} }
mapDb = DBMaker mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
.fileDB(mapDbFile) .fileMmapEnableIfSupported().fileMmapPreclearDisable().allocateStartSize(512l * 1024l * 1024l)
.fileMmapEnable() // Always enable mmap .allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
.fileMmapEnableIfSupported()
.fileMmapPreclearDisable()
.allocateStartSize(512l*1024l*1024l)
.allocateIncrement(128l*1024l*1024l)
.cleanerHackEnable()
.make();
mapDbFile.deleteOnExit(); mapDbFile.deleteOnExit();
} }
try { try {
parser.txSink = mapDb.treeMap("transactions", Serializer.LONG,Serializer.JAVA).createFromSink(); parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
parser.parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file)); parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
transactions = parser.txSink.create(); transactions = parser.txSink.create();
} catch(IllegalArgumentException|ArrayIndexOutOfBoundsException e) { } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
} catch(Exception e) { } catch (Exception e) {
System.out.println("---->>> Exception "+e.toString()+" caught while loading database"); System.out.println("---->>> Exception " + e.toString() + " caught while loading database");
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
for(TxStream stream:txStreams.values()) { for (TxStream stream : txStreams.values()) {
Thread t = new Thread() { Thread t = new Thread() {
@Override @Override
public void run() { public void run() {
try { try {
stream.calculateConcurrency(); stream.calculateConcurrency();
} catch (Exception e) {/* don't let exceptions bubble up */ } } catch (Exception e) {
/* don't let exceptions bubble up */ }
} }
}; };
threads.add(t); threads.add(t);
@ -149,31 +177,41 @@ public class TextDbLoader implements IWaveformDbLoader{
} }
return true; return true;
} }
/**
* Dispose.
*/
@Override @Override
public void dispose() { public void dispose() {
attrValues.clear(); attrValues.clear();
relationTypes.clear(); relationTypes.clear();
txStreams.clear(); txStreams.clear();
txGenerators.clear(); txGenerators.clear();
transactions = null; transactions = null;
attributeTypes.clear(); attributeTypes.clear();
relationsIn.clear(); relationsIn.clear();
relationsOut.clear(); relationsOut.clear();
if(mapDb!=null) { if (mapDb != null) {
mapDb.close(); mapDb.close();
mapDb=null; mapDb = null;
} }
} }
/**
* Checks if is txfile.
*
* @param istream the istream
* @return true, if is txfile
*/
private static boolean isTxfile(InputStream istream) { private static boolean isTxfile(InputStream istream) {
byte[] buffer = new byte[x.length]; byte[] buffer = new byte[x.length];
try { try {
int readCnt = istream.read(buffer, 0, x.length); int readCnt = istream.read(buffer, 0, x.length);
istream.close(); istream.close();
if(readCnt==x.length){ if (readCnt == x.length) {
for(int i=0; i<x.length; i++) for (int i = 0; i < x.length; i++)
if(buffer[i]!=x[i]) return false; if (buffer[i] != x[i])
return false;
} }
return true; return true;
} catch (IOException e) { } catch (IOException e) {
@ -181,178 +219,254 @@ public class TextDbLoader implements IWaveformDbLoader{
} }
} }
/**
* Checks if is gzipped.
*
* @param f the f
* @return true, if is gzipped
*/
private static boolean isGzipped(File f) { private static boolean isGzipped(File f) {
try(InputStream is = new FileInputStream(f)) { try (InputStream is = new FileInputStream(f)) {
byte [] signature = new byte[2]; byte[] signature = new byte[2];
int nread = is.read( signature ); //read the gzip signature int nread = is.read(signature); // read the gzip signature
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b; return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
} catch (IOException e) { } catch (IOException e) {
return false; return false;
} }
} }
public Collection<RelationType> getAllRelationTypes(){ /**
* Gets the all relation types.
*
* @return the all relation types
*/
public Collection<RelationType> getAllRelationTypes() {
return relationTypes.values(); return relationTypes.values();
} }
/**
* The Class TextDbParser.
*/
static class TextDbParser { static class TextDbParser {
static final Pattern scv_tr_stream = Pattern.compile("^scv_tr_stream\\s+\\(ID (\\d+),\\s+name\\s+\"([^\"]+)\",\\s+kind\\s+\"([^\"]+)\"\\)$");
static final Pattern scv_tr_generator = Pattern.compile("^scv_tr_generator\\s+\\(ID\\s+(\\d+),\\s+name\\s+\"([^\"]+)\",\\s+scv_tr_stream\\s+(\\d+),$"); /** The Constant scv_tr_stream. */
static final Pattern begin_attribute = Pattern.compile("^begin_attribute \\(ID (\\d+), name \"([^\"]+)\", type \"([^\"]+)\"\\)$"); static final Pattern scv_tr_stream = Pattern
static final Pattern end_attribute = Pattern.compile("^end_attribute \\(ID (\\d+), name \"([^\"]+)\", type \"([^\"]+)\"\\)$"); .compile("^scv_tr_stream\\s+\\(ID (\\d+),\\s+name\\s+\"([^\"]+)\",\\s+kind\\s+\"([^\"]+)\"\\)$");
/** The Constant scv_tr_generator. */
static final Pattern scv_tr_generator = Pattern
.compile("^scv_tr_generator\\s+\\(ID\\s+(\\d+),\\s+name\\s+\"([^\"]+)\",\\s+scv_tr_stream\\s+(\\d+),$");
/** The Constant begin_attribute. */
static final Pattern begin_attribute = Pattern
.compile("^begin_attribute \\(ID (\\d+), name \"([^\"]+)\", type \"([^\"]+)\"\\)$");
/** The Constant end_attribute. */
static final Pattern end_attribute = Pattern
.compile("^end_attribute \\(ID (\\d+), name \"([^\"]+)\", type \"([^\"]+)\"\\)$");
/** The loader. */
final TextDbLoader loader; final TextDbLoader loader;
/** The transaction by id. */
HashMap<Long, ScvTx> transactionById = new HashMap<>(); HashMap<Long, ScvTx> transactionById = new HashMap<>();
/** The tx sink. */
TreeMapSink<Long, ScvTx> txSink; TreeMapSink<Long, ScvTx> txSink;
/** The reader. */
BufferedReader reader = null; BufferedReader reader = null;
TxGenerator generator=null; /** The generator. */
TxGenerator generator = null;
/** The attr value lut. */
Map<String, Integer> attrValueLut = new HashMap<>(); Map<String, Integer> attrValueLut = new HashMap<>();
/**
* Instantiates a new text db parser.
*
* @param loader the loader
*/
public TextDbParser(TextDbLoader loader) { public TextDbParser(TextDbLoader loader) {
super(); super();
this.loader = loader; this.loader = loader;
} }
void parseInput(InputStream inputStream) throws IOException{ /**
* Parses the input.
*
* @param inputStream the input stream
* @throws IOException Signals that an I/O exception has occurred.
*/
void parseInput(InputStream inputStream) throws IOException {
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
String curLine = reader.readLine(); String curLine = reader.readLine();
String nextLine = null; String nextLine = null;
while((nextLine=reader.readLine())!=null && curLine!=null) { while ((nextLine = reader.readLine()) != null && curLine != null) {
curLine=parseLine(curLine, nextLine); curLine = parseLine(curLine, nextLine);
} }
if(curLine!=null) if (curLine != null)
parseLine(curLine, nextLine); parseLine(curLine, nextLine);
} }
private TxAttributeType getAttrType(String name, DataType dataType, AssociationType type){ /**
String key =name+"-"+dataType.toString(); * Gets the attr type.
*
* @param name the name
* @param dataType the data type
* @param type the type
* @return the attr type
*/
private TxAttributeType getAttrType(String name, DataType dataType, AssociationType type) {
String key = name + "-" + dataType.toString();
TxAttributeType res; TxAttributeType res;
if(loader.attributeTypes.containsKey(key)){ if (loader.attributeTypes.containsKey(key)) {
res=loader.attributeTypes.get(key); res = loader.attributeTypes.get(key);
} else { } else {
res=new TxAttributeType(name, dataType, type); res = new TxAttributeType(name, dataType, type);
loader.attributeTypes.put(key, res); loader.attributeTypes.put(key, res);
} }
return res; return res;
} }
private String parseLine(String curLine, String nextLine) throws IOException{ /**
* Parses the line.
*
* @param curLine the cur line
* @param nextLine the next line
* @return the string
* @throws IOException Signals that an I/O exception has occurred.
*/
private String parseLine(String curLine, String nextLine) throws IOException {
String[] tokens = curLine.split("\\s+"); String[] tokens = curLine.split("\\s+");
if("tx_record_attribute".equals(tokens[0])){ if ("tx_record_attribute".equals(tokens[0])) {
Long id = Long.parseLong(tokens[1]); Long id = Long.parseLong(tokens[1]);
String name = tokens[2].substring(1, tokens[2].length()); String name = tokens[2].substring(1, tokens[2].length());
DataType type = DataType.valueOf(tokens[3]); DataType type = DataType.valueOf(tokens[3]);
String remaining = tokens.length>5?String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)):""; String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length))
: "";
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD); TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining))); transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
} else if("tx_begin".equals(tokens[0])){ } else if ("tx_begin".equals(tokens[0])) {
Long id = Long.parseLong(tokens[1]); Long id = Long.parseLong(tokens[1]);
Long genId = Long.parseLong(tokens[2]); Long genId = Long.parseLong(tokens[2]);
TxGenerator gen=loader.txGenerators.get(genId); TxGenerator gen = loader.txGenerators.get(genId);
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId, Long.parseLong(tokens[3])*stringToScale(tokens[4])); ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
loader.maxTime = loader.maxTime>scvTx.beginTime?loader.maxTime:scvTx.beginTime; 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()); TxStream stream = loader.txStreams.get(gen.stream.getId());
stream.setConcurrency(stream.getConcurrency()+1); stream.setConcurrency(stream.getConcurrency() + 1);
if(nextLine!=null && nextLine.charAt(0)=='a') { if (nextLine != null && nextLine.charAt(0) == 'a') {
int idx=0; int idx = 0;
while(nextLine!=null && nextLine.charAt(0)=='a') { while (nextLine != null && nextLine.charAt(0) == 'a') {
String[] attrTokens=nextLine.split("\\s+"); String[] attrTokens = nextLine.split("\\s+");
TxAttributeType attrType = gen.beginAttrs.get(idx); TxAttributeType attrType = gen.beginAttrs.get(idx);
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1])); TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
scvTx.attributes.add(attr); scvTx.attributes.add(attr);
idx++; idx++;
nextLine=reader.readLine(); nextLine = reader.readLine();
} }
} }
txSink.put(id, scvTx); txSink.put(id, scvTx);
transactionById.put(id, scvTx); transactionById.put(id, scvTx);
} else if("tx_end".equals(tokens[0])){ } else if ("tx_end".equals(tokens[0])) {
Long id = Long.parseLong(tokens[1]); Long id = Long.parseLong(tokens[1]);
ScvTx scvTx = transactionById.get(id); ScvTx scvTx = transactionById.get(id);
assert Long.parseLong(tokens[2])==scvTx.generatorId; assert Long.parseLong(tokens[2]) == scvTx.generatorId;
scvTx.endTime=Long.parseLong(tokens[3])*stringToScale(tokens[4]); scvTx.endTime = Long.parseLong(tokens[3]) * stringToScale(tokens[4]);
loader.maxTime = loader.maxTime>scvTx.endTime?loader.maxTime:scvTx.endTime; loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime;
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId); TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
TxStream stream = loader.txStreams.get(gen.stream.getId()); TxStream stream = loader.txStreams.get(gen.stream.getId());
if(scvTx.beginTime==scvTx.endTime) if (scvTx.beginTime == scvTx.endTime) {
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime)); TxEvent evt = new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime);
else { stream.addEvent(evt);
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime)); gen.addEvent(evt);
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime)); } 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.setConcurrency(stream.getConcurrency()-1); stream.setConcurrency(stream.getConcurrency() - 1);
if(nextLine!=null && nextLine.charAt(0)=='a') { if (nextLine != null && nextLine.charAt(0) == 'a') {
int idx=0; int idx = 0;
while(nextLine!=null && nextLine.charAt(0)=='a') { while (nextLine != null && nextLine.charAt(0) == 'a') {
String[] attrTokens=nextLine.split("\\s+"); String[] attrTokens = nextLine.split("\\s+");
TxAttributeType attrType = gen.endAttrs.get(idx); TxAttributeType attrType = gen.endAttrs.get(idx);
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1])); TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
scvTx.attributes.add(attr); scvTx.attributes.add(attr);
idx++; idx++;
nextLine=reader.readLine(); nextLine = reader.readLine();
} }
} }
} else if("tx_relation".equals(tokens[0])){ } else if ("tx_relation".equals(tokens[0])) {
Long tr2= Long.parseLong(tokens[2]); Long tr2 = Long.parseLong(tokens[2]);
Long tr1= Long.parseLong(tokens[3]); Long tr1 = Long.parseLong(tokens[3]);
String relType=tokens[1].substring(1, tokens[1].length()-1); String relType = tokens[1].substring(1, tokens[1].length() - 1);
if(!loader.relationTypes.containsKey(relType)) if (!loader.relationTypes.containsKey(relType))
loader.relationTypes.put(relType, RelationTypeFactory.create(relType)); loader.relationTypes.put(relType, RelationTypeFactory.create(relType));
ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2); ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2);
loader.relationsOut.put(tr1, rel); loader.relationsOut.put(tr1, rel);
loader.relationsIn.put(tr2, rel); loader.relationsIn.put(tr2, rel);
} else if("scv_tr_stream".equals(tokens[0])){ } else if ("scv_tr_stream".equals(tokens[0])) {
Matcher matcher = scv_tr_stream.matcher(curLine); Matcher matcher = scv_tr_stream.matcher(curLine);
if (matcher.matches()) { if (matcher.matches()) {
Long id = Long.parseLong(matcher.group(1)); Long id = Long.parseLong(matcher.group(1));
TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3)); TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3));
loader.txStreams.put(id, stream); loader.txStreams.put(id, stream);
} }
} else if("scv_tr_generator".equals(tokens[0])){ } else if ("scv_tr_generator".equals(tokens[0])) {
Matcher matcher = scv_tr_generator.matcher(curLine); Matcher matcher = scv_tr_generator.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
Long id = Long.parseLong(matcher.group(1)); Long id = Long.parseLong(matcher.group(1));
TxStream stream=loader.txStreams.get(Long.parseLong(matcher.group(3))); TxStream stream = loader.txStreams.get(Long.parseLong(matcher.group(3)));
generator=new TxGenerator(id, stream, matcher.group(2)); generator = new TxGenerator(loader, id, matcher.group(2), stream);
loader.txGenerators.put(id, generator); loader.txGenerators.put(id, generator);
} }
} else if("begin_attribute".equals(tokens[0])){ } else if ("begin_attribute".equals(tokens[0])) {
Matcher matcher = begin_attribute.matcher(curLine); Matcher matcher = begin_attribute.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)), AssociationType.BEGIN); TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
AssociationType.BEGIN);
generator.beginAttrs.add(attrType); generator.beginAttrs.add(attrType);
} }
} else if("end_attribute".equals(tokens[0])){ } else if ("end_attribute".equals(tokens[0])) {
Matcher matcher = end_attribute.matcher(curLine); Matcher matcher = end_attribute.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)), AssociationType.END); TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
AssociationType.END);
generator.endAttrs.add(attrType); generator.endAttrs.add(attrType);
} }
} else if(")".equals(tokens[0])){ } else if (")".equals(tokens[0])) {
generator=null; generator = null;
} else if("a".equals(tokens[0])){//matcher = line =~ /^a\s+(.+)$/ } else if ("a".equals(tokens[0])) {// matcher = line =~ /^a\s+(.+)$/
System.out.println("Don't know what to do with: '"+curLine+"'"); System.out.println("Don't know what to do with: '" + curLine + "'");
} else } else
System.out.println("Don't know what to do with: '"+curLine+"'"); System.out.println("Don't know what to do with: '" + curLine + "'");
return nextLine; return nextLine;
} }
/**
* Gets the attr string.
*
* @param attrType the attr type
* @param string the string
* @return the attr string
*/
private String getAttrString(TxAttributeType attrType, String string) { private String getAttrString(TxAttributeType attrType, String string) {
String value; String value;
switch(attrType.getDataType()){ switch (attrType.getDataType()) {
case STRING: case STRING:
case ENUMERATION: case ENUMERATION:
value=string.substring(1, string.length()-1); value = string.substring(1, string.length() - 1);
break; break;
default: default:
value=string; value = string;
} }
if(attrValueLut.containsKey(value)){ if (attrValueLut.containsKey(value)) {
return loader.attrValues.get(attrValueLut.get(value)); return loader.attrValues.get(attrValueLut.get(value));
} else { } else {
attrValueLut.put(value, loader.attrValues.size()); attrValueLut.put(value, loader.attrValues.size());
@ -361,20 +475,38 @@ public class TextDbLoader implements IWaveformDbLoader{
} }
} }
private long stringToScale(String scale){ /**
* String to scale.
*
* @param scale the scale
* @return the long
*/
private long stringToScale(String scale) {
String cmp = scale.trim(); String cmp = scale.trim();
if("fs".equals(cmp)) return 1L; if ("fs".equals(cmp))
if("ps".equals(cmp)) return 1000L; return 1L;
if("ns".equals(cmp)) return 1000000L; if ("ps".equals(cmp))
if("us".equals(cmp)) return 1000000000L; return 1000L;
if("ms".equals(cmp)) return 1000000000000L; if ("ns".equals(cmp))
if("s".equals(cmp) ) return 1000000000000000L; return 1000000L;
if ("us".equals(cmp))
return 1000000000L;
if ("ms".equals(cmp))
return 1000000000000L;
if ("s".equals(cmp))
return 1000000000000000L;
return 1L; return 1L;
} }
} }
/**
* Gets the transaction.
*
* @param txId the tx id
* @return the transaction
*/
public ITx getTransaction(long txId) { public ITx getTransaction(long txId) {
if(txCache.containsKey(txId)) if (txCache.containsKey(txId))
return txCache.get(txId); return txCache.get(txId);
Tx tx = new Tx(this, txId); Tx tx = new Tx(this, txId);
txCache.put(txId, tx); txCache.put(txId, tx);
@ -382,4 +514,3 @@ public class TextDbLoader implements IWaveformDbLoader{
} }
} }

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -21,111 +22,217 @@ import com.minres.scviewer.database.tx.ITxAttribute;
import com.minres.scviewer.database.tx.ITxGenerator; import com.minres.scviewer.database.tx.ITxGenerator;
import com.minres.scviewer.database.tx.ITxRelation; import com.minres.scviewer.database.tx.ITxRelation;
/**
* The Class Tx.
*/
class Tx implements ITx { class Tx implements ITx {
/** The loader. */
private final TextDbLoader loader; private final TextDbLoader loader;
/** The id. */
private long id; private long id;
long beginTime=-1; /** The begin time. */
long beginTime = -1;
long endTime=-1;
/** The end time. */
long endTime = -1;
/** The concurrency index. */
private int concurrencyIndex; private int concurrencyIndex;
/**
* Instantiates a new tx.
*
* @param loader the loader
* @param scvTx the scv tx
*/
public Tx(TextDbLoader loader, ScvTx scvTx) { public Tx(TextDbLoader loader, ScvTx scvTx) {
this.loader=loader; this.loader = loader;
id=scvTx.id; id = scvTx.id;
} }
/**
* Instantiates a new tx.
*
* @param loader the loader
* @param txId the tx id
*/
public Tx(TextDbLoader loader, long txId) { public Tx(TextDbLoader loader, long txId) {
this.loader=loader; this.loader = loader;
id=txId; id = txId;
} }
/**
* Gets the incoming relations.
*
* @return the incoming relations
*/
@Override @Override
public Collection<ITxRelation> getIncomingRelations() { public Collection<ITxRelation> getIncomingRelations() {
Set<ScvRelation> rels = loader.relationsIn.get(id); Set<ScvRelation> rels = loader.relationsIn.get(id);
return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList()); return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList());
} }
/**
* Gets the outgoing relations.
*
* @return the outgoing relations
*/
@Override @Override
public Collection<ITxRelation> getOutgoingRelations() { public Collection<ITxRelation> getOutgoingRelations() {
Set<ScvRelation> rels = loader.relationsOut.get(id); Set<ScvRelation> rels = loader.relationsOut.get(id);
return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList()); return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList());
} }
/**
* Compare to.
*
* @param o the o
* @return the int
*/
@Override @Override
public int compareTo(ITx o) { public int compareTo(ITx o) {
int res =getBeginTime().compareTo(o.getBeginTime()); int res = getBeginTime().compareTo(o.getBeginTime());
if(res!=0) if (res != 0)
return res; return res;
else else
return getId().compareTo(o.getId()); return getId().compareTo(o.getId());
} }
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
return this.getScvTx().equals(((Tx) obj).getScvTx());
}
/**
* Equals.
*
* @param obj the obj
* @return true, if successful
*/
@Override @Override
public int hashCode() { public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
return this.getScvTx().equals(((Tx) obj).getScvTx());
}
/**
* Hash code.
*
* @return the int
*/
@Override
public int hashCode() {
return getScvTx().hashCode(); return getScvTx().hashCode();
} }
/**
* To string.
*
* @return the string
*/
@Override @Override
public String toString() { public String toString() {
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]"; return "tx#" + getId() + "[" + getBeginTime() / 1000000 + "ns - " + getEndTime() / 1000000 + "ns]";
} }
/**
* Gets the id.
*
* @return the id
*/
@Override @Override
public Long getId() { public Long getId() {
return getScvTx().id; return getScvTx().id;
} }
/**
* Gets the stream.
*
* @return the stream
*/
@Override @Override
public IWaveform getStream() { public IWaveform getStream() {
return loader.txStreams.get(getScvTx().streamId); return loader.txStreams.get(getScvTx().streamId);
} }
/**
* Gets the generator.
*
* @return the generator
*/
@Override @Override
public ITxGenerator getGenerator() { public ITxGenerator getGenerator() {
return loader.txGenerators.get(getScvTx().generatorId); return loader.txGenerators.get(getScvTx().generatorId);
} }
/**
* Gets the begin time.
*
* @return the begin time
*/
@Override @Override
public Long getBeginTime() { public Long getBeginTime() {
if(beginTime<0) beginTime=getScvTx().beginTime; if (beginTime < 0)
beginTime = getScvTx().beginTime;
return beginTime; return beginTime;
} }
/**
* Gets the end time.
*
* @return the end time
*/
@Override @Override
public Long getEndTime() { public Long getEndTime() {
if(endTime<0) endTime=getScvTx().endTime; if (endTime < 0)
endTime = getScvTx().endTime;
return endTime; return endTime;
} }
/**
* Sets the end time.
*
* @param time the new end time
*/
void setEndTime(Long time) { void setEndTime(Long time) {
getScvTx().endTime=time; getScvTx().endTime = time;
} }
/**
* Gets the concurrency index.
*
* @return the concurrency index
*/
@Override @Override
public int getConcurrencyIndex() { public int getConcurrencyIndex() {
return concurrencyIndex; return concurrencyIndex;
} }
/**
* Sets the concurrency index.
*
* @param idx the new concurrency index
*/
void setConcurrencyIndex(int idx) { void setConcurrencyIndex(int idx) {
concurrencyIndex=idx; concurrencyIndex = idx;
} }
/**
* Gets the attributes.
*
* @return the attributes
*/
@Override @Override
public List<ITxAttribute> getAttributes() { public List<ITxAttribute> getAttributes() {
return getScvTx().attributes; return getScvTx().attributes;
} }
/**
* Gets the scv tx.
*
* @return the scv tx
*/
private ScvTx getScvTx() { private ScvTx getScvTx() {
return loader.transactions.get(id); return loader.transactions.get(id);
} }

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,37 +17,66 @@ import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.tx.ITxAttribute; import com.minres.scviewer.database.tx.ITxAttribute;
public class TxAttribute implements ITxAttribute, Serializable { /**
* The Class TxAttribute.
/** */
* public class TxAttribute implements ITxAttribute, Serializable {
*/
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 4767726016651807152L; private static final long serialVersionUID = 4767726016651807152L;
/** The attribute type. */
private final TxAttributeType attributeType; private final TxAttributeType attributeType;
/** The value. */
private final String value; private final String value;
TxAttribute(TxAttributeType type, String value){ /**
this.attributeType=type; * Instantiates a new tx attribute.
this.value=value; *
* @param type the type
* @param value the value
*/
TxAttribute(TxAttributeType type, String value) {
this.attributeType = type;
this.value = value;
} }
/**
* Gets the name.
*
* @return the name
*/
@Override @Override
public String getName() { public String getName() {
return attributeType.getName(); return attributeType.getName();
} }
/**
* Gets the type.
*
* @return the type
*/
@Override @Override
public AssociationType getType() { public AssociationType getType() {
return attributeType.getType(); return attributeType.getType();
} }
/**
* Gets the data type.
*
* @return the data type
*/
@Override @Override
public DataType getDataType() { public DataType getDataType() {
return attributeType.getDataType(); return attributeType.getDataType();
} }
/**
* Gets the value.
*
* @return the value
*/
@Override @Override
public Object getValue() { public Object getValue() {
return value; return value;

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,34 +17,61 @@ import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.tx.ITxAttributeType; import com.minres.scviewer.database.tx.ITxAttributeType;
/**
* The Class TxAttributeType.
*/
class TxAttributeType implements ITxAttributeType, Serializable { class TxAttributeType implements ITxAttributeType, Serializable {
/**
* /** The Constant serialVersionUID. */
*/
private static final long serialVersionUID = 7159721937208946828L; private static final long serialVersionUID = 7159721937208946828L;
/** The name. */
private String name; private String name;
/** The data type. */
private DataType dataType; private DataType dataType;
/** The type. */
private AssociationType type; private AssociationType type;
TxAttributeType(String name, DataType dataType, AssociationType type){ /**
this.name=name; * Instantiates a new tx attribute type.
this.dataType=dataType; *
this.type=type; * @param name the name
* @param dataType the data type
* @param type the type
*/
TxAttributeType(String name, DataType dataType, AssociationType type) {
this.name = name;
this.dataType = dataType;
this.type = type;
} }
/**
* Gets the name.
*
* @return the name
*/
@Override @Override
public String getName() { public String getName() {
return name; return name;
} }
/**
* Gets the data type.
*
* @return the data type
*/
@Override @Override
public DataType getDataType() { public DataType getDataType() {
return dataType; return dataType;
} }
/**
* Gets the type.
*
* @return the type
*/
@Override @Override
public AssociationType getType() { public AssociationType getType() {
return type; return type;

View File

@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2020 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.text; package com.minres.scviewer.database.text;
import com.minres.scviewer.database.EventKind; import com.minres.scviewer.database.EventKind;
@ -5,50 +15,94 @@ import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITx;
import com.minres.scviewer.database.tx.ITxEvent; import com.minres.scviewer.database.tx.ITxEvent;
/**
* The Class TxEvent.
*/
class TxEvent implements ITxEvent { class TxEvent implements ITxEvent {
/** The loader. */
final TextDbLoader loader; final TextDbLoader loader;
/** The kind. */
final EventKind kind; final EventKind kind;
final Long transaction; /** The transaction. */
final long transaction;
final Long time;
/** The time. */
final long time;
/**
* Instantiates a new tx event.
*
* @param loader the loader
* @param kind the kind
* @param transaction the transaction
* @param time the time
*/
TxEvent(TextDbLoader loader, EventKind kind, Long transaction, Long time) { TxEvent(TextDbLoader loader, EventKind kind, Long transaction, Long time) {
this.loader=loader; this.loader = loader;
this.kind = kind; this.kind = kind;
this.transaction = transaction; this.transaction = transaction;
this.time = time; this.time = time;
} }
/**
* Duplicate.
*
* @return the i tx event
* @throws CloneNotSupportedException the clone not supported exception
*/
@Override @Override
public public ITxEvent duplicate() throws CloneNotSupportedException {
ITxEvent duplicate() throws CloneNotSupportedException {
return new TxEvent(loader, kind, transaction, time); return new TxEvent(loader, kind, transaction, time);
} }
/**
* To string.
*
* @return the string
*/
@Override @Override
public public String toString() {
String toString() { return kind.toString() + "@" + time + " of tx #" + transaction;
return kind.toString()+"@"+time+" of tx #"+transaction;
} }
/**
* Gets the type.
*
* @return the type
*/
@Override @Override
public WaveformType getType() { public WaveformType getType() {
return WaveformType.TRANSACTION; return WaveformType.TRANSACTION;
} }
/**
* Gets the kind.
*
* @return the kind
*/
@Override @Override
public EventKind getKind() { public EventKind getKind() {
return kind; return kind;
} }
/**
* Gets the time.
*
* @return the time
*/
@Override @Override
public Long getTime() { public Long getTime() {
return time; return time;
} }
/**
* Gets the transaction.
*
* @return the transaction
*/
@Override @Override
public ITx getTransaction() { public ITx getTransaction() {
return loader.getTransaction(transaction); return loader.getTransaction(transaction);

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,51 +14,93 @@ package com.minres.scviewer.database.text;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.tx.ITxGenerator; import com.minres.scviewer.database.tx.ITxGenerator;
class TxGenerator extends HierNode implements ITxGenerator { /**
* The Class TxGenerator.
*/
class TxGenerator extends AbstractTxStream implements ITxGenerator {
Long id; /** The stream. */
TxStream stream;
IWaveform stream; /** The begin attrs. */
Boolean active = false;
List<TxAttributeType> beginAttrs = new ArrayList<>(); List<TxAttributeType> beginAttrs = new ArrayList<>();
List<TxAttributeType> endAttrs= new ArrayList<>();
TxGenerator(Long id, TxStream stream, String name){ /** The end attrs. */
super(name, stream); List<TxAttributeType> endAttrs = new ArrayList<>();
this.id=id;
this.stream=stream; /**
} * Instantiates a new tx generator.
*
@Override * @param loader the loader
public Long getId() { * @param id the id
return id; * @param name the name
* @param stream the stream
*/
TxGenerator(TextDbLoader loader, Long id, String name, TxStream stream) {
super(loader, id, name);
this.stream = stream;
stream.addChild(this);
} }
/**
* Gets the stream.
*
* @return the stream
*/
@Override @Override
public IWaveform getStream(){ public IWaveform getStream() {
return stream; return stream;
} }
/**
* Checks if is same.
*
* @param other the other
* @return true, if is same
*/
@Override @Override
public String getName() { public boolean isSame(IWaveform other) {
return name; return (other instanceof TxGenerator && this.getId().equals(other.getId()));
} }
/**
* Gets the begin attrs.
*
* @return the begin attrs
*/
public List<TxAttributeType> getBeginAttrs() { public List<TxAttributeType> getBeginAttrs() {
return beginAttrs; return beginAttrs;
} }
/**
* Gets the end attrs.
*
* @return the end attrs
*/
public List<TxAttributeType> getEndAttrs() { public List<TxAttributeType> getEndAttrs() {
return endAttrs; return endAttrs;
} }
Boolean isActive() {return active;}
/**
* Gets the kind.
*
* @return the kind
*/
@Override
public String getKind() {
return stream.getKind();
}
/**
* Gets the width.
*
* @return the width
*/
@Override
public int getWidth() {
return stream.getWidth();
}
} }

View File

@ -1,30 +1,66 @@
/*******************************************************************************
* Copyright (c) 2020 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.text; package com.minres.scviewer.database.text;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITx;
import com.minres.scviewer.database.tx.ITxRelation; import com.minres.scviewer.database.tx.ITxRelation;
/**
* The Class TxRelation.
*/
class TxRelation implements ITxRelation { class TxRelation implements ITxRelation {
/** The loader. */
final TextDbLoader loader; final TextDbLoader loader;
/** The scv relation. */
final ScvRelation scvRelation; final ScvRelation scvRelation;
/**
* Instantiates a new tx relation.
*
* @param loader the loader
* @param scvRelation the scv relation
*/
public TxRelation(TextDbLoader loader, ScvRelation scvRelation) { public TxRelation(TextDbLoader loader, ScvRelation scvRelation) {
this.loader = loader; this.loader = loader;
this.scvRelation = scvRelation; this.scvRelation = scvRelation;
} }
/**
* Gets the relation type.
*
* @return the relation type
*/
@Override @Override
public RelationType getRelationType() { public RelationType getRelationType() {
return scvRelation.relationType; return scvRelation.relationType;
} }
/**
* Gets the source.
*
* @return the source
*/
@Override @Override
public ITx getSource() { public ITx getSource() {
return loader.getTransaction(scvRelation.source); return loader.getTransaction(scvRelation.source);
} }
/**
* Gets the target.
*
* @return the target
*/
@Override @Override
public ITx getTarget() { public ITx getTarget() {
return loader.getTransaction(scvRelation.target); return loader.getTransaction(scvRelation.target);

View File

@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IT Just working. * Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,129 +11,84 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.text; package com.minres.scviewer.database.text;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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.IWaveform;
import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.tx.ITxEvent;
import com.minres.scviewer.database.tx.ITxGenerator;
class TxStream extends HierNode implements IWaveform { /**
* The Class TxStream.
*/
class TxStream extends AbstractTxStream {
private Long id; /** The kind. */
private TextDbLoader loader;
final String kind; final String kind;
/**
* Instantiates a new tx stream.
*
* @param loader the loader
* @param id the id
* @param name the name
* @param kind the kind
*/
TxStream(TextDbLoader loader, Long id, String name, String kind) {
super(loader, id, name);
this.kind = kind;
}
/**
* Checks if is same.
*
* @param other the other
* @return true, if is same
*/
@Override
public boolean isSame(IWaveform other) {
return (other instanceof TxStream && this.getId().equals(other.getId()));
}
/**
* Gets the kind.
*
* @return the kind
*/
@Override
public String getKind() {
return kind;
}
/** The max concurrency. */
private int maxConcurrency = 0; private int maxConcurrency = 0;
/** The concurrency. */
private int concurrency = 0; private int concurrency = 0;
boolean concurrencyCalculated = false; /**
* Sets the concurrency.
*
* @param concurrency the new concurrency
*/
void setConcurrency(int concurrency) { void setConcurrency(int concurrency) {
this.concurrency = concurrency; this.concurrency = concurrency;
if(concurrency>maxConcurrency) if (concurrency > maxConcurrency)
maxConcurrency = concurrency; maxConcurrency = concurrency;
} }
/**
* Gets the concurrency.
*
* @return the concurrency
*/
int getConcurrency() { int getConcurrency() {
return this.concurrency; return this.concurrency;
} }
TreeMap<Long, IEvent[]> events = new TreeMap<>(); /**
* Gets the width.
TxStream(TextDbLoader loader, Long id, String name, String kind){ *
super(name); * @return the width
this.id=id; */
this.loader=loader;
this.kind=kind;
}
List<ITxGenerator> getGenerators(){
return new ArrayList<>(loader.txGenerators.values());
}
@Override @Override
public int getWidth() { public int getWidth() {
return maxConcurrency; return maxConcurrency;
} }
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);
}
}
@Override
public NavigableMap<Long, IEvent[]> getEvents() {
if(!concurrencyCalculated) calculateConcurrency();
return events;
}
@Override
public IEvent[] getEventsAtTime(Long time) {
if(!concurrencyCalculated) calculateConcurrency();
return events.get(time);
}
@Override
public boolean isSame(IWaveform other) {
return(other instanceof TxStream && this.getId().equals(other.getId()));
}
@Override
public IEvent[] getEventsBeforeTime(Long time) {
if(!concurrencyCalculated)
calculateConcurrency();
Entry<Long, IEvent[]> e = events.floorEntry(time);
if(e==null)
return new IEvent[] {};
else
return events.floorEntry(time).getValue();
}
@Override
public WaveformType getType() {
return WaveformType.TRANSACTION;
}
@Override
public Long getId() {
return id;
}
synchronized void calculateConcurrency() {
if(concurrencyCalculated) 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();
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;
}
} }

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others. # Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Control;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.RelationTypeFactory; import com.minres.scviewer.database.RelationTypeFactory;
import com.minres.scviewer.database.tx.ITx;
public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{ public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{
@ -64,7 +65,9 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
public List<TrackEntry> getStreamList(); public List<TrackEntry> getStreamList();
public TrackEntry getEntryForStream(IWaveform source); public TrackEntry getEntryFor(ITx source);
public TrackEntry getEntryFor(IWaveform source);
public List<Object> getElementsAt(Point pt); public List<Object> getElementsAt(Point pt);

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.NavigableMap; import java.util.NavigableMap;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -696,30 +697,36 @@ public class WaveformView implements IWaveformView {
boolean selectionChanged = false; boolean selectionChanged = false;
currentWaveformSelection.forEach(e->e.selected=false); currentWaveformSelection.forEach(e->e.selected=false);
if (selection instanceof IStructuredSelection) { if (selection instanceof IStructuredSelection) {
if(((IStructuredSelection) selection).size()==0){ IStructuredSelection sel = (IStructuredSelection) selection;
if(sel.size()==0){
selectionChanged = currentTxSelection!=null||currentWaveformSelection!=null; selectionChanged = currentTxSelection!=null||currentWaveformSelection!=null;
currentTxSelection = null; currentTxSelection = null;
currentWaveformSelection .clear(); currentWaveformSelection .clear();
} else { } else {
if(!add) currentWaveformSelection.clear(); if(!add) currentWaveformSelection.clear();
for(Object sel:((IStructuredSelection) selection).toArray()){ List<?> selList = sel.toList();
if (sel instanceof ITx){ if(selList.get(0) instanceof ITx) {
ITx txSel = (ITx) sel; ITx txSel = (ITx) selList.get(0);
TrackEntry trackEntry = getEntryForStream(txSel.getStream()); TrackEntry trackEntry = selList.size()==2 && selList.get(1) instanceof TrackEntry?
(TrackEntry) selList.get(1):null;
if(trackEntry==null) {
trackEntry = getEntryFor(txSel);
if(trackEntry==null && addIfNeeded){ if(trackEntry==null && addIfNeeded){
trackEntry=new TrackEntry(txSel.getStream(), styleProvider); trackEntry=new TrackEntry(txSel.getStream(), styleProvider);
streams.add(trackEntry); streams.add(trackEntry);
} }
currentTxSelection = txSel; }
currentWaveformSelection.clear(); currentTxSelection = txSel;
currentWaveformSelection.add(trackEntry); currentWaveformSelection.clear();
selectionChanged = true; currentWaveformSelection.add(trackEntry);
} else if (sel instanceof TrackEntry && !currentWaveformSelection.contains(sel)) { selectionChanged = true;
currentWaveformSelection.add((TrackEntry)sel); } else if(selList.size()==1 && selList.get(0) instanceof TrackEntry) {
if(currentTxSelection!=null && !selectionChanged) currentWaveformSelection.add((TrackEntry)selList.get(0));
currentTxSelection=null; if(currentTxSelection!=null)
selectionChanged = true; currentTxSelection=null;
} selectionChanged = true;
} else {
System.err.println("Invalid selection");
} }
} }
} else { } else {
@ -773,7 +780,7 @@ public class WaveformView implements IWaveformView {
public void moveSelection(GotoDirection direction, RelationType relationType) { public void moveSelection(GotoDirection direction, RelationType relationType) {
if(currentWaveformSelection.size() !=1 && currentTxSelection==null) return; if(currentWaveformSelection.size() !=1 && currentTxSelection==null) return;
TrackEntry selectedWaveform=currentWaveformSelection.size() == 1? TrackEntry selectedWaveform=currentWaveformSelection.size() == 1?
currentWaveformSelection.get(0) : getEntryForStream(currentTxSelection.getStream()); currentWaveformSelection.get(0) : getEntryFor(currentTxSelection);
if(selectedWaveform.waveform.getType()==WaveformType.TRANSACTION && currentTxSelection!=null) { if(selectedWaveform.waveform.getType()==WaveformType.TRANSACTION && currentTxSelection!=null) {
if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){ if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
ITx transaction = null; ITx transaction = null;
@ -1167,9 +1174,21 @@ public class WaveformView implements IWaveformView {
}); });
} }
public TrackEntry getEntryForStream(IWaveform source) { public TrackEntry getEntryFor(ITx source) {
for(TrackEntry trackEntry:streams) Optional<TrackEntry> optGen = streams.stream().filter(e->source.getGenerator().equals(e.waveform)).findFirst();
if(trackEntry.waveform.isSame(source)) return trackEntry; if(optGen.isPresent())
return optGen.get();
Optional<TrackEntry> optStr = streams.stream().filter(e->source.getStream().equals(e.waveform)).findFirst();
if(optStr.isPresent())
return optStr.get();
return null;
}
@Override
public TrackEntry getEntryFor(IWaveform source) {
Optional<TrackEntry> optGen = streams.stream().filter(e->source.equals(e.waveform)).findFirst();
if(optGen.isPresent())
return optGen.get();
return null; return null;
} }

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others. # Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -113,4 +113,9 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
return width; return width;
} }
@Override
public String getKind() {
return "signal";
}
} }

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others. # Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,6 +10,15 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database; package com.minres.scviewer.database;
/**
* The Enum AssociationType.
*/
public enum AssociationType { public enum AssociationType {
BEGIN, RECORD, END
/** The begin. */
BEGIN,
/** The record. */
RECORD,
/** The end. */
END
} }

View File

@ -1,68 +1,125 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
/**
* The Enum BitValue.
*/
public enum BitValue { public enum BitValue {
ZERO,
ONE,
X,
Z;
private static final BitValue[] ORDINAL_TABLE = BitValue.values(); /** The zero. */
ZERO,
public static BitValue fromChar(char c) { /** The one. */
switch (c) { ONE,
case '0':
return ZERO;
case '1':
return ONE;
case 'x':
case 'X':
return X;
case 'z':
case 'Z':
return Z;
default:
throw new NumberFormatException("unknown digit " + c);
}
}
public char toChar() { /** The x. */
switch (this) { X,
case ZERO:
return '0';
case ONE:
return '1';
case X:
return 'x';
case Z:
return 'z';
}
return ' '; // Unreachable? /** The z. */
} Z;
public static BitValue fromInt(int i) { /** The Constant ORDINAL_TABLE. */
if (i == 0) { private static final BitValue[] ORDINAL_TABLE = BitValue.values();
return ZERO;
} else {
return ONE;
}
}
public int toInt() { /**
return (this == ONE) ? 1 : 0; * From char.
} *
* @param c the c
* @return the bit value
*/
public static BitValue fromChar(char c) {
switch (c) {
case '0':
return ZERO;
case '1':
return ONE;
case 'x':
case 'X':
return X;
case 'z':
case 'Z':
return Z;
default:
throw new NumberFormatException("unknown digit " + c);
}
}
public static BitValue fromOrdinal(int ord) { /**
return ORDINAL_TABLE[ord]; * To char.
} *
* @return the char
*/
public char toChar() {
switch (this) {
case ZERO:
return '0';
case ONE:
return '1';
case X:
return 'x';
case Z:
return 'z';
}
public int compare(BitValue other) { return ' '; // Unreachable?
if (this == ONE && other == ZERO) { }
return 1;
} else if (this == ZERO && other == ONE) { /**
return -1; * From int.
} else { *
// Either these are equal, or there is an X and Z, which match everything. * @param i the i
return 0; * @return the bit value
} */
} public static BitValue fromInt(int i) {
if (i == 0) {
return ZERO;
} else {
return ONE;
}
}
/**
* To int.
*
* @return the int
*/
public int toInt() {
return (this == ONE) ? 1 : 0;
}
/**
* From ordinal.
*
* @param ord the ord
* @return the bit value
*/
public static BitValue fromOrdinal(int ord) {
return ORDINAL_TABLE[ord];
}
/**
* Compare.
*
* @param other the other
* @return the int
*/
public int compare(BitValue other) {
if (this == ONE && other == ZERO) {
return 1;
} else if (this == ZERO && other == ONE) {
return -1;
} else {
// Either these are equal, or there is an X and Z, which match everything.
return 0;
}
}
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,34 +10,56 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database; package com.minres.scviewer.database;
/**
* The Class BitVector.
*/
public class BitVector implements IEvent { public class BitVector implements IEvent {
/** The width. */
private final int width; private final int width;
/** The packed values. */
private int[] packedValues; private int[] packedValues;
/**
* Instantiates a new bit vector.
*
* @param netWidth the net width
*/
public BitVector(int netWidth) { public BitVector(int netWidth) {
this.width=netWidth; this.width = netWidth;
packedValues = new int[(netWidth+15)/16]; packedValues = new int[(netWidth + 15) / 16];
for(int i=0; i<packedValues.length; i++) packedValues[i]=0; for (int i = 0; i < packedValues.length; i++)
packedValues[i] = 0;
} }
/**
* Sets the value.
*
* @param i the i
* @param value the value
*/
public void setValue(int i, BitValue value) { public void setValue(int i, BitValue value) {
int bitIndex = i*2; int bitIndex = i * 2;
int wordOffset = bitIndex >> 5; int wordOffset = bitIndex >> 5;
int bitOffset = bitIndex & 31; int bitOffset = bitIndex & 31;
packedValues[wordOffset] &= ~(3 << bitOffset); packedValues[wordOffset] &= ~(3 << bitOffset);
packedValues[wordOffset] |= value.ordinal() << bitOffset; packedValues[wordOffset] |= value.ordinal() << bitOffset;
} }
/**
* Gets the value.
*
* @return the value
*/
public char[] getValue() { public char[] getValue() {
int bitOffset = 0; int bitOffset = 0;
int wordOffset = 0; int wordOffset = 0;
char[] res = new char[width]; char[] res = new char[width];
// Copy values out of packed array // Copy values out of packed array
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
int currentWord = (packedValues[wordOffset] >> bitOffset)&3; int currentWord = (packedValues[wordOffset] >> bitOffset) & 3;
res[width-i-1]=BitValue.fromInt(currentWord).toChar(); res[width - i - 1] = BitValue.fromInt(currentWord).toChar();
bitOffset += 2; bitOffset += 2;
if (bitOffset == 32) { if (bitOffset == 32) {
wordOffset++; wordOffset++;
@ -47,6 +69,11 @@ public class BitVector implements IEvent {
return res; return res;
} }
/**
* Sets the value.
*
* @param value the new value
*/
public void setValue(char[] value) { public void setValue(char[] value) {
int bitIndex = width; int bitIndex = width;
int wordOffset = bitIndex >> 4; int wordOffset = bitIndex >> 4;
@ -61,41 +88,61 @@ public class BitVector implements IEvent {
} }
} }
/**
* Gets the width.
*
* @return the width
*/
public int getWidth() { public int getWidth() {
return width; return width;
} }
public String toString(){ /**
* To string.
*
* @return the string
*/
public String toString() {
return new String(getValue()); return new String(getValue());
} }
public String toHexString(){ /**
int resWidth=(width-1)/4+1; * To hex string.
char[] value=getValue(); *
* @return the string
*/
public String toHexString() {
int resWidth = (width - 1) / 4 + 1;
char[] value = getValue();
char[] res = new char[resWidth]; char[] res = new char[resWidth];
for(int i=resWidth-1; i>=0; i--){ for (int i = resWidth - 1; i >= 0; i--) {
int digit=0; int digit = 0;
for(int j=3; j>=0; j--){ for (int j = 3; j >= 0; j--) {
if((4*i+j)<value.length) { if ((4 * i + j) < value.length) {
BitValue val = BitValue.fromChar(value[4*i+j]); BitValue val = BitValue.fromChar(value[4 * i + j]);
switch(val) { switch (val) {
case X: case X:
case Z: case Z:
res[i]=val.toChar(); res[i] = val.toChar();
continue; continue;
case ONE: case ONE:
digit+=1<<(3-j); digit += 1 << (3 - j);
break; break;
default: default:
break; break;
} }
} }
} }
res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10) res[i] = Character.forDigit(digit, 16); // ((digit < 10) ? '0' + digit : 'a' + digit -10)
} }
return new String(res); return new String(res);
} }
/**
* To unsigned value.
*
* @return the long
*/
public long toUnsignedValue() { public long toUnsignedValue() {
long res = 0; long res = 0;
int bitOffset = 0; int bitOffset = 0;
@ -103,10 +150,11 @@ public class BitVector implements IEvent {
int currentWord = 0; int currentWord = 0;
// Copy values out of packed array // Copy values out of packed array
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
if(bitOffset==0) currentWord = packedValues[wordOffset]; if (bitOffset == 0)
currentWord = packedValues[wordOffset];
switch (currentWord & 3) { switch (currentWord & 3) {
case 1: case 1:
res|=1<<i; res |= 1 << i;
break; break;
case 2: case 2:
case 3: case 3:
@ -125,20 +173,26 @@ public class BitVector implements IEvent {
return res; return res;
} }
/**
* To signed value.
*
* @return the long
*/
public long toSignedValue() { public long toSignedValue() {
long res = 0; long res = 0;
int bitOffset = 0; int bitOffset = 0;
int wordOffset = 0; int wordOffset = 0;
int currentWord = 0; int currentWord = 0;
int lastVal=0; int lastVal = 0;
// Copy values out of packed array // Copy values out of packed array
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
if(bitOffset==0) currentWord = packedValues[wordOffset]; if (bitOffset == 0)
lastVal=0; currentWord = packedValues[wordOffset];
lastVal = 0;
switch (currentWord & 3) { switch (currentWord & 3) {
case 1: case 1:
res|=1<<i; res |= 1 << i;
lastVal=1; lastVal = 1;
break; break;
case 2: case 2:
case 3: case 3:
@ -153,24 +207,39 @@ public class BitVector implements IEvent {
currentWord >>= 2; currentWord >>= 2;
} }
} }
if(lastVal!=0) if (lastVal != 0)
res |= -1l<<width; res |= -1l << width;
return res; return res;
} }
/**
* Gets the kind.
*
* @return the kind
*/
@Override @Override
public EventKind getKind() { public EventKind getKind() {
return EventKind.SINGLE; return EventKind.SINGLE;
} }
/**
* Gets the type.
*
* @return the type
*/
@Override @Override
public WaveformType getType() { public WaveformType getType() {
return WaveformType.SIGNAL; return WaveformType.SIGNAL;
} }
/**
* Duplicate.
*
* @return the i event
* @throws CloneNotSupportedException the clone not supported exception
*/
@Override @Override
public IEvent duplicate() throws CloneNotSupportedException { public IEvent duplicate() throws CloneNotSupportedException {
return (IEvent)this.clone(); return (IEvent) this.clone();
} }
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,19 +10,47 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database; package com.minres.scviewer.database;
/**
* The Enum DataType.
*/
public enum DataType { public enum DataType {
BOOLEAN, // bool
ENUMERATION, // enum /** The boolean. */
INTEGER, // char, short, int, long, long long, sc_int, sc_bigint BOOLEAN,
/** The enumeration. */
// bool
ENUMERATION,
/** The integer. */
// enum
INTEGER,
/** The unsigned. */
// char, short, int, long, long long, sc_int, sc_bigint
UNSIGNED, // unsigned { char, short, int, long, long long }, sc_uint, UNSIGNED, // unsigned { char, short, int, long, long long }, sc_uint,
// sc_biguint /** The floating point number. */
FLOATING_POINT_NUMBER, // float, double // sc_biguint
BIT_VECTOR, // sc_bit, sc_bv FLOATING_POINT_NUMBER,
LOGIC_VECTOR, // sc_logic, sc_lv /** The bit vector. */
FIXED_POINT_INTEGER, // sc_fixed // float, double
UNSIGNED_FIXED_POINT_INTEGER, // sc_ufixed BIT_VECTOR,
RECORD, // struct/class /** The logic vector. */
POINTER, // T* // sc_bit, sc_bv
ARRAY, // T[N] LOGIC_VECTOR,
/** The fixed point integer. */
// sc_logic, sc_lv
FIXED_POINT_INTEGER,
/** The unsigned fixed point integer. */
// sc_fixed
UNSIGNED_FIXED_POINT_INTEGER,
/** The record. */
// sc_ufixed
RECORD,
/** The pointer. */
// struct/class
POINTER,
/** The array. */
// T*
ARRAY,
/** The string. */
// T[N]
STRING // string, std::string STRING // string, std::string
} }

View File

@ -1,23 +1,58 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
/**
* The Class DoubleVal.
*/
public class DoubleVal implements IEvent { public class DoubleVal implements IEvent {
/** The value. */
public final double value; public final double value;
/**
* Instantiates a new double val.
*
* @param value the value
*/
public DoubleVal(double value) { public DoubleVal(double value) {
this.value=value; this.value = value;
} }
/**
* Gets the kind.
*
* @return the kind
*/
@Override @Override
public EventKind getKind() { public EventKind getKind() {
return EventKind.SINGLE; return EventKind.SINGLE;
} }
/**
* Gets the type.
*
* @return the type
*/
@Override @Override
public WaveformType getType() { public WaveformType getType() {
return WaveformType.SIGNAL; return WaveformType.SIGNAL;
} }
/**
* Duplicate.
*
* @return the i event
* @throws CloneNotSupportedException the clone not supported exception
*/
@Override @Override
public IEvent duplicate() throws CloneNotSupportedException { public IEvent duplicate() throws CloneNotSupportedException {
return (IEvent) clone(); return (IEvent) clone();

View File

@ -1,5 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
/**
* The Enum EventKind.
*/
public enum EventKind { public enum EventKind {
SINGLE, BEGIN, END
/** The single. */
SINGLE,
/** The begin. */
BEGIN,
/** The end. */
END
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,76 +15,154 @@ import java.beans.PropertyChangeSupport;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The Class HierNode.
*/
public class HierNode implements IHierNode { public class HierNode implements IHierNode {
/** The name. */
protected String name; protected String name;
/** The parent. */
protected IHierNode parent = null; protected IHierNode parent = null;
/** The childs. */
protected ArrayList<IHierNode> childs; protected ArrayList<IHierNode> childs;
/** The pcs. */
protected PropertyChangeSupport pcs; protected PropertyChangeSupport pcs;
/**
* Instantiates a new hier node.
*/
public HierNode() { public HierNode() {
childs = new ArrayList<>(); childs = new ArrayList<>();
pcs=new PropertyChangeSupport(this); pcs = new PropertyChangeSupport(this);
} }
/**
* Instantiates a new hier node.
*
* @param name the name
*/
public HierNode(String name) { public HierNode(String name) {
this(); this();
this.name=name; this.name = name;
} }
/**
* Instantiates a new hier node.
*
* @param name the name
* @param parent the parent
*/
public HierNode(String name, IHierNode parent) { public HierNode(String name, IHierNode parent) {
this(); this();
this.name=name; this.name = name;
this.parent=parent; this.parent = parent;
} }
/**
* Adds the property change listener.
*
* @param l the l
*/
@Override @Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l); pcs.addPropertyChangeListener(l);
} }
/**
* Removes the property change listener.
*
* @param l the l
*/
@Override @Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l); pcs.removePropertyChangeListener(l);
} }
/**
* Gets the full name.
*
* @return the full name
*/
@Override @Override
public String getFullName() { public String getFullName() {
if(parent!=null) if (parent != null)
return parent.getFullName()+"."+name; return parent.getFullName() + "." + name;
else else
return name; return name;
} }
/**
* Gets the name.
*
* @return the name
*/
@Override @Override
public String getName() { public String getName() {
return name; return name;
} }
/**
* Sets the name.
*
* @param name the new name
*/
@Override @Override
public void setName(String name) { public void setName(String name) {
this.name=name; this.name = name;
} }
/**
* Sets the parent.
*
* @param parent the new parent
*/
@Override @Override
public void setParent(IHierNode parent) { public void setParent(IHierNode parent) {
this.parent=parent; this.parent = parent;
} }
/**
* Gets the child nodes.
*
* @return the child nodes
*/
@Override @Override
public List<IHierNode> getChildNodes() { public List<IHierNode> getChildNodes() {
return childs; return childs;
} }
/**
* Adds the child.
*
* @param child the child
*/
public void addChild(IHierNode child) {
if (!childs.contains(child)) {
childs.add(child);
child.setParent(this);
}
}
/**
* Compare to.
*
* @param o the o
* @return the int
*/
@Override @Override
public int compareTo(IHierNode o) { public int compareTo(IHierNode o) {
return getFullName().compareTo(o.getFullName()); return getFullName().compareTo(o.getFullName());
} }
/**
* Derive waveform.
*
* @return the i derived waveform
*/
@Override @Override
public IDerivedWaveform deriveWaveform() { public IDerivedWaveform deriveWaveform() {
return null; return null;

View File

@ -15,5 +15,10 @@ package com.minres.scviewer.database;
*/ */
public interface IDerivedWaveform extends IWaveform { public interface IDerivedWaveform extends IWaveform {
/**
* Adds the source waveform.
*
* @param waveform the waveform
*/
void addSourceWaveform(IWaveform waveform); void addSourceWaveform(IWaveform waveform);
} }

View File

@ -1,11 +1,40 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
/**
* The Interface IEvent.
*/
public interface IEvent { public interface IEvent {
/**
* Duplicate.
*
* @return the i event
* @throws CloneNotSupportedException the clone not supported exception
*/
public IEvent duplicate() throws CloneNotSupportedException; public IEvent duplicate() throws CloneNotSupportedException;
/**
* Gets the kind.
*
* @return the kind
*/
public EventKind getKind(); public EventKind getKind();
/**
* Gets the type.
*
* @return the type
*/
public WaveformType getType(); public WaveformType getType();
} }

View File

@ -16,25 +16,22 @@ import java.util.List;
/** /**
* The Interface IHierNode. * The Interface IHierNode.
*/ */
public interface IHierNode extends Comparable<IHierNode>{ public interface IHierNode extends Comparable<IHierNode> {
/** /**
* Attach a non-null PropertyChangeListener to this object. * Attach a non-null PropertyChangeListener to this object.
* *
* @param l * @param l a non-null PropertyChangeListener instance
* a non-null PropertyChangeListener instance * @throws IllegalArgumentException if the parameter is null
* @throws IllegalArgumentException
* if the parameter is null
*/ */
public void addPropertyChangeListener(PropertyChangeListener l); public void addPropertyChangeListener(PropertyChangeListener l);
/** /**
* Remove a PropertyChangeListener from this component. * Remove a PropertyChangeListener from this component.
* *
* @param l * @param l a PropertyChangeListener instance
* a PropertyChangeListener instance
*/ */
public void removePropertyChangeListener(PropertyChangeListener l) ; public void removePropertyChangeListener(PropertyChangeListener l);
/** /**
* Gets the full name. * Gets the full name.
@ -42,21 +39,21 @@ public interface IHierNode extends Comparable<IHierNode>{
* @return the full name * @return the full name
*/ */
public String getFullName(); public String getFullName();
/** /**
* Gets the name. * Gets the name.
* *
* @return the name * @return the name
*/ */
public String getName(); public String getName();
/** /**
* Sets the name. * Sets the name.
* *
* @param name the new name * @param name the new name
*/ */
public void setName(String name); public void setName(String name);
/** /**
* Sets the parent. * Sets the parent.
* *
@ -70,7 +67,7 @@ public interface IHierNode extends Comparable<IHierNode>{
* @return the child nodes * @return the child nodes
*/ */
public List<IHierNode> getChildNodes(); public List<IHierNode> getChildNodes();
/** /**
* Derive waveform. * Derive waveform.
* *

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,20 +12,70 @@ package com.minres.scviewer.database;
import java.util.NavigableMap; import java.util.NavigableMap;
/**
* The Interface IWaveform.
*
* @author eyck
*/
public interface IWaveform extends IHierNode { public interface IWaveform extends IHierNode {
/**
* Gets the id.
*
* @return the id
*/
public Long getId(); public Long getId();
/**
* Checks if is same.
*
* @param other the other
* @return true, if is same
*/
public boolean isSame(IWaveform other); public boolean isSame(IWaveform other);
/**
* Gets the events.
*
* @return the events
*/
public NavigableMap<Long, IEvent[]> getEvents(); public NavigableMap<Long, IEvent[]> getEvents();
/**
* Gets the events at time.
*
* @param time the time
* @return the events at time
*/
public IEvent[] getEventsAtTime(Long time); public IEvent[] getEventsAtTime(Long time);
/**
* Gets the events before time.
*
* @param time the time
* @return the events before time
*/
public IEvent[] getEventsBeforeTime(Long time); public IEvent[] getEventsBeforeTime(Long time);
/**
* Gets the type.
*
* @return the type
*/
public WaveformType getType(); public WaveformType getType();
/**
* Gets the kind.
*
* @return the kind
*/
public String getKind();
/**
* Gets the width.
*
* @return the width
*/
public int getWidth(); public int getWidth();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,21 +13,58 @@ package com.minres.scviewer.database;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
/**
* The Interface IWaveformDb.
*/
public interface IWaveformDb extends IHierNode { public interface IWaveformDb extends IHierNode {
/**
* Gets the max time.
*
* @return the max time
*/
public Long getMaxTime(); public Long getMaxTime();
/**
* Gets the stream by name.
*
* @param name the name
* @return the stream by name
*/
public IWaveform getStreamByName(String name); public IWaveform getStreamByName(String name);
/**
* Gets the all waves.
*
* @return the all waves
*/
public List<IWaveform> getAllWaves(); public List<IWaveform> getAllWaves();
/**
* Gets the all relation types.
*
* @return the all relation types
*/
public List<RelationType> getAllRelationTypes(); public List<RelationType> getAllRelationTypes();
/**
* Load.
*
* @param inp the inp
* @return true, if successful
*/
public boolean load(File inp); public boolean load(File inp);
/**
* Checks if is loaded.
*
* @return true, if is loaded
*/
public boolean isLoaded(); public boolean isLoaded();
/**
* Clear.
*/
public void clear(); public void clear();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,15 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database; package com.minres.scviewer.database;
/**
* A factory for creating IWaveformDb objects.
*/
public interface IWaveformDbFactory { public interface IWaveformDbFactory {
/**
* Gets the database.
*
* @return the database
*/
IWaveformDb getDatabase(); IWaveformDb getDatabase();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,15 +13,66 @@ package com.minres.scviewer.database;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.Collection;
/**
* The Interface IWaveformDbLoader.
*/
public interface IWaveformDbLoader { public interface IWaveformDbLoader {
// static final String STREAM_ADDED = "StreamAdded";
//
// static final String GENERATOR_ADDED = "GeneratorAdded";
//
// static final String LOADING_FINISHED = "LoadingFinished";
// /**
// * Attach a non-null PropertyChangeListener to this object.
// *
// * @param l
// * a non-null PropertyChangeListener instance
// * @throws IllegalArgumentException
// * if the parameter is null
// */
// public void addPropertyChangeListener(PropertyChangeListener l);
//
// /**
// * Remove a PropertyChangeListener from this component.
// *
// * @param l
// * a PropertyChangeListener instance
// */
// public void removePropertyChangeListener(PropertyChangeListener l) ;
/**
* Load.
*
* @param db the db
* @param inp the inp
* @return true, if successful
* @throws InputFormatException the input format exception
*/
public boolean load(IWaveformDb db, File inp) throws InputFormatException; public boolean load(IWaveformDb db, File inp) throws InputFormatException;
/**
* Gets the max time.
*
* @return the max time
*/
public Long getMaxTime(); public Long getMaxTime();
public Collection<IWaveform> getAllWaves() ; /**
* Gets the all waves.
public Collection<RelationType> getAllRelationTypes() ; *
* @return the all waves
*/
public Collection<IWaveform> getAllWaves();
/**
* Gets the all relation types.
*
* @return the all relation types
*/
public Collection<RelationType> getAllRelationTypes();
/**
* Dispose.
*/
public void dispose(); public void dispose();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,11 +10,12 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database; package com.minres.scviewer.database;
/**
* The Class InputFormatException.
*/
public class InputFormatException extends Exception { public class InputFormatException extends Exception {
/** /** The Constant serialVersionUID. */
*
*/
private static final long serialVersionUID = 8676129878197783368L; private static final long serialVersionUID = 8676129878197783368L;
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,40 +12,74 @@ package com.minres.scviewer.database;
import java.io.Serializable; import java.io.Serializable;
/**
* The Class RelationType.
*/
public class RelationType implements Serializable { public class RelationType implements Serializable {
/**
* /** The Constant serialVersionUID. */
*/
private static final long serialVersionUID = 6394859077558971735L; private static final long serialVersionUID = 6394859077558971735L;
/** The name. */
private String name; private String name;
/**
* Instantiates a new relation type.
*
* @param name the name
*/
RelationType(String name) { RelationType(String name) {
super(); super();
this.name = name; this.name = name;
} }
/**
* Gets the name.
*
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String toString(){ /**
* To string.
*
* @return the string
*/
public String toString() {
return name; return name;
} }
/**
* Hash code.
*
* @return the int
*/
@Override @Override
public int hashCode() { public int hashCode() {
return name.hashCode(); return name.hashCode();
} }
/**
* Equals.
*
* @param obj the obj
* @return true, if successful
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if(obj instanceof RelationType) if (obj instanceof RelationType)
return name.equals(((RelationType)obj).name); return name.equals(((RelationType) obj).name);
else else
return false; return false;
} }

View File

@ -1,22 +1,46 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
import java.util.HashMap; import java.util.HashMap;
/**
* A factory for creating RelationType objects.
*/
public class RelationTypeFactory { public class RelationTypeFactory {
public static RelationType create(String name){ /**
if(registry.containsKey(name)){ * Creates the.
*
* @param name the name
* @return the relation type
*/
public static RelationType create(String name) {
if (registry.containsKey(name)) {
return registry.get(name); return registry.get(name);
}else{ } else {
RelationType relType = new RelationType(name); RelationType relType = new RelationType(name);
registry.put(name, relType); registry.put(name, relType);
return relType; return relType;
} }
} }
private RelationTypeFactory() {} /**
* Instantiates a new relation type factory.
*/
private RelationTypeFactory() {
}
/** The registry. */
private static HashMap<String, RelationType> registry = new HashMap<>(); private static HashMap<String, RelationType> registry = new HashMap<>();
} }

View File

@ -1,5 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 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; package com.minres.scviewer.database;
/**
* The Enum WaveformType.
*/
public enum WaveformType { public enum WaveformType {
SIGNAL, TRANSACTION, FILTER
/** The signal. */
SIGNAL,
/** The transaction. */
TRANSACTION,
/** The filter. */
FILTER
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -25,67 +25,114 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
/**
* The Class WaveformDb.
*/
public class WaveformDb extends HierNode implements IWaveformDb { public class WaveformDb extends HierNode implements IWaveformDb {
private static List<IWaveformDbLoader> loaders=new LinkedList<>(); /** The loaders. */
private static List<IWaveformDbLoader> loaders = new LinkedList<>();
/** The loaded. */
private boolean loaded; private boolean loaded;
/** The relation types. */
private List<RelationType> relationTypes; private List<RelationType> relationTypes;
/** The waveforms. */
private Map<String, IWaveform> waveforms; private Map<String, IWaveform> waveforms;
/** The max time. */
private Long maxTime; private Long maxTime;
/**
public synchronized void bind(IWaveformDbLoader loader){ * Bind.
*
* @param loader the loader
*/
public synchronized void bind(IWaveformDbLoader loader) {
loaders.add(loader); loaders.add(loader);
} }
public synchronized void unbind(IWaveformDbLoader loader){ /**
* Unbind.
*
* @param loader the loader
*/
public synchronized void unbind(IWaveformDbLoader loader) {
loaders.remove(loader); loaders.remove(loader);
} }
/**
* Gets the loaders.
*
* @return the loaders
*/
public static List<IWaveformDbLoader> getLoaders() { public static List<IWaveformDbLoader> getLoaders() {
return Collections.unmodifiableList(loaders); return Collections.unmodifiableList(loaders);
} }
/**
* Instantiates a new waveform db.
*/
public WaveformDb() { public WaveformDb() {
super(); super();
waveforms = new HashMap<>(); waveforms = new HashMap<>();
relationTypes=new ArrayList<>(); relationTypes = new ArrayList<>();
maxTime=0L; maxTime = 0L;
} }
/**
* Gets the max time.
*
* @return the max time
*/
@Override @Override
public Long getMaxTime() { public Long getMaxTime() {
return maxTime; return maxTime;
} }
/**
* Gets the stream by name.
*
* @param name the name
* @return the stream by name
*/
@Override @Override
public IWaveform getStreamByName(String name) { public IWaveform getStreamByName(String name) {
return waveforms.get(name); return waveforms.get(name);
} }
/**
* Gets the all waves.
*
* @return the all waves
*/
@Override @Override
public List<IWaveform> getAllWaves() { public List<IWaveform> getAllWaves() {
return new ArrayList<>(waveforms.values()); return new ArrayList<>(waveforms.values());
} }
/**
* Load.
*
* @param inp the inp
* @return true, if successful
*/
@Override @Override
public boolean load(File inp){ public boolean load(File inp) {
for(IWaveformDbLoader loader:loaders){ for (IWaveformDbLoader loader : loaders) {
try { try {
if(loader.load(this, inp)){ if (loader.load(this, inp)) {
for(IWaveform w:loader.getAllWaves()){ for (IWaveform w : loader.getAllWaves()) {
waveforms.put(w.getFullName(),w); waveforms.put(w.getFullName(), w);
} }
if(loader.getMaxTime()>maxTime){ if (loader.getMaxTime() > maxTime) {
maxTime=loader.getMaxTime(); maxTime = loader.getMaxTime();
} }
if(name==null) name=getFileBasename(inp.getName()); if (name == null)
buildHierarchyNodes() ; name = getFileBasename(inp.getName());
buildHierarchyNodes();
relationTypes.addAll(loader.getAllRelationTypes()); relationTypes.addAll(loader.getAllRelationTypes());
pcs.firePropertyChange("WAVEFORMS", null, waveforms); pcs.firePropertyChange("WAVEFORMS", null, waveforms);
pcs.firePropertyChange("CHILDS", null, childs); pcs.firePropertyChange("CHILDS", null, childs);
@ -95,67 +142,94 @@ public class WaveformDb extends HierNode implements IWaveformDb {
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
} }
return false; return false;
} }
/**
* Gets the file basename.
*
* @param f the f
* @return the file basename
*/
protected static String getFileBasename(String f) { protected static String getFileBasename(String f) {
String ext = ""; String ext = "";
int i = f.lastIndexOf('.'); int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) { if (i > 0 && i < f.length() - 1) {
ext = f.substring(0, i); ext = f.substring(0, i);
} }
return ext; return ext;
} }
/**
* Clear.
*/
@Override @Override
public void clear() { public void clear() {
waveforms.clear(); waveforms.clear();
childs.clear(); childs.clear();
loaded=false; loaded = false;
} }
/**
* Checks if is loaded.
*
* @return true, if is loaded
*/
public boolean isLoaded() { public boolean isLoaded() {
return loaded; return loaded;
} }
/**
* Builds the hierarchy nodes.
*/
private void buildHierarchyNodes() { private void buildHierarchyNodes() {
for(IWaveform stream:getAllWaves()){ for (IWaveform stream : getAllWaves()) {
String[] hier = stream.getName().split("\\."); String[] hier = stream.getName().split("\\.");
IHierNode node = this; IHierNode node = this;
for(int i=0; i<hier.length-1; ++i){ for (int i = 0; i < hier.length - 1; ++i) {
String name = hier[i]; String name = hier[i];
IHierNode childNode = null; IHierNode childNode = null;
for (IHierNode n : node.getChildNodes()) { for (IHierNode n : node.getChildNodes()) {
if (n.getName().equals(name)) { if (n.getName().equals(name)) {
childNode=n; childNode = n;
break; break;
} }
} }
if(childNode != null) { if (childNode != null) {
node = childNode; node = childNode;
break; break;
} }
HierNode newNode = new HierNode(name, node); HierNode newNode = new HierNode(name, node);
node.getChildNodes().add(newNode); node.getChildNodes().add(newNode);
node=newNode; node = newNode;
} }
node.getChildNodes().add(stream); node.getChildNodes().add(stream);
stream.setParent(node); stream.setParent(node);
stream.setName(hier[hier.length-1]); stream.setName(hier[hier.length - 1]);
} }
sortRecursive(this); sortRecursive(this);
} }
/**
* Sort recursive.
*
* @param node the node
*/
private void sortRecursive(IHierNode node) { private void sortRecursive(IHierNode node) {
Collections.sort(node.getChildNodes(), (IHierNode o1, IHierNode o2) -> o1.getName().compareTo(o2.getName())); Collections.sort(node.getChildNodes(), (IHierNode o1, IHierNode o2) -> o1.getName().compareTo(o2.getName()));
for(IHierNode n:node.getChildNodes()) { for (IHierNode n : node.getChildNodes()) {
if(!n.getChildNodes().isEmpty()) if (!n.getChildNodes().isEmpty())
sortRecursive(n); sortRecursive(n);
} }
} }
/**
* Gets the all relation types.
*
* @return the all relation types
*/
@Override @Override
public List<RelationType> getAllRelationTypes() { public List<RelationType> getAllRelationTypes() {
return relationTypes; return relationTypes;

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,12 +17,20 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory; import com.minres.scviewer.database.IWaveformDbFactory;
/** /**
* @author eyck * A factory for creating WaveformDb objects.
* *
* @author eyck
*/ */
public class WaveformDbFactory implements IWaveformDbFactory { public class WaveformDbFactory implements IWaveformDbFactory {
/* (non-Javadoc) /**
* Gets the database.
*
* @return the database
*/
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.IWaveformDbFactory#getDatabase() * @see com.minres.scviewer.database.IWaveformDbFactory#getDatabase()
*/ */
@Override @Override

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,23 +15,71 @@ import java.util.List;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
public interface ITx extends Comparable<ITx>{ /**
* The Interface ITx.
*/
public interface ITx extends Comparable<ITx> {
/**
* Gets the id.
*
* @return the id
*/
public Long getId(); public Long getId();
/**
* Gets the stream.
*
* @return the stream
*/
public IWaveform getStream(); public IWaveform getStream();
/**
* Gets the generator.
*
* @return the generator
*/
public ITxGenerator getGenerator(); public ITxGenerator getGenerator();
/**
* Gets the begin time.
*
* @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 concurrency index.
*
* @return the concurrency index
*/
public int getConcurrencyIndex(); public int getConcurrencyIndex();
/**
* Gets the attributes.
*
* @return the attributes
*/
public List<ITxAttribute> getAttributes(); public List<ITxAttribute> getAttributes();
/**
* Gets the incoming relations.
*
* @return the incoming relations
*/
public Collection<ITxRelation> getIncomingRelations(); public Collection<ITxRelation> getIncomingRelations();
/**
* Gets the outgoing relations.
*
* @return the outgoing relations
*/
public Collection<ITxRelation> getOutgoingRelations(); public Collection<ITxRelation> getOutgoingRelations();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,6 +10,15 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.tx; package com.minres.scviewer.database.tx;
/**
* The Interface ITxAttribute.
*/
public interface ITxAttribute extends ITxAttributeType { public interface ITxAttribute extends ITxAttributeType {
/**
* Gets the value.
*
* @return the value
*/
public Object getValue(); public Object getValue();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,8 +13,29 @@ package com.minres.scviewer.database.tx;
import com.minres.scviewer.database.AssociationType; import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.DataType;
/**
* The Interface ITxAttributeType.
*/
public interface ITxAttributeType { public interface ITxAttributeType {
/**
* Gets the name.
*
* @return the name
*/
public String getName(); public String getName();
/**
* Gets the data type.
*
* @return the data type
*/
public DataType getDataType(); public DataType getDataType();
/**
* Gets the type.
*
* @return the type
*/
public AssociationType getType(); public AssociationType getType();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,9 +12,22 @@ package com.minres.scviewer.database.tx;
import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEvent;
/**
* The Interface ITxEvent.
*/
public interface ITxEvent extends IEvent { public interface ITxEvent extends IEvent {
/**
* Gets the time.
*
* @return the time
*/
public Long getTime(); public Long getTime();
public ITx getTransaction(); /**
* Gets the transaction.
*
* @return the transaction
*/
public ITx getTransaction();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,8 +12,16 @@ package com.minres.scviewer.database.tx;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
public interface ITxGenerator { /**
public Long getId(); * The Interface ITxGenerator.
*/
public interface ITxGenerator extends IWaveform {
/**
* Gets the stream.
*
* @return the stream
*/
public IWaveform getStream(); public IWaveform getStream();
public String getName();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,11 +12,29 @@ package com.minres.scviewer.database.tx;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
/**
* The Interface ITxRelation.
*/
public interface ITxRelation { public interface ITxRelation {
/**
* Gets the relation type.
*
* @return the relation type
*/
RelationType getRelationType(); RelationType getRelationType();
/**
* Gets the source.
*
* @return the source
*/
ITx getSource(); ITx getSource();
/**
* Gets the target.
*
* @return the target
*/
ITx getTarget(); ITx getTarget();
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

View File

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others. * Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at

Some files were not shown because too many files have changed in this diff Show More