private boolean firstMatchesGeneratedVariables(StatementIntermediate first, GeneratedVariable generatedArrayRef, GeneratedVariable generatedArrayIterator) {
Declaration childDeclaration = (Declaration)first.getExpression();
Expression right = childDeclaration.getAssignment().getRightHandSide();
if(right instanceof ArrayAccess) {
ArrayAccess apr = (ArrayAccess)right;
if(!(apr.getIndex() instanceof Variable)) {
return false;
}
if(!(apr.getArray() instanceof Variable)) {
return false;
}
//cast both to variable. check the variables match the name and type of the ones found above.
Variable arrayPosition = (Variable)apr.getArray();
Variable arrayRef = (Variable)apr.getArray();
if(!StringUtils.equals(arrayPosition.getName(), generatedArrayIterator.getName())) {
return false;
}