Package: org.codehaus.groovy.ast.expr

## [Java] Class RangeExpression

- org.codehaus.groovy.ast.expr.RangeExpression

-     public class RangeExpression
      extends Expression

  Represents a range expression for creating range objects with bounded endpoints. Supports inclusive ranges (e.g., `0..10`) and exclusive ranges (e.g., `0..<10` or `<0..10`). Range expressions are commonly used in for-loops (e.g., `for (i in 0..10)`) and other iteration contexts. The type of a range expression is always ClassHelper.RANGE_TYPE.

  See Also:
    Expression for the boundary expressions
    ClassHelper.RANGE_TYPE for the range type

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Expression` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `RangeExpression(Expression from, Expression to, boolean inclusive)` Creates an inclusive or exclusive range expression.
    `RangeExpression(Expression from, Expression to, boolean exclusiveLeft, boolean exclusiveRight)` Creates a range expression with full control over inclusivity of both endpoints.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Expression` | `getFrom()` Returns the starting expression of the range.
    `` | `public String` | `getText()`
    `` | `public Expression` | `getTo()` Returns the ending expression of the range.
    `` | `public boolean` | `isExclusiveLeft()` Indicates whether the left endpoint is exclusive (uses `<..`).
    `` | `public boolean` | `isExclusiveRight()` Indicates whether the right endpoint is exclusive (uses `..<`).
    `` | `public boolean` | `isInclusive()` Indicates whether this is an inclusive range (no exclusion on the right endpoint).
    `` | `public Expression` | `transformExpression(ExpressionTransformer transformer)`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Expression` | `getType, setType, transformExpression, transformExpressions, transformExpressions`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public RangeExpression(Expression from, Expression to, boolean inclusive)

      Creates an inclusive or exclusive range expression.

      Parameters:
        `from` - the starting expression (non-null)
        `to` - the ending expression (non-null)
        `inclusive` - true for inclusive range (no exclusion), false for exclusive right endpoint

    - #### public RangeExpression(Expression from, Expression to, boolean exclusiveLeft, boolean exclusiveRight)

      Creates a range expression with full control over inclusivity of both endpoints.

      Parameters:
        `from` - the starting expression (non-null)
        `to` - the ending expression (non-null)
        `exclusiveLeft` - true if the left endpoint should be excluded (using `<..`)
        `exclusiveRight` - true if the right endpoint should be excluded (using `..<`)

  - ### Method Detail

    - #### public Expression getFrom()

      Returns the starting expression of the range.

      Returns:
        the from expression

    - #### public String getText()

    - #### public Expression getTo()

      Returns the ending expression of the range.

      Returns:
        the to expression

    - #### public boolean isExclusiveLeft()

      Indicates whether the left endpoint is exclusive (uses `<..`).

      Returns:
        true if the left endpoint is excluded, false otherwise

    - #### public boolean isExclusiveRight()

      Indicates whether the right endpoint is exclusive (uses `..<`).

      Returns:
        true if the right endpoint is excluded, false otherwise

    - #### public boolean isInclusive()

      Indicates whether this is an inclusive range (no exclusion on the right endpoint).

      Returns:
        true if the range is inclusive on the right, false if exclusive

    - #### public Expression transformExpression(ExpressionTransformer transformer)

    - #### public void visit(GroovyCodeVisitor visitor)