public class MCodeWriter extends Object implements CodeWriter
CodeWriter implementation.| Constructor and Description |
|---|
MCodeWriter(PrintWriter out) |
| Modifier and Type | Method and Description |
|---|---|
CodeWriter |
dedentLine()
Decrements the tab and makes sure, a new line is started.
|
CodeWriter |
ensureNewLine()
Starts a new line, if characters are present on the current line.
|
int |
getColumnNumber()
Returns the current number of characters in the current line.
|
CompilationUnit |
getCompilationUnit()
gets the context compilation unit.
|
int |
getIndentNumber()
Returns the current number of indentation levels.
|
int |
getLineNumber()
Returns the number of lines of the current document.
|
CodeWriter |
indentLine()
Increments the tab and ensures an empty line.
|
boolean |
isLineNew()
Returns true if no characters have been written since the last call of
newLine().
|
CodeWriter |
newLine()
Adds a the newLine string according to
System.getProperty("line.separator") and the line is padded
with the n tab characters where n is the number returned by
getIndentNumber(). |
MCodeWriter |
queue(Comment comment)
This method allows those codeable objects to inject a comment without
interrupting the line-by-line code itself.
|
CodeWriter |
resetLine()
Resets the tab counter to zero and calls the newLine() method.
|
void |
setCompilationUnit(CompilationUnit compilationUnit)
sets the context compilation unit.
|
CodeWriter |
space()
Writes a single space.
|
CodeWriter |
write(boolean b)
Writes a boolean.
|
CodeWriter |
write(char c)
Writes a single character.
|
CodeWriter |
write(char[] chars)
Writes an array of characters.
|
CodeWriter |
write(char[] chars,
int off,
int len)
Writes an array of characters.
|
CodeWriter |
write(Codeable ico)
Instead of calling the
Object.toString() method, the
Object.toCode(public CodeWriter) method is invoked with
this as the argument. |
CodeWriter |
write(Codeable[] aico)
Iterates the array and sends each element to
write(Codeable) . |
CodeWriter |
write(double d)
Writes a double.
|
CodeWriter |
write(float f)
Writes a float.
|
CodeWriter |
write(int i)
Writes an integer.
|
CodeWriter |
write(List<? extends Codeable> codeables)
Iterates the array and sends each element to
write(Codeable) . |
CodeWriter |
write(Object o)
Writes an object.
|
CodeWriter |
write(String s)
Writes a string.
|
public MCodeWriter(PrintWriter out)
public CodeWriter dedentLine()
dedentLine in interface CodeWriterpublic int getColumnNumber()
getColumnNumber in interface CodeWriterpublic CompilationUnit getCompilationUnit()
CodeWritergetCompilationUnit in interface CodeWriterpublic int getIndentNumber()
getIndentNumber in interface CodeWriterpublic int getLineNumber()
getLineNumber in interface CodeWriterpublic CodeWriter indentLine()
indentLine in interface CodeWriterpublic boolean isLineNew()
isLineNew in interface CodeWriterpublic CodeWriter ensureNewLine()
CodeWriterensureNewLine in interface CodeWriterpublic CodeWriter newLine()
System.getProperty("line.separator") and the line is padded
with the n tab characters where n is the number returned by
getIndentNumber().newLine in interface CodeWriterpublic MCodeWriter queue(Comment comment)
queue in interface CodeWriterpublic CodeWriter resetLine()
resetLine in interface CodeWriterpublic void setCompilationUnit(CompilationUnit compilationUnit)
CodeWritersetCompilationUnit in interface CodeWriterpublic CodeWriter space()
space in interface CodeWriterpublic CodeWriter write(boolean b)
write in interface CodeWriterpublic CodeWriter write(char c)
write in interface CodeWriterpublic CodeWriter write(char[] chars)
write in interface CodeWriterpublic CodeWriter write(char[] chars, int off, int len)
write in interface CodeWriterpublic CodeWriter write(Codeable ico)
Object.toString() method, the
Object.toCode(public CodeWriter) method is invoked with
this as the argument.write in interface CodeWriterpublic CodeWriter write(Codeable[] aico)
write(Codeable) .write in interface CodeWriterpublic CodeWriter write(double d)
write in interface CodeWriterpublic CodeWriter write(float f)
write in interface CodeWriterpublic CodeWriter write(int i)
write in interface CodeWriterpublic CodeWriter write(List<? extends Codeable> codeables)
CodeWriterwrite(Codeable) .write in interface CodeWriterpublic CodeWriter write(Object o)
write in interface CodeWriterpublic CodeWriter write(String s)
write in interface CodeWriterCopyright © 2000–2018 jenesis4java. All rights reserved.