//if either of these are null, then this doesn't match.
if(arrayLenthCandidate == null || tempArrayCandidate == null) {
return;
}
GeneratedVariable generatedArrayLength = extractGeneratedVariableDeclaration(arrayLenthCandidate);
GeneratedVariable generatedArrayReference = extractGeneratedVariableDeclaration(tempArrayCandidate);
GeneratedVariable arrayIteratorValue = extractGeneratedVariableDeclaration(line.getInit());
if(generatedArrayLength == null || generatedArrayReference == null || arrayIteratorValue == null) {
return;
}
//now validate the types. array length should be an integer. the array reference, well, should be an array ;)
//the iterator should be an integer.
if(generatedArrayLength.getType() != Type.INT) {
if(!(generatedArrayReference.getType() instanceof ArrayType)) {
return;
}
if(arrayIteratorValue.getType() != Type.INT) {
return;
}
}
//great; at this point we know the pattern matches. check the next statement to see if the transformation is possible.