Class BaseBlockIf

All Implemented Interfaces:
io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockIf, io.github.mmm.code.api.block.CodeBlockStatement, io.github.mmm.code.api.block.CodeBlockWithCondition, io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockIf>, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeItemWithVariables, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.object.CodeMutable, io.github.mmm.code.api.statement.CodeStatement

public class BaseBlockIf extends BaseBlockStatementWithCondition implements io.github.mmm.code.api.block.CodeBlockIf
Base implementation of CodeBlockDoWhile.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseBlockIf

      public BaseBlockIf(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, io.github.mmm.code.api.statement.CodeStatement... statements)
      The constructor.
      Parameters:
      parent - the parent.
      condition - the condition.
      statements - the statements.
    • BaseBlockIf

      public BaseBlockIf(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, List<io.github.mmm.code.api.statement.CodeStatement> statements)
      The constructor.
      Parameters:
      parent - the parent.
      condition - the condition.
      statements - the statements.
    • BaseBlockIf

      public BaseBlockIf(BaseBlockIf template, io.github.mmm.code.api.copy.CodeCopyMapper mapper)
      The copy-constructor.
      Parameters:
      template - the BaseBlockStatementWithCondition to copy.
      mapper - the CodeCopyMapper.
  • Method Details

    • getElse

      public io.github.mmm.code.api.block.CodeBlockIf getElse()
      Specified by:
      getElse in interface io.github.mmm.code.api.block.CodeBlockIf
    • copy

      public BaseBlockIf copy()
      Specified by:
      copy in interface io.github.mmm.code.api.block.CodeBlock
      Specified by:
      copy in interface io.github.mmm.code.api.block.CodeBlockIf
      Specified by:
      copy in interface io.github.mmm.code.api.block.CodeBlockStatement
      Specified by:
      copy in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      copy in interface io.github.mmm.code.api.node.CodeNodeItem
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockIf>
    • copy

      public BaseBlockIf copy(io.github.mmm.code.api.copy.CodeCopyMapper mapper)
      Specified by:
      copy in interface io.github.mmm.code.api.item.CodeMutableItem
      Specified by:
      copy in interface io.github.mmm.code.api.node.CodeNodeItem
      Specified by:
      copy in interface io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockIf>
    • writePrefix

      protected void writePrefix(Appendable sink, String newline, String defaultIndent, String currentIndent) throws IOException
      Description copied from class: BaseBlock
      Writes a prefix e.g. for loops.
      Overrides:
      writePrefix in class BaseBlock
      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 indent will be appended.
      Throws:
      IOException - if thrown by Appendable.
    • writeSuffix

      protected void writeSuffix(Appendable sink, String newline, String defaultIndent, String currentIndent) throws IOException
      Description copied from class: BaseBlock
      Writes a suffix e.g. for do-while loops.
      Overrides:
      writeSuffix in class BaseBlock
      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 indent will be appended.
      Throws:
      IOException - if thrown by Appendable.