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
|
|
|
|
*******************************************************************************/
|
2015-01-03 16:34:32 +01:00
|
|
|
package com.minres.scviewer.database.text
|
2012-06-17 20:34:50 +02:00
|
|
|
|
2015-01-03 16:34:32 +01:00
|
|
|
import com.minres.scviewer.database.*
|
2012-06-17 19:53:05 +02:00
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
class Tx implements ITx {
|
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
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxGenerator generator
|
2015-01-01 23:17:32 +01:00
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxStream stream
|
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 =[]
|
|
|
|
|
2015-01-20 18:50:15 +01:00
|
|
|
Tx(int id, TxStream stream, TxGenerator generator, Long begin){
|
2012-06-17 19:53:05 +02:00
|
|
|
this.id=id
|
2015-01-09 09:16:40 +01:00
|
|
|
this.stream=stream
|
2012-06-17 19:53:05 +02:00
|
|
|
this.generator=generator
|
|
|
|
this.beginTime=begin
|
2015-02-11 09:32:46 +01:00
|
|
|
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) {
|
2015-02-04 16:20:59 +01:00
|
|
|
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
|
|
|
|
2015-10-27 23:39:33 +01:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
|
|
|
|
}
|
|
|
|
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|