public class ASBeautifier extends AbstractASBase
| Modifier and Type | Field and Description |
|---|---|
protected int |
inLineNumber |
protected boolean |
isNonInStatementArray |
protected boolean |
isSharpAccessor |
protected boolean |
lineCommentNoBeautify |
fileType| Constructor and Description |
|---|
ASBeautifier()
ASBeautifier's constructor
Por default fileType = FileType.JAVA_TYPE |
ASBeautifier(ASBeautifier other)
ASBeautifier's copy constructor must explicitly call the base class copy
constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.StringBuilder |
beautify(java.lang.StringBuilder originalLine)
beautify a line of source code.
|
protected java.lang.String |
findHeader(java.lang.StringBuilder line,
int i,
java.util.List<java.lang.String> possibleHeaders) |
protected java.lang.String |
findOperator(java.lang.String line,
int i,
java.util.List<java.lang.String> possibleOperators) |
SourceMode |
getFileType()
get the file type.
|
int |
getIndentLength()
get the number of spaces per indent
|
java.lang.String |
getIndentString()
get the char used for indentation, space or tab
|
boolean |
hasMoreLines()
check if there are any indented lines ready to be read by nextLine()
|
void |
init(ASSourceIterator iter)
initialize the ASBeautifier.
|
boolean |
isBlockIndent()
get the state of the block indentation option.
|
boolean |
isBracketIndent()
get the state of the bracket indentation option.
|
boolean |
isCaseIndent()
get the state of the case indentation option.
|
boolean |
isEmptyLineFill()
get the state of the empty line fill option.
|
boolean |
isUseProperInnerClassIndenting()
Check if we should use proper inner class indenting
|
java.lang.StringBuilder |
nextLine()
get the next indented line.
|
char |
peekNextChar(java.lang.StringBuilder line,
int i)
peek at the next unread character.
|
void |
setBlockIndent(boolean state)
set the state of the block indentation option.
|
void |
setBracketIndent(boolean state)
set the state of the bracket indentation option.
|
void |
setCaseIndent(boolean state)
set the state of the case indentation option.
|
void |
setClassIndent(boolean state)
set the state of the class indentation option.
|
void |
setEmptyLineFill(boolean state)
set the state of the empty line fill option.
|
void |
setLabelIndent(boolean state)
set the state of the label indentation option.
|
void |
setMaxInStatementIndentLength(int max)
set the maximum indentation between two lines in a multi-line statement.
|
void |
setMinConditionalIndentLength(int min)
set the minimum indentation between two lines in a multi-line condition.
|
void |
setNamespaceIndent(boolean state)
set the state of the namespace indentation option.
|
void |
setPreprocessorIndent(boolean state)
set the state of the preprocessor indentation option.
|
void |
setSourceStyle(SourceMode mode)
set indentation style to C/C++.
|
void |
setSpaceIndentation(int length)
indent using a number of spaces per indentation.
|
void |
setSwitchIndent(boolean state)
set the state of the switch indentation option.
|
void |
setTabIndentation(int length)
indent using one tab per indentation
|
void |
setTabIndentation(int length,
boolean forceTabs)
indent using one tab per indentation
|
void |
setUseProperInnerClassIndenting(boolean useProperInnerClassIndenting)
Set if we should use proper inner class indenting
|
findKeyword, getCurrentWord, init, isCharPotentialHeader, isCharPotentialOperator, isCStyle, isJavaStyle, isLegalNameChar, isSharpStyleprotected int inLineNumber
protected boolean lineCommentNoBeautify
protected boolean isNonInStatementArray
protected boolean isSharpAccessor
public ASBeautifier()
public ASBeautifier(ASBeautifier other)
other - public void init(ASSourceIterator iter)
iter - a pointer to the DYNAMICALLY CREATED ASSourceIterator object.public void setSourceStyle(SourceMode mode)
public void setTabIndentation(int length)
length - forceTabs - public void setTabIndentation(int length,
boolean forceTabs)
length - forceTabs - public void setSpaceIndentation(int length)
length - number of spaces per indent.public void setMaxInStatementIndentLength(int max)
max - maximum indentation length.public void setMinConditionalIndentLength(int min)
min - minimal indentation length.public void setBracketIndent(boolean state)
state - state of option.public void setBlockIndent(boolean state)
state - state of option.public void setClassIndent(boolean state)
state - state of option.public void setSwitchIndent(boolean state)
state - state of option.public void setCaseIndent(boolean state)
state - state of option.public void setNamespaceIndent(boolean state)
state - state of option.public void setLabelIndent(boolean state)
state - state of option.public void setPreprocessorIndent(boolean state)
state - state of option.public void setEmptyLineFill(boolean state)
state - state of option.public SourceMode getFileType()
public int getIndentLength()
public java.lang.String getIndentString()
public boolean isBlockIndent()
public boolean isBracketIndent()
public boolean isCaseIndent()
public boolean isEmptyLineFill()
public boolean hasMoreLines()
public java.lang.StringBuilder nextLine()
public boolean isUseProperInnerClassIndenting()
public void setUseProperInnerClassIndenting(boolean useProperInnerClassIndenting)
useProperInnerClassIndenting - if we should use proper inner class indentingprotected java.lang.StringBuilder beautify(java.lang.StringBuilder originalLine)
originalLine - the original unindented line.protected java.lang.String findHeader(java.lang.StringBuilder line,
int i,
java.util.List<java.lang.String> possibleHeaders)
protected java.lang.String findOperator(java.lang.String line,
int i,
java.util.List<java.lang.String> possibleOperators)
public char peekNextChar(java.lang.StringBuilder line,
int i)
peekNextChar in class AbstractASBaseline - the line to check.i - the current char position on the line.