Class BaseTernaryExpression

All Implemented Interfaces:
io.github.mmm.code.api.expression.CodeExpression, io.github.mmm.code.api.expression.CodeTernaryExpression, io.github.mmm.code.api.item.CodeItem

public class BaseTernaryExpression extends BaseExpression implements io.github.mmm.code.api.expression.CodeTernaryExpression
Generic implementation of CodeTernaryExpression.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Field Summary

    Fields inherited from interface io.github.mmm.code.api.item.CodeItem

    DEFAULT_INDENT, DEFAULT_NEWLINE
  • Constructor Summary

    Constructors
    Constructor
    Description
    BaseTernaryExpression(io.github.mmm.code.api.expression.CodeCondition condition, io.github.mmm.code.api.expression.CodeExpression ifArg, io.github.mmm.code.api.expression.CodeExpression elseArg)
    The constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language)
     
    io.github.mmm.code.api.expression.CodeCondition
     
    io.github.mmm.code.api.expression.CodeExpression
     
    io.github.mmm.code.api.expression.CodeExpression
     

    Methods inherited from class BaseItem

    getOwningType, getSourceCode, getSpaces, toString, write

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.github.mmm.code.api.item.CodeItem

    getLanguage, getSourceCode, write, write, write, write, write, write

    Methods inherited from interface io.github.mmm.code.api.expression.CodeTernaryExpression

    evaluate
  • Constructor Details

    • BaseTernaryExpression

      public BaseTernaryExpression(io.github.mmm.code.api.expression.CodeCondition condition, io.github.mmm.code.api.expression.CodeExpression ifArg, io.github.mmm.code.api.expression.CodeExpression elseArg)
      The constructor.
      Parameters:
      condition - the condition.
      ifArg - the if-argument.
      elseArg - the else-argument.
  • Method Details

    • getCondition

      public io.github.mmm.code.api.expression.CodeCondition getCondition()
      Specified by:
      getCondition in interface io.github.mmm.code.api.expression.CodeTernaryExpression
    • getIfArg

      public io.github.mmm.code.api.expression.CodeExpression getIfArg()
      Specified by:
      getIfArg in interface io.github.mmm.code.api.expression.CodeTernaryExpression
    • getElseArg

      public io.github.mmm.code.api.expression.CodeExpression getElseArg()
      Specified by:
      getElseArg in interface io.github.mmm.code.api.expression.CodeTernaryExpression
    • doWrite

      protected void doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) throws IOException
      Specified by:
      doWrite in class BaseItem
      Parameters:
      sink - the Appendable where to append the code from this CodeItem.
      newline - the newline String.
      defaultIndent - the String used for indentation (e.g. a number of spaces to insert per indent level).
      currentIndent - the current indent (number of spaces). Initially the empty string (""). Before a recursion the defaultIndent will be appended.
      language - the CodeLanguage to use.
      Throws:
      IOException - if thrown by Appendable.
      See Also:
      • CodeItem.write(Appendable, String, String)