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

37 lines
788 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
2018-08-27 23:10:52 +02:00
class TxEvent implements ITxEvent, Serializable {
2015-01-20 18:50:15 +01:00
final ITxEvent.Type type;
final Tx transaction;
final Long time
2015-01-20 18:50:15 +01:00
TxEvent(ITxEvent.Type type, ITx transaction) {
super();
this.type = type;
this.transaction = transaction;
this.time = type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
2015-01-20 18:50:15 +01:00
}
@Override
IWaveformEvent duplicate() throws CloneNotSupportedException {
new TxEvent(type, transaction, time)
}
@Override
int compareTo(IWaveformEvent o) {
time.compareTo(o.time)
}
@Override
String toString() {
type.toString()+"@"+time+" of tx #"+transaction.id;
2015-01-20 18:50:15 +01:00
}
}