spoon.reflect.code.CtDo Java Examples

The following examples show how to use spoon.reflect.code.CtDo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCodeAnalyzer.java    From coming with MIT License 6 votes vote down vote up
public CtElement retrieveElementToStudy(CtElement element) {

		if (element instanceof CtIf) {
			return (((CtIf) element).getCondition());
		} else if (element instanceof CtWhile) {
			return (((CtWhile) element).getLoopingExpression());
		} else if (element instanceof CtFor) {
			return (((CtFor) element).getExpression());
		} else if (element instanceof CtDo) {
			return (((CtDo) element).getLoopingExpression());
		} else if (element instanceof CtForEach) {
			return (((CtForEach) element).getExpression());
		} else if (element instanceof CtSwitch) {
			return (((CtSwitch) element).getSelector());
		} else
			return (element);
	}
 
Example #2
Source File: CodeElementInfo.java    From coming with MIT License 6 votes vote down vote up
private CtElement retrieveElementToStudy(CtElement element) {

		if (element instanceof CtIf) {
			return (((CtIf) element).getCondition());
		} else if (element instanceof CtWhile) {
			return (((CtWhile) element).getLoopingExpression());
		} else if (element instanceof CtFor) {
			return (((CtFor) element).getExpression());
		} else if (element instanceof CtDo) {
			return (((CtDo) element).getLoopingExpression());
		} else if (element instanceof CtForEach) {
			return (((CtForEach) element).getExpression());
		} else if (element instanceof CtSwitch) {
			return (((CtSwitch) element).getSelector());
		} else
			return (element);
	}
 
Example #3
Source File: SpecialStatementFixSpaceProcessor.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void process(CtStatement element) {

	if (element instanceof CtIf) {
		add(((CtIf) element).getCondition());
	} else if (element instanceof CtFor) {
		add(((CtFor) element).getExpression());
	} else if (element instanceof CtWhile) {
		add(((CtWhile) element).getLoopingExpression());
	} else if (element instanceof CtDo) {
		add(((CtDo) element).getLoopingExpression());
	} else if (element instanceof CtThrow) {
		add(((CtThrow) element).getThrownExpression());
	} else if (element instanceof CtInvocation && (element.getParent() instanceof CtBlock)) {
		add(element);
	} else if (element instanceof CtAssignment || element instanceof CtConstructorCall
			|| element instanceof CtCFlowBreak || element instanceof CtLocalVariable) {
		add(element);
	}

}
 
Example #4
Source File: LoopExpressionFixSpaceProcessor.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void process(CtLoop element) {
	if(element instanceof CtFor){
		addExpressionAndSubexpressions(((CtFor)element).getExpression());
	}
	if(element instanceof CtWhile){
		addExpressionAndSubexpressions(((CtWhile)element).getLoopingExpression());
	}
	if(element instanceof CtDo){
		addExpressionAndSubexpressions(((CtDo)element).getLoopingExpression());
	}
	
}
 
Example #5
Source File: LogicalExpressionAnalyzer.java    From coming with MIT License 4 votes vote down vote up
@Override
public void visitCtDo(CtDo doLoop) {
	toScan = doLoop.getLoopingExpression();
}
 
Example #6
Source File: BinaryOperatorAnalyzer.java    From coming with MIT License 4 votes vote down vote up
private void analyzeBinaryOperatorCompareInCondition (CtElement wholeoriginal, CtBinaryOperator operatorunderstudy, int operatorindex, Cntx<Object> context) {
	
	boolean whethercompareincondition = false; 
	
       if(wholeoriginal instanceof CtIf || wholeoriginal instanceof CtWhile || wholeoriginal instanceof CtFor 
       	|| wholeoriginal instanceof CtDo || wholeoriginal instanceof CtForEach || wholeoriginal instanceof CtSwitch) {
       	
   		BinaryOperatorKind operatorkind = operatorunderstudy.getKind();

   		if (compareOperator.contains(operatorkind))
   			whethercompareincondition = true;
       }
	
       writeGroupedInfo(context, Integer.toString(operatorindex)+"_"+operatorunderstudy, CodeFeatures.O4_COMPARE_IN_CONDITION, 
			whethercompareincondition, "FEATURES_BINARYOPERATOR");
}