Class Expression

java.lang.Object
liquidjava.rj_language.ast.Expression
Direct Known Subclasses:
AliasInvocation, BinaryExpression, FunctionInvocation, GroupExpression, Ite, LiteralBoolean, LiteralInt, LiteralReal, LiteralString, UnaryExpression, Var

public abstract class Expression extends Object
  • Constructor Details

    • Expression

      public Expression()
  • Method Details

    • accept

      public abstract <T> T accept(ExpressionVisitor<T> visitor) throws LJError
      Throws:
      LJError
    • getVariableNames

      public abstract void getVariableNames(List<String> toAdd)
    • getStateInvocations

      public abstract void getStateInvocations(List<String> toAdd, List<String> all)
    • isBooleanTrue

      public abstract boolean isBooleanTrue()
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      public abstract Expression clone()
      Overrides:
      clone in class Object
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • toSimplifiedString

      public String toSimplifiedString()
      Returns a simplified string representation of this expression with unqualified names (e.g., com.example.State.open => open Default implementation delegates to toString() Subclasses that contain qualified names should override this method
      Returns:
      simplified string representation
    • addChild

      public void addChild(Expression e)
    • getChildren

      public List<Expression> getChildren()
    • hasChildren

      public boolean hasChildren()
    • setChild

      public void setChild(int index, Expression element)
    • isLiteral

      public boolean isLiteral()
    • isBooleanExpression

      public boolean isBooleanExpression()
      Checks if this expression produces a boolean type based on its structure
      Returns:
      true if it is a boolean expression, false otherwise
    • substitute

      public Expression substitute(Expression from, Expression to)
      Substitutes the expression first given expression by the second
      Parameters:
      from -
      to -
      Returns:
    • substituteFunction

      public void substituteFunction(String functionName, List<Expression> parameters, Expression sub)
      Substitutes the function call with the given parameter to the expression e
      Parameters:
      functionName -
      parameters -
      sub -
    • substituteState

      public Expression substituteState(Map<String, Expression> subMap, String[] toChange)
    • changeAlias

      public Expression changeAlias(Map<String,AliasDTO> alias, Context ctx, spoon.reflect.factory.Factory f) throws LJError
      Throws:
      LJError
    • validateGhostInvocations

      public void validateGhostInvocations(Context ctx, spoon.reflect.factory.Factory f) throws LJError
      Validates all ghost function invocations within this expression against the provided context This method supports overloading by iterating through all ghost functions with the matching name If a valid signature is found, no error is thrown If the invocation name exists but no overload matches the argument types, an ArgumentMismatchError is thrown.
      Parameters:
      ctx -
      f -
      Throws:
      LJError