SCViewer/plugins/com.minres.scviewer.databas.../src/com/minres/scviewer/database/text/TxRelation.java

70 lines
1.6 KiB
Java
Raw Normal View History

/*******************************************************************************
* 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
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
/**
* The Class TxRelation.
*/
2021-01-03 17:44:52 +01:00
class TxRelation implements ITxRelation {
/** The loader. */
final TextDbLoader loader;
/** The scv relation. */
final ScvRelation scvRelation;
/**
* Instantiates a new tx relation.
*
* @param loader the loader
* @param scvRelation the scv relation
*/
public TxRelation(TextDbLoader loader, ScvRelation scvRelation) {
this.loader = loader;
this.scvRelation = scvRelation;
2015-01-01 23:17:32 +01:00
}
/**
* Gets the relation type.
*
* @return the relation type
*/
2015-01-01 23:17:32 +01:00
@Override
public RelationType getRelationType() {
return scvRelation.relationType;
2015-01-01 23:17:32 +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() {
return loader.getTransaction(scvRelation.source);
2015-01-01 23:17:32 +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() {
return loader.getTransaction(scvRelation.target);
2015-01-01 23:17:32 +01:00
}
}