Initial version
This commit is contained in:
@ -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;
|
||||
}
|
Reference in New Issue
Block a user