SCViewer/com.minres.scviewer.databas.../src/com/minres/scviewer/database/text/TxEvent.groovy

38 lines
769 B
Groovy
Raw Normal View History

2015-01-20 18:50:15 +01:00
package com.minres.scviewer.database.text;
import com.minres.scviewer.database.ITx
import com.minres.scviewer.database.ITxEvent
import com.minres.scviewer.database.IWaveformEvent
2015-01-20 18:50:15 +01:00
class TxEvent implements ITxEvent {
final ITxEvent.Type type;
Tx transaction;
TxEvent(ITxEvent.Type type, ITx transaction) {
super();
this.type = type;
this.transaction = transaction;
}
@Override
IWaveformEvent duplicate() throws CloneNotSupportedException {
new TxEvent(type, transaction, time)
}
@Override
int compareTo(IWaveformEvent o) {
time.compareTo(o.getTime())
}
Long getTime(){
type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
}
@Override
String toString() {
type.toString()+"@"+getTime()+" of tx #"+transaction.id;
2015-01-20 18:50:15 +01:00
}
}