Skip to content
Snippets Groups Projects
Commit 3abe9240 authored by Chrissi's avatar Chrissi
Browse files

remove unused classe und clean code

parent 67cd031d
No related branches found
No related tags found
No related merge requests found
......@@ -23,44 +23,34 @@ public class CreateTTinJava {
}
public void createInputPort(String name, EObject id) {
//mapping += (id -> new InputPort(name, Set.empty, null, null))
ports.put(id, TTFactory.getInputPort(name));
}
public void createOutputPort(String name, EObject id) {
//mapping += (id -> new OutputPort(name, Set.empty, null, null))
ports.put(id, TTFactory.getOutputPort(name));
}
public void createRow(EObject id) {
//mapping += (id -> new Row(Set.empty, null, null))
rows.put(id, TTFactory.getRow());
}
public void createCell(Boolean value, EObject id) {
//mapping += (id -> new Cell(value, null, null, null))
cells.put(id, TTFactory.getCell(value));
}
public void createTruthTableRowsRow(EObject tt, EObject row) {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val r = mapping.get(row).get.asInstanceOf[Row]
Row r = rows.get(row);
truthttable.addRows(r);
r.setOwner(truthttable);
}
public void createTruthTablePortsPort(EObject tt, EObject port) {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val p = mapping.get(port).get.asInstanceOf[Port]
Port p = ports.get(port);
truthttable.addPorts(p);
p.setOwner(truthttable);
}
public void createRowCellsCell(EObject row, EObject cell) {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val r = mapping.get(row).get.asInstanceOf[Row]
Cell c = cells.get(cell);
Row r = rows.get(row);
c.setOwner(r);
......@@ -68,8 +58,6 @@ public class CreateTTinJava {
}
public void createCellPortPort(EObject cell, EObject port) {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val p = mapping.get(port).get.asInstanceOf[Port]
Cell c = cells.get(cell);
Port p = ports.get(port);
c.setPort(p);
......
package ttc2019.metamodels.create;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import ttc2019.metamodels.bdd.Assignment;
import ttc2019.metamodels.bdd.BDD;
import ttc2019.metamodels.bdd.BDDFactory;
import ttc2019.metamodels.bdd.InputPort;
import ttc2019.metamodels.bdd.Leaf;
import ttc2019.metamodels.bdd.OutputPort;
import ttc2019.metamodels.bdd.Port;
import ttc2019.metamodels.bdd.Subtree;
import ttc2019.metamodels.bdd.Tree;
public class CreationHelper {
private BDD bdd;
private Map<Object, Object> mapping = new HashMap<Object, Object>();
public void generate(String fileName) throws IOException {
File file = new File(fileName);
final ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
final Resource rImpl = rs.createResource(URI.createFileURI(file.getCanonicalPath()));
rImpl.getContents().add(bdd);
rImpl.save(null);
}
public void addLeafAssignmentConnection(Object leafScObj, Object assScObj) {
Leaf l = (Leaf)mapping.get(leafScObj);
Assignment a = (Assignment)mapping.get(assScObj);
a.setOwner(l);
l.getAssignments().add(a);
}
public void addOutputAssignmentConnection(Object outScObj, Object assScObj) {
OutputPort o = (OutputPort)mapping.get(outScObj);
Assignment a = (Assignment)mapping.get(assScObj);
o.getAssignments().add(a);
a.setPort(o);
}
public void addInputSubtreeConnection(Object inScObj, Object subScObj) {
InputPort i = (InputPort)mapping.get(inScObj);
Subtree s = (Subtree)mapping.get(subScObj);
s.setPort(i);
i.getSubtrees().add(s);
}
public void addSubtreeZeroTreeConnection(Object treeScObj, Object subScObj) {
Tree t = (Tree)mapping.get(treeScObj);
Subtree s = (Subtree)mapping.get(subScObj);
t.setOwnerSubtreeForZero(s);
s.setTreeForZero(t);
}
public void addSubtreeOneTreeConnection(Object treeScObj, Object subScObj) {
Tree t = (Tree)mapping.get(treeScObj);
Subtree s = (Subtree)mapping.get(subScObj);
t.setOwnerSubtreeForOne(s);
s.setTreeForOne(t);
}
public void addBDDPortConnection(Object portScObj) {
Port p = (Port)mapping.get(portScObj);
p.setOwner(bdd);
bdd.getPorts().add(p);
}
public void addBDDTreeConnection(Object treeScObj) {
Tree t = (Tree)mapping.get(treeScObj);
t.setOwnerBDD(bdd);
bdd.setTree(t);
}
public void createOutputPort(Object scalaObj, String name) {
OutputPort o = BDDFactory.eINSTANCE.createOutputPort();
o.setName(name);
mapping.put(scalaObj, o);
}
public void createInputPort(Object scalaObj, String name) {
InputPort i = BDDFactory.eINSTANCE.createInputPort();
i.setName(name);
mapping.put(scalaObj, i);
}
public void createAssignment(Object scalaObj, boolean value) {
Assignment a = BDDFactory.eINSTANCE.createAssignment();
a.setValue(value);
mapping.put(scalaObj, a);
}
public void createSubtree(Object scalaObj) {
Subtree sub = BDDFactory.eINSTANCE.createSubtree();
mapping.put(scalaObj, sub);
}
public void createLeaf(Object scalaObj) {
Leaf l = BDDFactory.eINSTANCE.createLeaf();
mapping.put(scalaObj, l);
}
public void createBDD(Object scalaObj, String name) {
bdd = BDDFactory.eINSTANCE.createBDD();
bdd.setName(name);
mapping.put(scalaObj, bdd);
}
}
......@@ -32,13 +32,10 @@ public class LoadEObject {
return ressourceModel.getContents().get(0);
}
public EObject load(String pathMeta, String pathInstance) throws IOException {
public EObject loadOptimized(String pathMeta, String pathInstance) throws IOException {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl());
//resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
//resourceSet.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true);
Resource ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true);
EObject packageMeta = ressourceMeta.getContents().get(0);
......@@ -54,10 +51,9 @@ public class LoadEObject {
return ressourceModel.getContents().get(0);
}
public TruthTable loadTT(String pathMeta, String pathInstance) throws IOException {
public TruthTable loadOptimizedTruthTable(String pathMeta, String pathInstance) throws IOException {
TTPackage.eINSTANCE.getName();
ResourceSet rs = new ResourceSetImpl();
//rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new IntrinsicIDXMIResourceFactoryImpl());
rs.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true);
Resource rTT = rs.getResource(URI.createFileURI(pathInstance), true);
......@@ -69,26 +65,5 @@ public class LoadEObject {
TruthTable tt = (TruthTable) rTT.getContents().get(0);
return tt;
/*ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl());
//resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
//resourceSet.getLoadOptions().put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true);
Resource ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true);
EObject packageMeta = ressourceMeta.getContents().get(0);
resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta);
Resource ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true);
Map<String, Object> loadOptions = new HashMap<>();
loadOptions.put(XMIResource.OPTION_DEFER_IDREF_RESOLUTION, true);
loadOptions.put(XMIResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
loadOptions.put(XMIResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>());
ressourceModel.load(loadOptions);
return (TruthTable)ressourceModel.getContents().get(0);*/
}
}
package ttc2019.metamodels.create;
import java.io.File;
import java.util.List;
import java.util.NoSuchElementException;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import ttc2019.metamodels.bdd.Assignment;
import ttc2019.metamodels.bdd.BDD;
import ttc2019.metamodels.bdd.BDDPackage;
import ttc2019.metamodels.bdd.InputPort;
import ttc2019.metamodels.bdd.Leaf;
import ttc2019.metamodels.bdd.Subtree;
import ttc2019.metamodels.bdd.Tree;
import ttc2019.metamodels.tt.Cell;
import ttc2019.metamodels.tt.Row;
import ttc2019.metamodels.tt.TTPackage;
import ttc2019.metamodels.tt.TruthTable;
/**
* Validates that a given BDD model corresponds to a given truth table: it gives
* the same outputs for the same inputs. We essentially "run" the BDD on the same
* inputs as the row, and we check that assignments match those of the TT.
*/
public class Validator {
private boolean validate(TruthTable tt, BDD bdd) {
if (tt.getPorts().size() != bdd.getPorts().size()) {
System.err.println(String.format(
"TT and BDD have different number of ports (TT = %d, BDD = %d)",
tt.getPorts().size(), bdd.getPorts().size()));
return false;
}
int iRow = 0;
for (Row ttRow : tt.getRows()) {
if (!validate(iRow, ttRow, bdd.getTree())) {
return false;
}
iRow++;
}
return true;
}
private boolean validate(int iRow, Row ttRow, Tree tree) {
final List<Assignment> assignments = findAssignments(ttRow, tree);
for (Assignment a : assignments) {
final String oPortName = a.getPort().getName();
final boolean expectedResult = getExpectedResult(ttRow, oPortName);
if (expectedResult != a.isValue()) {
System.err.println(String.format("Row %d of TT produces unexpected result %s in BDD", iRow, a.isValue()));
return false;
}
}
// No mismatches found!
return true;
}
private boolean getExpectedResult(Row ttRow, String oPortName) {
for (Cell c : ttRow.getCells()) {
if (c.getPort() instanceof ttc2019.metamodels.tt.OutputPort && c.getPort().getName().equals(oPortName)) {
return c.isValue();
}
}
throw new NoSuchElementException("Could not find output port " + oPortName + " in the cells of the truth table");
}
private List<Assignment> findAssignments(Row ttRow, Tree tree) {
if (tree instanceof Leaf) {
Leaf leaf = (Leaf) tree;
return leaf.getAssignments();
} else if (tree instanceof Subtree) {
Subtree sb = (Subtree) tree;
InputPort sbInputPort = sb.getPort();
for (Cell c : ttRow.getCells()) {
// Port must be an input and have the same name
if (c.getPort() instanceof ttc2019.metamodels.tt.InputPort && c.getPort().getName().equals(sbInputPort.getName())) {
return findAssignments(ttRow, c.isValue() ? sb.getTreeForOne() : sb.getTreeForZero());
}
}
throw new NoSuchElementException("Could not find input port " + sbInputPort.getName() + " in the cells of the truth table");
} else {
throw new IllegalArgumentException("Tree must be a subtree or a leaf");
}
}
public void validate(String ttName, String bddName) {
final File fInputTT = new File(ttName);
final File fOutputBDD = new File(bddName);
try {
// We only need to get these two metamodels loaded
TTPackage.eINSTANCE.getName();
BDDPackage.eINSTANCE.getName();
ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
Resource rTT = rs.getResource(URI.createFileURI(fInputTT.getCanonicalPath()), true);
Resource rBDD = rs.getResource(URI.createFileURI(fOutputBDD.getCanonicalPath()), true);
TruthTable tt = (TruthTable) rTT.getContents().get(0);
BDD bdd = (BDD) rBDD.getContents().get(0);
final boolean valid = new Validator().validate(tt, bdd);
if (valid) {
System.out.println(String.format("BDD %2$s matches TT %1$s: all OK", fInputTT.getName(), fOutputBDD.getName()));
} else {
System.err.println(String.format("BDD %2$s does not match TT %1$s: see issues above", fInputTT.getName(), fOutputBDD.getName()));
System.exit(2);
}
} catch (Exception e) {
e.printStackTrace();
System.exit(255);
}
}
}
package ttc2019
import ttc2019.metamodels.create.Validator
import org.rosi_project.model_management.core.SynchronizationCompartment
import org.rosi_project.model_management.core.RsumCompartment
import org.rosi_project.model_management.core.ModelElementLists
......@@ -8,8 +7,10 @@ import org.rosi_project.model_management.sync.IIntegrationCompartment
import ttc2019.metamodels.tt.TruthTable
import ttc2019.worksync._
import ttc2019.worksum._
import ttc2019.metamodels.create.Launcher
/** The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired
/**
* The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired
* by the different phases that the benchmark is expecting.
*/
object CompleteTTCProcess extends App {
......@@ -20,55 +21,68 @@ object CompleteTTCProcess extends App {
var integrate: IIntegrationCompartment = _
var writeOut: IWriteOutputModel = _
var loader: TTCLoader = _
var validator: Validator = _
var validator: Launcher = _
var saver: TruthTable = _
var processConfig: TTCProcessConfiguration = _
/** Performs necessary setup instructions such as loading the ecore meta-model.
/**
* Performs necessary setup instructions such as loading the ecore meta-model.
*
* @param processConfig contains the necessary file locations
*/
def initialize(processConfig: TTCProcessConfiguration): Unit = {
val sync = true
val bdt = false
loader = new TTCLoader
validator = new Validator
validator = new Launcher
if (sync) {
ctts = new CreateTruthTableSync()
if (bdt) {
integrate = BdtSyncIntegration
writeOut = WriteSyncBdtOutput
} else {
integrate = BddSyncIntegration
writeOut = WriteSyncBddOutput
}
} else {
ctts = new CreateTruthTableSum()
integrate = BdtSumIntegration
writeOut = WriteSumBdtOutput
}
this.processConfig = processConfig
saver = loader.javaTTfromEcore(processConfig.ttEcoreName, processConfig.ttFileName)
saver = loader.javaOptimizedTTJavaEcore(processConfig.ttEcoreName, processConfig.ttFileName)
}
/** Loads the truth table.
/**
* Loads the truth table.
*/
def load(): Unit = loader.createTruthTableRSYNCInstance(saver, ctts)
/** Transforms the truth table instance to a binary decision diagram.
/**
* Transforms the truth table instance to a binary decision diagram.
*/
def run(): Unit = SynchronizationCompartment.integrateNewModel(integrate)
/** Shows all created TT and BDD elements '''after transformation'''.
/**
* Shows all created TT and BDD elements '''after transformation'''.
*/
def printModelElements(): Unit = ModelElementLists.printFromPackage("sync.bdd.BDD")
/** Persists the BDD in the File system (according to the
/**
* Persists the BDD in the File system (according to the
* [[TTCProcessConfiguration process configuration]] specified during
* [[initialize() initialization]] '''after transformation'''.
*/
def writeBdd(): Unit = writeOut.generateEverything(processConfig.bddFileName)
/** Checks, whether the generated BDD and the original TT work as expected (after
/**
* Checks, whether the generated BDD and the original TT work as expected (after
* transformation!).
*/
def validateModelEquality(): Unit = validator.validate(processConfig.ttFileName, processConfig.bddFileName)
def validateModelEquality(): Unit = validator.launch(processConfig.ttFileName, processConfig.bddFileName)
/** Runs the entire transformation process at once.
/**
* Runs the entire transformation process at once.
*
* That is initialization, loading and running as the core part, as well as printing the model,
* writing the generated BDD and validating as extensions of the minimal workflow will be
......
......@@ -5,7 +5,6 @@ import org.eclipse.emf.ecore.EObject
class CreateTruthTableDirectSync extends ICreateTruthTable {
//var mapping: Map[EObject, Object] = Map.empty
var truthttable: TruthTable = null
var rows: java.util.Map[EObject, Row] = new java.util.HashMap()
var cells: java.util.Map[EObject, Cell] = new java.util.HashMap()
......@@ -16,44 +15,34 @@ class CreateTruthTableDirectSync extends ICreateTruthTable {
}
def createInputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new InputPort(name, Set.empty, null, null))
ports.put(id, new InputPort(name, Set.empty, null, null))
}
def createOutputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new OutputPort(name, Set.empty, null, null))
ports.put(id, new OutputPort(name, Set.empty, null, null))
}
def createRow(id: EObject): Unit = {
//mapping += (id -> new Row(Set.empty, null, null))
rows.put(id, new Row(Set.empty, null, null))
}
def createCell(value: Boolean, id: EObject): Unit = {
//mapping += (id -> new Cell(value, null, null, null))
cells.put(id, new Cell(value, null, null, null))
}
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val r = mapping.get(row).get.asInstanceOf[Row]
val r = rows.get(row)
truthttable.addRows(r)
r.setOwner(truthttable)
}
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val p = mapping.get(port).get.asInstanceOf[Port]
val p = ports.get(port)
truthttable.addPorts(p)
p.setOwner(truthttable)
}
def createRowCellsCell(row: EObject, cell: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val r = mapping.get(row).get.asInstanceOf[Row]
val c = cells.get(cell)
val r = rows.get(row)
c.setOwner(r)
......@@ -61,8 +50,6 @@ class CreateTruthTableDirectSync extends ICreateTruthTable {
}
def createCellPortPort(cell: EObject, port: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val p = mapping.get(port).get.asInstanceOf[Port]
val c = cells.get(cell)
val p = ports.get(port)
c.setPort(p)
......
......@@ -2,70 +2,55 @@ package ttc2019
import sync.tt._
import org.eclipse.emf.ecore.EObject
//import scala.collection.mutable.Map
class CreateTruthTableSync extends ICreateTruthTable {
//var mapping: Map[EObject, Object] = Map.empty
var mapping: java.util.Map[EObject, Object] = new java.util.HashMap()
var mapping: Map[EObject, Object] = Map.empty
def createTruthTable(name: String, id: EObject): Unit = {
//mapping += (id -> new TruthTable(name, Set.empty, Set.empty, null))
mapping.put(id, new TruthTable(name, Set.empty, Set.empty, null))
mapping += (id -> new TruthTable(name, Set.empty, Set.empty, null))
}
def createInputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new InputPort(name, Set.empty, null, null))
mapping.put(id, new InputPort(name, Set.empty, null, null))
mapping += (id -> new InputPort(name, Set.empty, null, null))
}
def createOutputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new OutputPort(name, Set.empty, null, null))
mapping.put(id, new OutputPort(name, Set.empty, null, null))
mapping += (id -> new OutputPort(name, Set.empty, null, null))
}
def createRow(id: EObject): Unit = {
//mapping += (id -> new Row(Set.empty, null, null))
mapping.put(id, new Row(Set.empty, null, null))
mapping += (id -> new Row(Set.empty, null, null))
}
def createCell(value: Boolean, id: EObject): Unit = {
//mapping += (id -> new Cell(value, null, null, null))
mapping.put(id, new Cell(value, null, null, null))
mapping += (id -> new Cell(value, null, null, null))
}
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val r = mapping.get(row).get.asInstanceOf[Row]
val t = mapping.get(tt).asInstanceOf[TruthTable]
val r = mapping.get(row).asInstanceOf[Row]
val t = mapping.get(tt).get.asInstanceOf[TruthTable]
val r = mapping.get(row).get.asInstanceOf[Row]
t.addRows(r)
r.setOwner(t)
}
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val p = mapping.get(port).get.asInstanceOf[Port]
val t = mapping.get(tt).asInstanceOf[TruthTable]
val p = mapping.get(port).asInstanceOf[Port]
val t = mapping.get(tt).get.asInstanceOf[TruthTable]
val p = mapping.get(port).get.asInstanceOf[Port]
t.addPorts(p)
p.setOwner(t)
}
def createRowCellsCell(row: EObject, cell: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val r = mapping.get(row).get.asInstanceOf[Row]
val c = mapping.get(cell).asInstanceOf[Cell]
val r = mapping.get(row).asInstanceOf[Row]
val c = mapping.get(cell).get.asInstanceOf[Cell]
val r = mapping.get(row).get.asInstanceOf[Row]
c.setOwner(r)
r.addCells(c)
}
def createCellPortPort(cell: EObject, port: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val p = mapping.get(port).get.asInstanceOf[Port]
val c = mapping.get(cell).asInstanceOf[Cell]
val p = mapping.get(port).asInstanceOf[Port]
val c = mapping.get(cell).get.asInstanceOf[Cell]
val p = mapping.get(port).get.asInstanceOf[Port]
c.setPort(p)
p.addCells(c)
}
......
......@@ -26,36 +26,28 @@ class TTCLoader {
* @param path where to find the model
* @return the model described by the XML
*/
def javaLoadEcore(pathMeta: String, pathInstance: String): EObject = {
def javaOptimizedTTJavaEcore(pathMeta: String, pathInstance: String): TruthTable = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
val loader = new LoadEObject
return loader.load(pathMeta, pathInstance)
return loader.loadOptimizedTruthTable(pathMeta, pathInstance)
}
def javaSimpleLoadEcore(pathMeta: String, pathInstance: String): EObject = {
def loadOptimizedJavaEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
val loader = new LoadEObject
return loader.loadSimple(pathMeta, pathInstance)
return loader.loadOptimized(pathMeta, pathInstance)
}
def javaTTfromEcore(pathMeta: String, pathInstance: String): TruthTable = {
def loadSimpleJavaEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
val loader = new LoadEObject
return loader.loadTT(pathMeta, pathInstance)
return loader.loadSimple(pathMeta, pathInstance)
}
def scalaLoadEcore(pathMeta: String, pathInstance: String): EObject = {
def loadScalaEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
val resourceSet = new ResourceSetImpl();
/*resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true.asInstanceOf[Object]);
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, true.asInstanceOf[Object]);
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true.asInstanceOf[Object])
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl())
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl())*/
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment