Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core.isdl.ast
Class MapExpr

    java.lang.Object
      avrora.core.isdl.ast.Expr
          avrora.core.isdl.ast.MapExpr

public class MapExpr
extends Expr

The `MapExpr` class represents an expression that is an access of an element within a map.

Field Summary
`Expr` | `index` The `index` field stores a references to the expression which is evaluated to yield the index into the map.
`Token` | `mapname` The `mapname` field stores a reference to the name of the map whose element is being accessed.

Fields inherited from class avrora.core.isdl.ast.Expr
`PREC_A_ADD, PREC_A_AND, PREC_A_MUL, PREC_A_OR, PREC_A_SHIFT, PREC_A_XOR, PREC_L_AND, PREC_L_EQU, PREC_L_OR, PREC_L_REL, PREC_L_XOR, PREC_TERM, PREC_UN`

Constructor Summary
`MapExpr(Token s, Expr i)` The constructor of the `MapExpr` class initializes the publicly accessable fields that represent the members of this expression

Method Summary
`Expr` | `accept(CodeRebuilder r)` The `accept()` method implements one half of the visitor pattern for rebuilding of expressions.
`void` | `accept(CodeVisitor v)` The `accept()` method implements one half of the visitor pattern so that client visitors can traverse the syntax tree easily and in an extensible way.
`void` | `accept(ExprVisitor v)` The `accept()` method implements one half of the visitor pattern so that client visitors can traverse the syntax tree easily and in an extensible way.
`int` | `getPrecedence()` The `getPrecedence()` method gets the binding precedence for this expression.
`boolean` | `isMap()` The `isMap()` method tests whether this expression is a reference to an element of a map.
`java.lang.String` | `toString()` The `toString()` method recursively converts this expression to a string.

Methods inherited from class avrora.core.isdl.ast.Expr
`getBitWidth, innerString, isBitRangeExpr, isConstantExpr, isLiteral, isVariable, tokenToBool, tokenToInt`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### mapname

    public final Token mapname

  The `mapname` field stores a reference to the name of the map whose element is being accessed.

### index

    public final Expr index

  The `index` field stores a references to the expression which is evaluated to yield the index into the map.

Constructor Detail

### MapExpr

    public MapExpr(Token s,
                   Expr i)

  The constructor of the `MapExpr` class initializes the publicly accessable fields that represent the members of this expression

Parameters:
  `s` - the string name of the map as a token
  `i` - an expression representing the index into the map

Method Detail

### accept

    public void accept(ExprVisitor v)

  The `accept()` method implements one half of the visitor pattern so that client visitors can traverse the syntax tree easily and in an extensible way.

  Specified by:
    `accept` in class `Expr`
  Parameters:
    `v` - the visitor to accept

### accept

    public void accept(CodeVisitor v)

  The `accept()` method implements one half of the visitor pattern so that client visitors can traverse the syntax tree easily and in an extensible way.

  Specified by:
    `accept` in class `Expr`
  Parameters:
    `v` - the visitor to accept

### accept

    public Expr accept(CodeRebuilder r)

  The `accept()` method implements one half of the visitor pattern for rebuilding of expressions. This visitor allows code to be slightly modified while only writing visit methods for the parts of the syntax tree affected.

  Specified by:
    `accept` in class `Expr`
  Parameters:
    `r` - the rebuilder to accept
  Returns:
    the result of calling the appropriate `visit()` method of the rebuilder

### toString

    public java.lang.String toString()

  The `toString()` method recursively converts this expression to a string. For binary operations, inner expressions will be nested within parentheses if their precedence is lower than the precedence of the parent expression.

  Returns:
    a string representation of this expression

### getPrecedence

    public int getPrecedence()

  The `getPrecedence()` method gets the binding precedence for this expression. This is used to compute when inner expressions must be nested within parentheses in order to preserve the implied order of evaluation.

  Specified by:
    `getPrecedence` in class `Expr`
  Returns:
    an integer representing the precedence of this expression; higher numbers are higher precedence

### isMap

    public boolean isMap()

  The `isMap()` method tests whether this expression is a reference to an element of a map. This is used in pattern matching in some parts of the tools that work on abstract syntax trees. For instances of `MapExpr`, this method returns always true.

  Overrides:
    `isMap` in class `Expr`
  Returns:
    true

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD