2021-01-09 12:43:02 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2020 MINRES Technologies GmbH and others.
|
|
|
|
* 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:
|
|
|
|
* MINRES Technologies GmbH - initial API and implementation
|
|
|
|
*******************************************************************************/
|
2020-11-28 14:08:34 +01:00
|
|
|
package com.minres.scviewer.database.text;
|
2015-01-01 23:17:32 +01:00
|
|
|
|
2015-01-03 16:34:32 +01:00
|
|
|
import com.minres.scviewer.database.RelationType;
|
2020-11-28 14:47:43 +01:00
|
|
|
import com.minres.scviewer.database.tx.ITx;
|
|
|
|
import com.minres.scviewer.database.tx.ITxRelation;
|
2015-01-01 23:17:32 +01:00
|
|
|
|
2021-01-09 12:43:02 +01:00
|
|
|
/**
|
|
|
|
* The Class TxRelation.
|
|
|
|
*/
|
2021-01-03 17:44:52 +01:00
|
|
|
class TxRelation implements ITxRelation {
|
2021-01-02 16:15:27 +01:00
|
|
|
|
2021-01-09 12:43:02 +01:00
|
|
|
/** The loader. */
|
2021-01-03 14:16:56 +01:00
|
|
|
final TextDbLoader loader;
|
2021-01-09 12:43:02 +01:00
|
|
|
|
|
|
|
/** The scv relation. */
|
2021-01-03 14:16:56 +01:00
|
|
|
final ScvRelation scvRelation;
|
2021-01-09 12:43:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new tx relation.
|
|
|
|
*
|
|
|
|
* @param loader the loader
|
|
|
|
* @param scvRelation the scv relation
|
|
|
|
*/
|
2021-01-03 14:16:56 +01:00
|
|
|
public TxRelation(TextDbLoader loader, ScvRelation scvRelation) {
|
|
|
|
this.loader = loader;
|
|
|
|
this.scvRelation = scvRelation;
|
2015-01-01 23:17:32 +01:00
|
|
|
}
|
|
|
|
|
2021-01-09 12:43:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the relation type.
|
|
|
|
*
|
|
|
|
* @return the relation type
|
|
|
|
*/
|
2015-01-01 23:17:32 +01:00
|
|
|
@Override
|
|
|
|
public RelationType getRelationType() {
|
2021-01-03 14:16:56 +01:00
|
|
|
return scvRelation.relationType;
|
2015-01-01 23:17:32 +01:00
|
|
|
}
|
|
|
|
|
2021-01-09 12:43:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the source.
|
|
|
|
*
|
|
|
|
* @return the source
|
|
|
|
*/
|
2015-01-01 23:17:32 +01:00
|
|
|
@Override
|
2015-01-06 17:14:16 +01:00
|
|
|
public ITx getSource() {
|
2021-01-03 14:16:56 +01:00
|
|
|
return loader.getTransaction(scvRelation.source);
|
2015-01-01 23:17:32 +01:00
|
|
|
}
|
|
|
|
|
2021-01-09 12:43:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the target.
|
|
|
|
*
|
|
|
|
* @return the target
|
|
|
|
*/
|
2015-01-01 23:17:32 +01:00
|
|
|
@Override
|
2015-01-06 17:14:16 +01:00
|
|
|
public ITx getTarget() {
|
2021-01-03 14:16:56 +01:00
|
|
|
return loader.getTransaction(scvRelation.target);
|
2015-01-01 23:17:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|