Class BaseBlockDoWhile
- All Implemented Interfaces:
io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockDoWhile, 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.CodeBlockDoWhile>, 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 BaseBlockDoWhile
extends BaseBlockStatementWithCondition
implements io.github.mmm.code.api.block.CodeBlockDoWhile
Base implementation of
CodeBlockDoWhile.- 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
ConstructorsConstructorDescriptionBaseBlockDoWhile(BaseBlockDoWhile template, io.github.mmm.code.api.copy.CodeCopyMapper mapper) The copy-constructor.BaseBlockDoWhile(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, io.github.mmm.code.api.statement.CodeStatement... statements) The constructor.BaseBlockDoWhile(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, List<io.github.mmm.code.api.statement.CodeStatement> statements) The constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()copy(io.github.mmm.code.api.copy.CodeCopyMapper mapper) protected voidwritePrefix(Appendable sink, String newline, String defaultIndent, String currentIndent) Writes a prefix e.g. for loops.protected voidwriteSuffix(Appendable sink, String newline, String defaultIndent, String currentIndent) Writes a suffix e.g. for do-while loops.Methods inherited from class BaseBlockStatementWithCondition
getConditionMethods inherited from class BaseBlockStatement
getParent, getVariableFromParent, setParentMethods inherited from class BaseBlock
add, addText, doSetImmutable, doWrite, getStatements, getVariable, getVariableMethods inherited from class BaseNodeItem
doInitialize, getContainerItem, getContainerItemDeclared, getContext, getLanguage, getSource, toPathStringMethods inherited from class BaseMutableItem
doCopyNode, doCopyNodeUnsafe, doMapList, doneInitialize, getDefaultCopyMapper, getDefaultEncoding, getReflectiveObject, getSourceCodeObject, initialize, initialize, isImmutable, isInitialized, isInitializing, isSystemImmutable, isSystemImmutable, makeImmutable, makeImmutable, setImmutable, setImmutableIfNotSystemImmutable, verifyMutalbe, writeItemMethods inherited from class BaseItem
getOwningType, getSourceCode, getSpaces, toString, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.code.api.block.CodeBlock
add, addText, getStatements, getVariable, getVariable, isEmptyMethods inherited from interface io.github.mmm.code.api.block.CodeBlockStatement
getParentMethods inherited from interface io.github.mmm.code.api.block.CodeBlockWithCondition
getConditionMethods inherited from interface io.github.mmm.code.api.item.CodeItem
getLanguage, getSourceCode, write, write, write, write, write, writeMethods inherited from interface io.github.mmm.code.api.object.CodeMutable
isImmutable, isMutableMethods inherited from interface io.github.mmm.code.api.item.CodeMutableItem
getReflectiveObject, setImmutableMethods inherited from interface io.github.mmm.code.api.copy.CodeNodeItemCopyable
getParentMethods inherited from interface io.github.mmm.code.api.CodeWithContext
getContext, getSource
-
Constructor Details
-
BaseBlockDoWhile
public BaseBlockDoWhile(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, io.github.mmm.code.api.statement.CodeStatement... statements) The constructor.- Parameters:
parent- theparent.condition- thecondition.statements- thestatements.
-
BaseBlockDoWhile
public BaseBlockDoWhile(BaseBlock parent, io.github.mmm.code.api.expression.CodeCondition condition, List<io.github.mmm.code.api.statement.CodeStatement> statements) The constructor.- Parameters:
parent- theparent.condition- thecondition.statements- thestatements.
-
BaseBlockDoWhile
public BaseBlockDoWhile(BaseBlockDoWhile template, io.github.mmm.code.api.copy.CodeCopyMapper mapper) The copy-constructor.- Parameters:
template- theBaseBlockStatementWithConditionto copy.mapper- theCodeCopyMapper.
-
-
Method Details
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.block.CodeBlock- Specified by:
copyin interfaceio.github.mmm.code.api.block.CodeBlockDoWhile- Specified by:
copyin interfaceio.github.mmm.code.api.block.CodeBlockStatement- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin interfaceio.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockDoWhile>
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin interfaceio.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.block.CodeBlock, io.github.mmm.code.api.block.CodeBlockDoWhile>
-
writePrefix
protected void writePrefix(Appendable sink, String newline, String defaultIndent, String currentIndent) throws IOException Description copied from class:BaseBlockWrites a prefix e.g. for loops.- Overrides:
writePrefixin classBaseBlock- Parameters:
sink- theAppendablewhere toappendthe code from thisCodeItem.newline- the newlineString.defaultIndent- theStringused 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 theindentwill be appended.- Throws:
IOException- if thrown byAppendable.
-
writeSuffix
protected void writeSuffix(Appendable sink, String newline, String defaultIndent, String currentIndent) throws IOException Description copied from class:BaseBlockWrites a suffix e.g. for do-while loops.- Overrides:
writeSuffixin classBaseBlock- Parameters:
sink- theAppendablewhere toappendthe code from thisCodeItem.newline- the newlineString.defaultIndent- theStringused 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 theindentwill be appended.- Throws:
IOException- if thrown byAppendable.
-