2015-01-20 18:50:15 +01:00
|
|
|
package com.minres.scviewer.database.text;
|
|
|
|
|
2015-01-21 21:58:35 +01:00
|
|
|
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;
|
|
|
|
|
2015-02-04 16:20:59 +01:00
|
|
|
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;
|
2015-02-04 16:20:59 +01:00
|
|
|
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) {
|
2015-02-04 16:20:59 +01:00
|
|
|
time.compareTo(o.time)
|
2015-01-21 21:58:35 +01:00
|
|
|
}
|
|
|
|
|
2015-02-04 16:20:59 +01:00
|
|
|
@Override
|
2015-01-21 21:58:35 +01:00
|
|
|
String toString() {
|
2015-02-04 16:20:59 +01:00
|
|
|
type.toString()+"@"+time+" of tx #"+transaction.id;
|
2015-01-20 18:50:15 +01:00
|
|
|
}
|
|
|
|
}
|