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

78 lines
1.7 KiB
Groovy
Raw Normal View History

2012-06-17 20:34:50 +02:00
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
2012-06-17 20:34:50 +02:00
import com.minres.scviewer.database.*
2012-06-17 19:53:05 +02:00
2018-08-27 23:10:52 +02:00
class Tx implements ITx, Serializable {
TextDbLoader loader
2015-01-01 23:17:32 +01:00
2012-06-17 19:53:05 +02:00
Long id
2015-01-01 23:17:32 +01:00
2018-08-27 23:10:52 +02:00
Long generator_id
2015-01-01 23:17:32 +01:00
2015-01-20 18:50:15 +01:00
int concurrencyIndex
Long beginTime
2015-01-01 23:17:32 +01:00
2015-01-20 18:50:15 +01:00
Long endTime
2015-01-01 23:17:32 +01:00
2015-01-06 17:14:16 +01:00
ArrayList<ITxAttribute> attributes = new ArrayList<ITxAttribute>()
2012-06-17 19:53:05 +02:00
2015-01-01 23:17:32 +01:00
def incomingRelations =[]
def outgoingRelations =[]
2018-08-27 23:10:52 +02:00
Tx(TextDbLoader loader, Long id, Long generator_id, Long begin){
this.loader=loader
2012-06-17 19:53:05 +02:00
this.id=id
2018-08-27 23:10:52 +02:00
this.generator_id=generator_id
2012-06-17 19:53:05 +02:00
this.beginTime=begin
this.endTime=begin
2012-06-17 19:53:05 +02:00
}
@Override
2015-01-06 17:14:16 +01:00
public Collection<ITxRelation> getIncomingRelations() {
2015-01-01 23:17:32 +01:00
return incomingRelations;
2012-06-17 19:53:05 +02:00
}
@Override
2015-01-06 17:14:16 +01:00
public Collection<ITxRelation> getOutgoingRelations() {
2015-01-01 23:17:32 +01:00
return outgoingRelations;
2012-06-17 19:53:05 +02:00
}
2015-01-09 09:16:40 +01:00
@Override
public int compareTo(ITx o) {
def res =beginTime.compareTo(o.beginTime)
if(res!=0)
return res
else
return id.compareTo(o.id)
2015-01-09 09:16:40 +01:00
}
2015-01-01 23:17:32 +01:00
@Override
public String toString() {
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
}
2018-08-27 23:10:52 +02:00
@Override
public ITxStream<ITxEvent> getStream() {
return generator.stream;
}
@Override
public ITxGenerator getGenerator() {
return loader.generatorsById[generator_id];
}
2012-06-17 19:53:05 +02:00
}