Interface IJavaFor

All Superinterfaces:
IJavaCompound, IJavaElement, IJavaExpression, IJavaStatement

@Ser public interface IJavaFor extends IJavaCompound
Java AST interface used to represent a standard for loop statement. A for loop is a pre-tested loop, that consists of an initializer statement, a test predicate, a post-iteration statement, and a body.

Example:

 for(initializer; predicate; poststm) {
     // body
 }
 
  • Method Details

    • getInitializer

      IJavaStatement getInitializer()
      Get the initializer statement.
      Returns:
      the initializer statement, may be null
    • getPredicate

      IJavaPredicate getPredicate()
      Get the loop predicate.
      Returns:
      the loop predicate, may be null
    • getPostStatement

      IJavaStatement getPostStatement()
      Get the post-iteration statement.
      Returns:
      the post-iteration statement, may be null
    • getBody

      IJavaBlock getBody()
      Get the loop body.
      Returns:
      the loop body, never null
    • setInitializer

      void setInitializer(IJavaStatement initializer)
      Set the loop initializer statement.
      Parameters:
      initializer - optional initializer
    • setPredicate

      void setPredicate(IJavaPredicate p)
      Set the loop predicate.
      Parameters:
      p - optional loop predicate
    • setPostStatement

      void setPostStatement(IJavaStatement poststm)
      Set the loop post-iteration statement.
      Parameters:
      poststm - optional post-iteration statement
    • setBody

      void setBody(IJavaBlock b)
      Set the loop post-iteration statement.
      Parameters:
      b - mandatory loop body
    • duplicate

      IJavaFor duplicate()
      Description copied from interface: IJavaElement
      Duplicate this element.
      Specified by:
      duplicate in interface IJavaCompound
      Specified by:
      duplicate in interface IJavaElement
      Specified by:
      duplicate in interface IJavaExpression
      Specified by:
      duplicate in interface IJavaStatement
      Returns:
      a (possibly) duplicated object of the same type