public String toStringExpression() {
final StringBuffer buff = new StringBuffer("array(");
for (int i = 0; i < vars.length; i++) {
- final ArrayVariableDeclaration var = vars[i];
if (i != 0) {
buff.append(",");
}
- buff.append(var.toStringExpression());
+ if (vars[i] != null) {
+ buff.append(vars[i].toStringExpression());
+ }
}
buff.append(")");
return buff.toString();
}
- /**
+ /**
* Get the variables from outside (parameters, globals ...)
* @return the variables from outside
*/
public List getModifiedVariable() {
final ArrayList list = new ArrayList();
for (int i = 0; i < vars.length; i++) {
- list.addAll(vars[i].getModifiedVariable());
+ if (vars[i] != null) {
+ list.addAll(vars[i].getModifiedVariable());
+ }
}
return list;
}
public List getUsedVariable() {
final ArrayList list = new ArrayList();
for (int i = 0; i < vars.length; i++) {
- list.addAll(vars[i].getUsedVariable());
+ if (vars[i] != null) {
+ list.addAll(vars[i].getUsedVariable());
+ }
}
return list;
}
public Statement action;
+ /**
+ * a for statement
+ * @param initializations the initializations expressions
+ * @param condition the condition when the for get out
+ * @param increments the increments statements
+ * @param action the action (a statement, a block ...)
+ * @param sourceStart the beginning sources
+ * @param sourceEnd the ending sources
+ */
public ForStatement(final Expression[] initializations,
final Expression condition,
final Expression[] increments,
*/
public List getOutsideVariable() {
final ArrayList list = new ArrayList();
- list.addAll(condition.getOutsideVariable());
- list.addAll(action.getOutsideVariable());
- for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getOutsideVariable());
+ if (condition != null) {
+ list.addAll(condition.getOutsideVariable());
+ }
+ if (action != null) {
+ list.addAll(action.getOutsideVariable());
}
- for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getOutsideVariable());
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ list.addAll(initializations[i].getOutsideVariable());
+ }
+ }
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ list.addAll(increments[i].getOutsideVariable());
+ }
}
return list;
}
*/
public List getModifiedVariable() {
final ArrayList list = new ArrayList();
- list.addAll(condition.getModifiedVariable());
- list.addAll(action.getModifiedVariable());
- for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getModifiedVariable());
+ if (condition != null) {
+ list.addAll(condition.getModifiedVariable());
}
- for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getModifiedVariable());
+ if (action != null) {
+ list.addAll(action.getModifiedVariable());
+ }
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ list.addAll(initializations[i].getModifiedVariable());
+ }
+ }
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ list.addAll(increments[i].getModifiedVariable());
+ }
}
return list;
}
*/
public List getUsedVariable() {
final ArrayList list = new ArrayList();
- list.addAll(condition.getUsedVariable());
- list.addAll(action.getUsedVariable());
- for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getUsedVariable());
+ if (condition != null) {
+ list.addAll(condition.getUsedVariable());
+ }
+ if (action != null) {
+ list.addAll(action.getUsedVariable());
}
- for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getUsedVariable());
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ list.addAll(initializations[i].getUsedVariable());
+ }
+ }
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ list.addAll(increments[i].getUsedVariable());
+ }
}
return list;
}