Class BaseBlockFor

All Implemented Interfaces:
io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockFor, io.github.mmm.code.api.block.CodeBlockStatement, 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.CodeBlockFor>, 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 BaseBlockFor extends BaseBlockStatement implements io.github.mmm.code.api.block.CodeBlockFor
Base implementation of CodeBlockFor.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Constructor Details

    • BaseBlockFor

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

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

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

    • getExpression

      public io.github.mmm.code.api.expression.CodeForExpression getExpression()
      Specified by:
      getExpression in interface io.github.mmm.code.api.block.CodeBlockFor
    • copy

      public BaseBlockFor copy()
      Specified by:
      copy in interface io.github.mmm.code.api.block.CodeBlock
      Specified by:
      copy in interface io.github.mmm.code.api.block.CodeBlockFor
      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.CodeBlockFor>
    • copy

      public BaseBlockFor 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.CodeBlockFor>
    • 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.