Initial version
This commit is contained in:
commit
d62e0f63a7
9
com.itjw.txviewer.database.text/.classpath
Normal file
9
com.itjw.txviewer.database.text/.classpath
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
29
com.itjw.txviewer.database.text/.project
Normal file
29
com.itjw.txviewer.database.text/.project
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.itjw.txviewer.database.text</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
13
com.itjw.txviewer.database.text/META-INF/MANIFEST.MF
Normal file
13
com.itjw.txviewer.database.text/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,13 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Textual transaction database
|
||||
Bundle-SymbolicName: com.itjw.txviewer.database.text
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: com.itjw.txviewer.database.text.Activator
|
||||
Bundle-Vendor: ITJW
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.itjw.txviewer.database,
|
||||
org.osgi.framework;version="1.3.0"
|
||||
Require-Bundle: com.itjw.txviewer.database;bundle-version="1.0.0",
|
||||
org.codehaus.groovy;bundle-version="1.8.6",
|
||||
org.eclipse.ui.views;bundle-version="3.6.0"
|
4
com.itjw.txviewer.database.text/build.properties
Normal file
4
com.itjw.txviewer.database.text/build.properties
Normal file
@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
@ -0,0 +1,37 @@
|
||||
package com.itjw.txviewer.database.text;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.Constants;
|
||||
import java.util.Dictionary
|
||||
import java.util.Hashtable
|
||||
import com.itjw.txviewer.database.ITrDb;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private static BundleContext context;
|
||||
|
||||
static BundleContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = bundleContext;
|
||||
Dictionary<String, ?> dict = new Hashtable<String, ?>();
|
||||
dict.putAt(Constants.SERVICE_RANKING, 1);
|
||||
context.registerService(ITrDb.class, new TrTextDb(), dict);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
|
||||
import com.itjw.txviewer.database.ITrAttrType;
|
||||
|
||||
class TrAttrType implements ITrAttrType {
|
||||
String name
|
||||
String type
|
||||
|
||||
static TrAttrType getAttrType(String name, String type){
|
||||
TrAttrTypeFactory.instance.getAttrType(name, type)
|
||||
}
|
||||
|
||||
TrAttrType(String name, String type){
|
||||
this.name=name
|
||||
this.type=type
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
|
||||
import com.itjw.txviewer.database.ITrAttrType
|
||||
import com.itjw.txviewer.database.ITrAttribute
|
||||
|
||||
class TrAttrTypeFactory {
|
||||
private static final instance = new TrAttrTypeFactory()
|
||||
|
||||
def attributes = [:]
|
||||
|
||||
private TrAttrTypeFactory() {
|
||||
TrAttrTypeFactory.metaClass.constructor = {-> instance }
|
||||
}
|
||||
|
||||
ITrAttrType getAttrType(String name, String type){
|
||||
def key = name+":"+type
|
||||
ITrAttrType res
|
||||
if(attributes.containsKey(key)){
|
||||
res=attributes[key]
|
||||
} else {
|
||||
res=new TrAttrType(name, type)
|
||||
attributes[key]=res
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
|
||||
import com.itjw.txviewer.database.ITrAttribute
|
||||
|
||||
class TrAttribute implements ITrAttribute{
|
||||
|
||||
TrAttrType attributeType
|
||||
def value
|
||||
|
||||
TrAttribute(String name, String type, value){
|
||||
attributeType = TrAttrTypeFactory.instance.getAttrType(name, type)
|
||||
switch(type){
|
||||
case "STRING":
|
||||
case "ENUMERATION":
|
||||
this.value=value[1..-2]
|
||||
break;
|
||||
default:
|
||||
this.value=value
|
||||
}
|
||||
}
|
||||
|
||||
TrAttribute(TrAttrType other){
|
||||
attributeType=other
|
||||
}
|
||||
|
||||
TrAttribute(TrAttrType other, value){
|
||||
this(other.name, other.type, value)
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return attributeType.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return attributeType.getType();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.itjw.txviewer.database.ITrAttrType
|
||||
import com.itjw.txviewer.database.ITrAttribute;
|
||||
import com.itjw.txviewer.database.ITrGenerator;
|
||||
import com.itjw.txviewer.database.ITrStream;
|
||||
import com.itjw.txviewer.database.ITransaction;
|
||||
|
||||
class TrGenerator implements ITrGenerator{
|
||||
Long id
|
||||
TrStream stream
|
||||
String name
|
||||
Boolean active = false
|
||||
ArrayList<ITransaction> transactions=[]
|
||||
|
||||
ArrayList<ITrAttrType> begin_attrs = []
|
||||
int begin_attrs_idx = 0
|
||||
ArrayList<ITrAttrType> end_attrs= []
|
||||
int end_attrs_idx = 0
|
||||
|
||||
TrGenerator(int id, TrStream stream, name){
|
||||
this.id=id
|
||||
this.stream=stream
|
||||
this.name=name
|
||||
}
|
||||
|
||||
ITrStream getStream(){
|
||||
return stream;
|
||||
}
|
||||
|
||||
List<ITransaction> getTransactions(){
|
||||
return transactions
|
||||
}
|
||||
|
||||
Boolean isActive() {return active};
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.itjw.txviewer.database.text;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.itjw.txviewer.database.ITrHierNode;
|
||||
|
||||
class TrHierNode implements ITrHierNode {
|
||||
|
||||
String name
|
||||
def childs = []
|
||||
|
||||
public TrHierNode(){
|
||||
}
|
||||
|
||||
public TrHierNode(String name){
|
||||
this.name=name
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITrHierNode> getChildNodes() {
|
||||
return childs.sort{it.name}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
// TODO Auto-generated method stub
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.itjw.txviewer.database.ITrDb
|
||||
import com.itjw.txviewer.database.ITrGenerator
|
||||
import com.itjw.txviewer.database.ITrHierNode
|
||||
import com.itjw.txviewer.database.ITrStream
|
||||
import com.itjw.txviewer.database.ITransaction
|
||||
|
||||
class TrStream extends TrHierNode implements ITrStream {
|
||||
Long id;
|
||||
TrTextDb database
|
||||
String name;
|
||||
String fullName;
|
||||
String kind;
|
||||
def generators = [];
|
||||
def childs = []
|
||||
private allTransactions;
|
||||
|
||||
public TrHierNode(String name){
|
||||
this.name=name
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITrHierNode> getChildNodes() {
|
||||
return childs.sort{it.name};
|
||||
}
|
||||
|
||||
|
||||
TrStream(int id, TrTextDb db, String name, String kind){
|
||||
this.id=id
|
||||
this.database=db
|
||||
this.name=name
|
||||
this.fullName=name
|
||||
this.kind=kind
|
||||
}
|
||||
|
||||
List<ITrGenerator> getGenerators(){
|
||||
return generators as List<ITrGenerator>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITrDb getDb() {
|
||||
return database;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConcurrrentTx() {
|
||||
def rowendtime = [0]
|
||||
getTransactions().each{Transaction tx ->
|
||||
def rowIdx = 0
|
||||
for(rowIdx=0; rowendtime.size()<rowIdx || rowendtime[rowIdx]>tx.beginTime.value; rowIdx++);
|
||||
if(rowendtime.size<=rowIdx){
|
||||
rowendtime<<tx.endTime?.value?:tx.beginTime.value+1
|
||||
} else {
|
||||
rowendtime[rowIdx]=tx.endTime?.value?:tx.beginTime.value+1
|
||||
}
|
||||
}
|
||||
return rowendtime.size()
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITransaction> getTransactions() {
|
||||
if(!allTransactions)
|
||||
allTransactions=generators.transactions.flatten().sort{it.beginTime.value}
|
||||
return allTransactions
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
package com.itjw.txviewer.database.text;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.itjw.txviewer.database.ITrDb;
|
||||
import com.itjw.txviewer.database.ITrGenerator;
|
||||
import com.itjw.txviewer.database.ITrHierNode;
|
||||
import com.itjw.txviewer.database.ITrStream;
|
||||
import com.itjw.txviewer.database.InputFormatException;
|
||||
import com.itjw.txviewer.database.EventTime
|
||||
|
||||
public class TrTextDb extends TrHierNode implements ITrDb{
|
||||
|
||||
private EventTime maxTime;
|
||||
def streams = []
|
||||
def childs = []
|
||||
|
||||
public String getFullName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventTime getMaxTime() {
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
public List<ITrStream> getAllStreams() {
|
||||
return new LinkedList<ITrStream>(streams);
|
||||
}
|
||||
|
||||
public List<ITrHierNode> getChildNodes() {
|
||||
return childs.sort{it.name};
|
||||
}
|
||||
|
||||
public Map<Long, ITrGenerator> getGeneratorsById() {
|
||||
TreeMap<Long, ITrGenerator> res = new TreeMap<Long, ITrGenerator>();
|
||||
streams.each{TrStream stream -> stream.generators.each{res.put(it.id, id)} }
|
||||
return res;
|
||||
}
|
||||
|
||||
void clear(){
|
||||
streams = []
|
||||
maxTime=new EventTime(0, "ns")
|
||||
}
|
||||
|
||||
void load(InputStream inp) throws InputFormatException {
|
||||
parseInput(inp)
|
||||
}
|
||||
|
||||
void parseFromTextFile(filename){
|
||||
def file = new File(filename);
|
||||
this.databaseName = filname;
|
||||
parseInput(file)
|
||||
}
|
||||
|
||||
private def parseInput(input){
|
||||
def streamsById = [:]
|
||||
def generatorsById = [:]
|
||||
def transactionsById = [:]
|
||||
TrGenerator generator
|
||||
Transaction transaction
|
||||
boolean endTransaction=false
|
||||
def matcher
|
||||
input.eachLine { line ->
|
||||
def tokens = line.split(/\s+/)
|
||||
switch(tokens[0]){
|
||||
case "scv_tr_stream":
|
||||
case "scv_tr_generator":
|
||||
case "begin_attribute":
|
||||
case "end_attribute":
|
||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||
def id = Integer.parseInt(matcher[0][1])
|
||||
def stream = new TrStream(id, this, matcher[0][2], matcher[0][3])
|
||||
streams<<stream
|
||||
streamsById[id]=stream
|
||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
||||
def id = Integer.parseInt(matcher[0][1])
|
||||
TrStream stream=streamsById[Integer.parseInt(matcher[0][3])]
|
||||
generator=new TrGenerator(id, stream, matcher[0][2])
|
||||
stream.generators<<generator
|
||||
generatorsById[id]=generator
|
||||
} else if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||
generator.begin_attrs << TrAttrType.getAttrType(matcher[0][2], matcher[0][3])
|
||||
} else if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||
generator.end_attrs << TrAttrType.getAttrType(matcher[0][2], matcher[0][3])
|
||||
}
|
||||
break;
|
||||
case ")":
|
||||
generator=null
|
||||
break
|
||||
case "tx_begin"://matcher = line =~ /^tx_begin\s+(\d+)\s+(\d+)\s+(\d+)\s+([munpf]?s)/
|
||||
def id = Integer.parseInt(tokens[1])
|
||||
TrGenerator gen=generatorsById[Integer.parseInt(tokens[2])]
|
||||
transaction = new Transaction(id, gen,new EventTime(Integer.parseInt(tokens[3]), tokens[4]))
|
||||
gen.transactions << transaction
|
||||
transactionsById[id]= transaction
|
||||
gen.begin_attrs_idx=0;
|
||||
maxTime = maxTime>transaction.beginTime?maxTime:transaction.beginTime
|
||||
endTransaction=false
|
||||
break
|
||||
case "tx_end"://matcher = line =~ /^tx_end\s+(\d+)\s+(\d+)\s+(\d+)\s+([munpf]?s)/
|
||||
def id = Integer.parseInt(tokens[1])
|
||||
transaction = transactionsById[id]
|
||||
assert Integer.parseInt(tokens[2])==transaction.generator.id
|
||||
transaction.endTime = new EventTime(Integer.parseInt(tokens[3]), tokens[4])
|
||||
transaction.generator.end_attrs_idx=0;
|
||||
maxTime = maxTime>transaction.endTime?maxTime:transaction.endTime
|
||||
endTransaction=true
|
||||
break
|
||||
case "tx_record_attribute"://matcher = line =~ /^tx_record_attribute\s+(\d+)\s+"([^"]+)"\s+(\S+)\s*=\s*(.+)$/
|
||||
def id = Integer.parseInt(tokens[1])
|
||||
transactionsById[id].attributes.add(new TrAttribute(tokens[2][1..-2], tokens[3], tokens[5..-1].join(' ')))
|
||||
break
|
||||
case "a"://matcher = line =~ /^a\s+(.+)$/
|
||||
if(endTransaction){
|
||||
transaction.end_attrs << new TrAttribute(transaction.generator.end_attrs[0], tokens[1])
|
||||
} else {
|
||||
transaction.begin_attrs << new TrAttribute(transaction.generator.begin_attrs[0], tokens[1])
|
||||
}
|
||||
break
|
||||
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
|
||||
Transaction tr1= transactionsById[Integer.parseInt(tokens[2])]
|
||||
Transaction tr2= transactionsById[Integer.parseInt(tokens[3])]
|
||||
switch(tokens[1][1..-2]){
|
||||
case "CHILD":
|
||||
tr1.child<<tr2
|
||||
tr2.parent<<tr1
|
||||
break
|
||||
case "PARENT":
|
||||
tr2.child<<tr1
|
||||
tr1.parent<<tr2
|
||||
break
|
||||
case "PREDECESSOR":
|
||||
tr2.succ<<tr1
|
||||
tr1.pred<<tr2
|
||||
break
|
||||
case "SUCCESSOR":
|
||||
tr1.succ<<tr2
|
||||
tr2.pred<<tr1
|
||||
break
|
||||
default:
|
||||
println "Relationship '${tokens[1]}' not yet implemented"
|
||||
}
|
||||
break
|
||||
default:
|
||||
println "Don't know what to do with: '$line'"
|
||||
|
||||
}
|
||||
}
|
||||
linkTransactions()
|
||||
addHierarchyNodes()
|
||||
}
|
||||
|
||||
def linkTransactions(){
|
||||
streams.generators?.flatten().each {TrGenerator gen ->
|
||||
def sortedTx = gen.transactions.sort{it.beginTime}
|
||||
if(sortedTx.size()>1)
|
||||
for(int i=1;i<sortedTx.size(); i++){
|
||||
sortedTx[i].prev= sortedTx[i-1]
|
||||
sortedTx[i-1].next = sortedTx[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def addHierarchyNodes(){
|
||||
streams.each{ TrStream stream->
|
||||
def hier = stream.fullName.split(/\./)
|
||||
ITrHierNode node = this
|
||||
hier.each { name ->
|
||||
def n1 = node.childNodes.find{it.name == name}
|
||||
if(name == hier[-1]){ //leaf
|
||||
if(n1!=null) {
|
||||
if(n1 instanceof TrHierNode){
|
||||
node.childNodes.remove(n1)
|
||||
stream.childNodes.addAll(n1.childNodes)
|
||||
} else {
|
||||
throw new InputFormatException()
|
||||
}
|
||||
}
|
||||
stream.name=name
|
||||
node.childNodes<<stream
|
||||
node=stream
|
||||
} else { // intermediate
|
||||
if(n1 != null) {
|
||||
node=n1
|
||||
} else {
|
||||
TrHierNode newNode = new TrHierNode(name)
|
||||
node.childNodes<<newNode
|
||||
node=newNode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.itjw.txviewer.database.text
|
||||
import java.util.Set
|
||||
import com.itjw.txviewer.database.*
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor
|
||||
import org.eclipse.ui.views.properties.IPropertySource
|
||||
|
||||
class Transaction implements IPropertySource, ITransaction {
|
||||
Long id
|
||||
TrGenerator generator
|
||||
EventTime beginTime
|
||||
EventTime endTime
|
||||
ArrayList<ITrAttribute> begin_attrs = new ArrayList<ITrAttribute>()
|
||||
ArrayList<ITrAttribute> end_attrs = new ArrayList<ITrAttribute>()
|
||||
ArrayList<ITrAttribute> attributes = new ArrayList<ITrAttribute>()
|
||||
Transaction prev, next
|
||||
def pred =[]
|
||||
def succ =[]
|
||||
def parent =[]
|
||||
def child =[]
|
||||
|
||||
Transaction(int id, TrGenerator generator, EventTime begin){
|
||||
this.id=id
|
||||
this.generator=generator
|
||||
this.beginTime=begin
|
||||
}
|
||||
|
||||
@Override
|
||||
List<ITrAttribute> getBeginAttrs() {
|
||||
return begin_attrs
|
||||
}
|
||||
|
||||
@Override
|
||||
List<ITrAttribute> getEndAttrs() {
|
||||
return end_attrs
|
||||
}
|
||||
|
||||
List<ITrAttribute> getAttributes(){
|
||||
return attributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ITransaction> getNextInRelationship(RelationType rel) {
|
||||
switch(rel){
|
||||
case RelationType.PREDECESSOR:
|
||||
return pred
|
||||
break
|
||||
case RelationType.SUCCESSOR:
|
||||
return succ
|
||||
break
|
||||
case RelationType.PREVIOUS:
|
||||
return [prev]
|
||||
break
|
||||
case RelationType.NEXT:
|
||||
return[next]
|
||||
break
|
||||
case RelationType.PARENT:
|
||||
return parent
|
||||
break
|
||||
case RelationType.CHILD:
|
||||
return child
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEditableValue() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPropertyValue(Object id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPropertySet(Object id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPropertyValue(Object id) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValue(Object id, Object value) {
|
||||
}
|
||||
}
|
7
com.itjw.txviewer.database/.classpath
Normal file
7
com.itjw.txviewer.database/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
com.itjw.txviewer.database/.project
Normal file
28
com.itjw.txviewer.database/.project
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.itjw.txviewer.database</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
10
com.itjw.txviewer.database/META-INF/MANIFEST.MF
Normal file
10
com.itjw.txviewer.database/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,10 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Transaction Database
|
||||
Bundle-SymbolicName: com.itjw.txviewer.database
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: ITJW
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.itjw.txviewer.database
|
||||
Require-Bundle: org.eclipse.ui.views
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
com.itjw.txviewer.database/build.properties
Normal file
4
com.itjw.txviewer.database/build.properties
Normal file
@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
@ -0,0 +1,57 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
public class EventTime implements Comparable<EventTime>{
|
||||
public static final double NS = 1000000.0;
|
||||
public static final double MS = 1000000000.0;
|
||||
private long value; // unit is femto seconds
|
||||
|
||||
public EventTime(Long value, String unit){
|
||||
setValue(value, unit);
|
||||
}
|
||||
|
||||
public long getValue(){
|
||||
return(value);
|
||||
}
|
||||
|
||||
public double getScaledValue(double scale){
|
||||
return value/scale;
|
||||
}
|
||||
|
||||
public double getValueNS(){
|
||||
return getScaledValue(NS);
|
||||
}
|
||||
|
||||
public double getValueMS(){
|
||||
return getScaledValue(MS);
|
||||
}
|
||||
|
||||
public void setValue(long value){
|
||||
this.value=value;
|
||||
}
|
||||
|
||||
public void setValue(long value, String unit){
|
||||
this.value=value;
|
||||
if("fs".compareToIgnoreCase(unit)==0)
|
||||
this.value=value;
|
||||
else if("ps".compareToIgnoreCase(unit)==0)
|
||||
this.value=value*1000;
|
||||
else if("ns".compareToIgnoreCase(unit)==0)
|
||||
this.value=value*1000000;
|
||||
else if("us".compareToIgnoreCase(unit)==0)
|
||||
this.value=value*1000000000;
|
||||
else if("ms".compareToIgnoreCase(unit)==0)
|
||||
this.value=value*1000000000000L;
|
||||
else {
|
||||
System.err.print("Don't know what to do with "+unit+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return value/1000000 +"ns";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(EventTime other) {
|
||||
return this.value<other.value? -1 : this.value==other.value? 0 : 1;
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
public interface ITrAttrType {
|
||||
public String getName();
|
||||
public String getType();
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
public interface ITrAttribute extends ITrAttrType {
|
||||
public Object getValue();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface ITrDb extends ITrHierNode {
|
||||
|
||||
public EventTime getMaxTime();
|
||||
|
||||
public List<ITrStream> getAllStreams();
|
||||
|
||||
public void load(InputStream inp) throws InputFormatException;
|
||||
|
||||
public void clear();
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITrGenerator {
|
||||
public Long getId();
|
||||
public ITrStream getStream();
|
||||
public String getName();
|
||||
// public Boolean isActive();
|
||||
public List<ITransaction> getTransactions();
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
|
||||
public interface ITrHierNode {
|
||||
/**
|
||||
* 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) ;
|
||||
|
||||
public String getFullName();
|
||||
|
||||
public String getName();
|
||||
|
||||
public void setName(String name);
|
||||
|
||||
public List<ITrHierNode> getChildNodes();
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITrStream extends ITrHierNode {
|
||||
|
||||
public Long getId();
|
||||
|
||||
public String getKind();
|
||||
|
||||
public ITrDb getDb();
|
||||
|
||||
public List<ITrGenerator> getGenerators();
|
||||
|
||||
public List<ITransaction> getTransactions();
|
||||
|
||||
public int getMaxConcurrrentTx();
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ITransaction {
|
||||
public Long getId();
|
||||
public ITrGenerator getGenerator();
|
||||
public EventTime getBeginTime();
|
||||
public EventTime getEndTime();
|
||||
public List<ITrAttribute> getBeginAttrs();
|
||||
public List<ITrAttribute> getEndAttrs();
|
||||
public List<ITrAttribute> getAttributes();
|
||||
public Set<ITransaction> getNextInRelationship(RelationType rel);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
public class InputFormatException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8676129878197783368L;
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.itjw.txviewer.database;
|
||||
|
||||
public enum RelationType {
|
||||
PREDECESSOR, SUCCESSOR, PREVIOUS, NEXT, PARENT, CHILD;
|
||||
}
|
17
com.itjw.txviewer.feature/.project
Normal file
17
com.itjw.txviewer.feature/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.itjw.txviewer.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
1
com.itjw.txviewer.feature/build.properties
Normal file
1
com.itjw.txviewer.feature/build.properties
Normal file
@ -0,0 +1 @@
|
||||
bin.includes = feature.xml
|
55
com.itjw.txviewer.feature/feature.xml
Normal file
55
com.itjw.txviewer.feature/feature.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="com.itjw.txviewer.feature"
|
||||
label="Transaction Viewer"
|
||||
version="1.0.0.qualifier"
|
||||
provider-name="ITJW">
|
||||
|
||||
<description url="http://www.itjw.com/txviewer">
|
||||
A viewer for SystemC Verification Library transactions
|
||||
</description>
|
||||
|
||||
<copyright url="http://wwwitjw.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.eclipse.ui.views"/>
|
||||
<import plugin="com.itjw.txviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.codehaus.groovy" version="1.8.6" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi"/>
|
||||
<import plugin="org.eclipse.ui"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.jface.text"/>
|
||||
<import plugin="org.eclipse.core.resources"/>
|
||||
<import plugin="org.eclipse.ui.editors"/>
|
||||
<import plugin="org.eclipse.ui.ide"/>
|
||||
<import plugin="org.eclipse.gef"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="com.itjw.txviewer.database"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.itjw.txviewer.database.text"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.itjw.txviewer.graph"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
35
com.itjw.txviewer.feature/txviewer.product
Normal file
35
com.itjw.txviewer.feature/txviewer.product
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product uid="com.itjw.txviewer" id="org.eclipse.platform.ide" version="0.0.0" useFeatures="true" includeLaunchers="true">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
||||
<launcherArgs>
|
||||
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
|
||||
</launcherArgs>
|
||||
|
||||
<launcher>
|
||||
<solaris/>
|
||||
<win useIco="false">
|
||||
<bmp/>
|
||||
</win>
|
||||
</launcher>
|
||||
|
||||
<vm>
|
||||
</vm>
|
||||
|
||||
<plugins>
|
||||
</plugins>
|
||||
|
||||
<features>
|
||||
<feature id="com.itjw.txviewer.feature" version="1.0.0.qualifier"/>
|
||||
<feature id="org.eclipse.platform" version="3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK"/>
|
||||
</features>
|
||||
|
||||
<configurations>
|
||||
<plugin id="com.itjw.txviewer.database.text" autoStart="true" startLevel="0" />
|
||||
</configurations>
|
||||
|
||||
</product>
|
8
com.itjw.txviewer.graph/.classpath
Normal file
8
com.itjw.txviewer.graph/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
29
com.itjw.txviewer.graph/.project
Normal file
29
com.itjw.txviewer.graph/.project
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.itjw.txviewer.graph</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
19
com.itjw.txviewer.graph/META-INF/MANIFEST.MF
Normal file
19
com.itjw.txviewer.graph/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,19 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Graph
|
||||
Bundle-SymbolicName: com.itjw.txviewer.graph; singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: com.itjw.txviewer.graph.TxEditorPlugin
|
||||
Bundle-Vendor: ITJW
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.jface.text,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.ui.editors,
|
||||
org.eclipse.ui.ide,
|
||||
org.eclipse.gef,
|
||||
org.eclipse.ui.views.properties.tabbed
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.itjw.txviewer.database,
|
||||
org.eclipse.ui.views.contentoutline
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user