Class TypeIsExpression

All Implemented Interfaces:
ITypeIsExpression, IExpression, IHasType, IParsedElement

public final class TypeIsExpression extends Expression implements ITypeIsExpression
Represents a typeis expression in the Gosu grammar:
 typeis-expression
   <conditional-or-expression> typeis <type-literal>
 

See Also:
  • Field Details

  • Constructor Details

    • TypeIsExpression

      public TypeIsExpression()
      Base constructor sets type to BooleanType.
  • Method Details

    • getLHS

      public Expression getLHS()
      Specified by:
      getLHS in interface ITypeIsExpression
      Returns:
      The expression for the left-hand-side operand.
    • setLHS

      public void setLHS(Expression e)
      Parameters:
      e - The expression for the left-hand-side operand.
    • getRHS

      public TypeLiteral getRHS()
      Specified by:
      getRHS in interface ITypeIsExpression
      Returns:
      The expression for the right-hand-side operand.
    • setRHS

      public void setRHS(TypeLiteral e)
      Parameters:
      e - The expression for the right-hand-side operand.
    • evaluate

      public Object evaluate()
      Perform a type (or instanceof) comparison.
      Specified by:
      evaluate in interface IExpression
      Overrides:
      evaluate in class Expression
    • toString

      public String toString()
      Description copied from class: Expression
      Subclasses should return a String representing the parsed expression.
      Specified by:
      toString in class Expression