本文整理汇总了Java中org.eclipse.gmt.modisco.java.Statement类的典型用法代码示例。如果您正苦于以下问题:Java Statement类的具体用法?Java Statement怎么用?Java Statement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Statement类属于org.eclipse.gmt.modisco.java包,在下文中一共展示了Statement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryBranchStatements
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
@SuppressWarnings("unused")
public static Query<Integer> queryBranchStatements(Resource resource) {
return () -> {
List<Statement> result = new BasicEList<>();
Model model = (Model) resource.getContents().get(0);
if (model.getName().equals("org.eclipse.gmt.modisco.java.neoemf") || model.getName().equals("org.eclipse.jdt.core")) {
try {
for (org.eclipse.gmt.modisco.java.Package pack : model.getOwnedElements()) {
appendAccessedTypes(pack, result);
}
}
catch (NullPointerException e) {
log.error(e);
}
}
return result.size();
};
}
示例2: appendAccessedTypes
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
private static void appendAccessedTypes(org.eclipse.gmt.modisco.java.Package pack, List<Statement> result) {
for (AbstractTypeDeclaration el : pack.getOwnedElements()) {
if (JavaPackage.eINSTANCE.getClassDeclaration().isInstance(el)) {
appendAccessedTypes((ClassDeclaration) el, result);
}
}
for (org.eclipse.gmt.modisco.java.Package subPack : pack.getOwnedPackages()) {
appendAccessedTypes(subPack, result);
}
}
示例3: createWhileInstruction
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Create a new while instruction
*
* @param condition
* the condition of the created while instruction.
* @param instructions
* the instructions list in the created while instruction.
* @return the created while instruction.
*/
public static ComplexInstruction createWhileInstruction(IElementaryInstruction condition,
IComplexInstruction... instructions) {
Block block = BlockBuilder.builder().build();
EList<Statement> statements = block.getStatements();
for (IComplexInstruction instruction : instructions) {
statements.add(instruction.getStatement());
}
return new ComplexInstruction(WhileStatementBuilder.builder().setBody(block)
.setExpression(condition.getExpression()).build());
}
示例4: createDoInstruction
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Create a new do instruction
*
* @param condition
* the condition of the created do instruction.
* @param instructions
* the instructions list in the created do instruction.
* @return the created do instruction.
*/
public static ComplexInstruction createDoInstruction(IElementaryInstruction condition,
IComplexInstruction... instructions) {
Block block = BlockBuilder.builder().build();
EList<Statement> statements = block.getStatements();
for (IComplexInstruction instruction : instructions) {
statements.add(instruction.getStatement());
}
return new ComplexInstruction(DoStatementBuilder.builder().setBody(block)
.setExpression(condition.getExpression()).build());
}
示例5: IfInstructionHelper
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Private constructor : a new if instruction (without else block)
*
* @param condition
* the condition of the if instruction under construction.
* @param thenInstructions
* the instructions list in the then block of the if instruction
* under construction.
*/
private IfInstructionHelper(IElementaryInstruction condition, IComplexInstruction... thenInstructions) {
this.thenBlock = BlockBuilder.builder().build();
EList<Statement> statementsList = this.thenBlock.getStatements();
for (IComplexInstruction thenInstruction : thenInstructions) {
statementsList.add(thenInstruction.getStatement());
}
this.buildIfInstruction = IfStatementBuilder.builder().setExpression(condition.getExpression())
.setThenStatement(this.thenBlock).build();
}
示例6: addElseBlockInstruction
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add an instructions list to the else block to the if instruction under
* construction
*
* @param elseInstructions
* the instructions list to add to the else block of the if
* instruction under construction.
* @return the helper.
*/
public IfInstructionHelper addElseBlockInstruction(IComplexInstruction... elseInstructions) {
if (this.elseBlock == null) {
this.elseBlock = BlockBuilder.builder().build();
this.buildIfInstruction.setElseStatement(this.elseBlock);
}
EList<Statement> statementsList = this.elseBlock.getStatements();
for (IComplexInstruction thenInstruction : elseInstructions) {
statementsList.add(thenInstruction.getStatement());
}
return this;
}
示例7: addFinalCaseBlock
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add the final case block to the switch instruction under construction
*
* @param finalCaseInstructions
* the instructions list of the final case block to add to the
* switch instruction under construction.
* @return the build switch instruction.
*/
public ComplexInstruction addFinalCaseBlock(IComplexInstruction... finalCaseInstructions) {
EList<Statement> statementList = this.buildSwitchInstruction.getStatements();
statementList.add(SwitchCaseBuilder.builder().setDefault(true).build());
for (IComplexInstruction caseInstruction : finalCaseInstructions) {
statementList.add(caseInstruction.getStatement());
}
return this.build();
}
示例8: TryCatchInstructionHelper
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Private constructor : a new try/catch instruction (without catch block
* and finally block)
*
* @param tryInstructions
* the instructions list in the try block of the try/catch
* instruction under construction.
*/
private TryCatchInstructionHelper(IComplexInstruction... tryInstructions) {
this.tryBlock = BlockBuilder.builder().build();
EList<Statement> statementsList = this.tryBlock.getStatements();
for (IComplexInstruction tryInstruction : tryInstructions) {
statementsList.add(tryInstruction.getStatement());
}
this.buildTryInstruction = TryStatementBuilder.builder().setBody(this.tryBlock).build();
}
示例9: addFinallyBlockInstruction
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add an instructions list to the finally block to the try/catch
* instruction under construction
*
* @param finallyInstructions
* the instructions list to add to the finally block of the
* try/catch instruction under construction.
* @return the helper.
*/
public TryCatchInstructionHelper addFinallyBlockInstruction(IComplexInstruction... finallyInstructions) {
if (this.finallyBlock == null) {
this.finallyBlock = BlockBuilder.builder().build();
this.buildTryInstruction.setFinally(finallyBlock);
}
EList<Statement> statementsList = this.finallyBlock.getStatements();
for (IComplexInstruction finallyInstruction : finallyInstructions) {
statementsList.add(finallyInstruction.getStatement());
}
return this;
}
示例10: addStatements
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add a list of statements to the block under construction
*
* @param statements
* the list of statements to add to the block under construction.
* @return the builder.
*/
public BlockBuilder addStatements(Statement... statements) {
EList<Statement> statementsList = this.buildBlock.getStatements();
for (Statement statement : statements) {
statementsList.add(statement);
}
return this;
}
示例11: appendAccessedTypesFromBody
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
private static void appendAccessedTypesFromBody(List<Statement> statements, List<Statement> result) {
for (Statement s : statements) {
appendAccessedTypesFromStatement(s, result);
}
}
示例12: appendAccessedTypesFromStatement
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
private static void appendAccessedTypesFromStatement(Statement statement, List<Statement> result) {
if (statement instanceof Block) {
appendAccessedTypesFromBody(((Block) statement).getStatements(), result);
}
result.add(statement);
}
示例13: getStatement
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
public Statement getStatement() {
return this.getDelegate();
}
示例14: addThenBlockInstruction
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add an instructions list to the then block to the if instruction under
* construction
*
* @param thenInstructions
* the instructions list to add to the then block of the if
* instruction under construction.
* @return the helper.
*/
public IfInstructionHelper addThenBlockInstruction(IComplexInstruction... thenInstructions) {
EList<Statement> statementsList = this.thenBlock.getStatements();
for (IComplexInstruction thenInstruction : thenInstructions) {
statementsList.add(thenInstruction.getStatement());
}
return this;
}
示例15: addCaseBlock
import org.eclipse.gmt.modisco.java.Statement; //导入依赖的package包/类
/**
* Add a case block to the switch instruction under construction
*
* @param condition
* the condition of the case block to add to the switch
* instruction under construction.
* @param withBreak
* tell if a break instruction finished the case block to add to
* the switch instruction under construction.
* @param caseInstructions
* the instructions list of the case block to add to the switch
* instruction under construction.
* @return the helper.
*/
public SwitchInstructionHelper addCaseBlock(IElementaryInstruction condition, boolean withBreak,
IComplexInstruction... caseInstructions) {
EList<Statement> statementList = this.buildSwitchInstruction.getStatements();
statementList.add(SwitchCaseBuilder.builder().setExpression(condition.getExpression()).setDefault(false)
.build());
for (IComplexInstruction caseInstruction : caseInstructions) {
statementList.add(caseInstruction.getStatement());
}
if (withBreak) {
statementList.add(JavaFactory.eINSTANCE.createBreakStatement());
}
return this;
}