本文整理汇总了Java中org.eclipse.epsilon.etl.EtlModule类的典型用法代码示例。如果您正苦于以下问题:Java EtlModule类的具体用法?Java EtlModule怎么用?Java EtlModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EtlModule类属于org.eclipse.epsilon.etl包,在下文中一共展示了EtlModule类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isProperlyContained
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
public boolean isProperlyContained()
{
boolean result = false;
for(EOLElement de: createdEolElements)
{
EOLElement trace = de;
while(!(de instanceof EtlModule) && trace.getContainer() != null)
{
trace = trace.getContainer();
}
if(trace.equals(this.fetchEtlProgram()))
{
result = true;
}
else {
result = false;
System.err.println("The domElement is: " + trace.getClass());
break;
}
}
return result;
}
示例2: parseAST
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
public static EOLElement parseAST(String text)
{
EtlModule etlModule = new EtlModule();
try {
etlModule.parse(text);
} catch (Exception e) {
e.printStackTrace();
return null;
}
Ast2EtlContext context = new Ast2EtlContext(etlModule);
EOLElement result = context.getEtlElementCreatorFactory().createEOLElement(etlModule.getAst(), null, context);
return result;
}
示例3: createModule
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
@Override
public IEolExecutableModule createModule() {
EtlModule module = new EtlModule();
module.getContext().getNativeTypeDelegates()
.add(new ExtensionPointToolNativeTypeDelegate());
return module;
}
示例4: test
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
@Test
public void test() {
URL url = getClass().getResource("test_import.etl");
System.out.println(url.toString());
EtlModule etlModule = new EtlModule();
try {
etlModule.parse(new File(url.getPath()));
} catch (Exception e) {
e.printStackTrace();
}
Ast2EtlContext context = new Ast2EtlContext(etlModule);
EOLElement eolElement = context.getEtlElementCreatorFactory().createEOLElement(etlModule.getAst(), null, context);
assertEquals(eolElement.getClass(), ETLModuleImpl.class);
ETLModule etlProgram = (ETLModule) eolElement;
assertEquals(etlProgram.getModelDeclarations().size(), 0);
assertEquals(etlProgram.getPreBlocks().size(), 0);
assertEquals(etlProgram.getPostBlocks().size(), 0);
assertEquals(etlProgram.getTransformationRules().size(), 1);
assertEquals(etlProgram.getOperations().size(), 0);
assertEquals(etlProgram.getImports().size(), 1);
Import import1 = etlProgram.getImports().get(0);
assertEquals(import1.getImportedModule().getClass(), EOLModuleImpl.class);
assertEquals(import1.getImported(), "loadModels.eol");
TransformationRule rule1 = etlProgram.getTransformationRules().get(0);
assertEquals(rule1.getName().getName(), "A2D");
assertEquals(rule1.getSource().getName().getName(), "a");
assertEquals(rule1.getSource().getResolvedType().getClass(), ModelElementTypeImpl.class);
ModelElementType source1Type = (ModelElementType) rule1.getSource().getResolvedType();
assertEquals(source1Type.getModelName(), "Source");
assertEquals(source1Type.getElementName(), "A");
assertEquals(rule1.getTargets().size(), 1);
FormalParameterExpression rule1target = rule1.getTargets().get(0);
assertEquals(rule1target.getName().getName(), "e");
assertEquals(rule1target.getResolvedType().getClass(), ModelElementTypeImpl.class);
ModelElementType rule1targetType = (ModelElementType) rule1target.getResolvedType();
assertEquals(rule1targetType.getModelName(), "Target");
assertEquals(rule1targetType.getElementName(), "E");
ExpressionOrStatementBlock guard = rule1.getGuard();
assertEquals(guard.getBlock(), null);
NotEqualsOperatorExpression notEqualsOperatorExpression = (NotEqualsOperatorExpression) guard.getExpression();
NameExpression conditionLhs = (NameExpression) notEqualsOperatorExpression.getLhs();
assertEquals(conditionLhs.getName(), "a");
NameExpression conditionRhs = (NameExpression) notEqualsOperatorExpression.getRhs();
assertEquals(conditionRhs.getName(), "null");
assertEquals(rule1.getBody().getStatements().size(), 1);
Statement statement1 = rule1.getBody().getStatements().get(0);
assertEquals(statement1.getClass(), AssignmentStatementImpl.class);
AssignmentStatement assignmentStatement = (AssignmentStatement) statement1;
assertEquals(assignmentStatement.getLhs().getClass(), PropertyCallExpressionImpl.class);
PropertyCallExpression lhs = (PropertyCallExpression) assignmentStatement.getLhs();
assertEquals(lhs.getTarget().getClass(), NameExpressionImpl.class);
NameExpression target = (NameExpression) lhs.getTarget();
assertEquals(target.getName(), "e");
NameExpression property = lhs.getProperty();
assertEquals(property.getName(), "f");
MethodCallExpression rhs = (MethodCallExpression) assignmentStatement.getRhs();
PropertyCallExpression rhsTarget = (PropertyCallExpression) rhs.getTarget();
NameExpression rhsTargetTarget = (NameExpression) rhsTarget.getTarget();
assertEquals(rhsTargetTarget.getName(), "a");
assertEquals(rhsTarget.getProperty().getName(), "b");
assertEquals(rhs.getMethod().getName(), "equivalents");
}
示例5: test1
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
@Test
public void test1() {
URL url = getClass().getResource("test_import2.etl");
System.out.println(url.toString());
EtlModule etlModule = new EtlModule();
try {
etlModule.parse(new File(url.getPath()));
} catch (Exception e) {
e.printStackTrace();
}
Ast2EtlContext context = new Ast2EtlContext(etlModule);
EOLElement eolElement = context.getEtlElementCreatorFactory().createEOLElement(etlModule.getAst(), null, context);
assertEquals(eolElement.getClass(), ETLModuleImpl.class);
ETLModule etlProgram = (ETLModule) eolElement;
assertEquals(etlProgram.getModelDeclarations().size(), 0);
assertEquals(etlProgram.getPreBlocks().size(), 0);
assertEquals(etlProgram.getPostBlocks().size(), 0);
assertEquals(etlProgram.getTransformationRules().size(), 1);
assertEquals(etlProgram.getOperations().size(), 0);
assertEquals(etlProgram.getImports().size(), 1);
Import import1 = etlProgram.getImports().get(0);
assertEquals(import1.getImportedModule().getClass(), ETLModuleImpl.class);
assertEquals(import1.getImported(), "imported_etl.etl");
TransformationRule rule1 = etlProgram.getTransformationRules().get(0);
assertEquals(rule1.getName().getName(), "A2D");
assertEquals(rule1.getSource().getName().getName(), "a");
assertEquals(rule1.getSource().getResolvedType().getClass(), ModelElementTypeImpl.class);
ModelElementType source1Type = (ModelElementType) rule1.getSource().getResolvedType();
assertEquals(source1Type.getModelName(), "Source");
assertEquals(source1Type.getElementName(), "A");
assertEquals(rule1.getTargets().size(), 1);
FormalParameterExpression rule1target = rule1.getTargets().get(0);
assertEquals(rule1target.getName().getName(), "e");
assertEquals(rule1target.getResolvedType().getClass(), ModelElementTypeImpl.class);
ModelElementType rule1targetType = (ModelElementType) rule1target.getResolvedType();
assertEquals(rule1targetType.getModelName(), "Target");
assertEquals(rule1targetType.getElementName(), "E");
ExpressionOrStatementBlock guard = rule1.getGuard();
assertEquals(guard.getBlock(), null);
NotEqualsOperatorExpression notEqualsOperatorExpression = (NotEqualsOperatorExpression) guard.getExpression();
NameExpression conditionLhs = (NameExpression) notEqualsOperatorExpression.getLhs();
assertEquals(conditionLhs.getName(), "a");
NameExpression conditionRhs = (NameExpression) notEqualsOperatorExpression.getRhs();
assertEquals(conditionRhs.getName(), "null");
assertEquals(rule1.getBody().getStatements().size(), 1);
Statement statement1 = rule1.getBody().getStatements().get(0);
assertEquals(statement1.getClass(), AssignmentStatementImpl.class);
AssignmentStatement assignmentStatement = (AssignmentStatement) statement1;
assertEquals(assignmentStatement.getLhs().getClass(), PropertyCallExpressionImpl.class);
PropertyCallExpression lhs = (PropertyCallExpression) assignmentStatement.getLhs();
assertEquals(lhs.getTarget().getClass(), NameExpressionImpl.class);
NameExpression target = (NameExpression) lhs.getTarget();
assertEquals(target.getName(), "e");
NameExpression property = lhs.getProperty();
assertEquals(property.getName(), "f");
MethodCallExpression rhs = (MethodCallExpression) assignmentStatement.getRhs();
PropertyCallExpression rhsTarget = (PropertyCallExpression) rhs.getTarget();
NameExpression rhsTargetTarget = (NameExpression) rhsTarget.getTarget();
assertEquals(rhsTargetTarget.getName(), "a");
assertEquals(rhsTarget.getProperty().getName(), "b");
assertEquals(rhs.getMethod().getName(), "equivalents");
}
示例6: createModule
import org.eclipse.epsilon.etl.EtlModule; //导入依赖的package包/类
@Override
public IEolExecutableModule createModule() {
return new EtlModule();
}