public class AlignmentInColumnsConfig
extends java.lang.Object
'align in columns'
processing.
Thread-safe.
Note: this class doesn't provide custom realization for Object.hashCode()
and Object.equals(Object)
at the moment.
Feel free to add them as necessary.AlignmentInColumnsHelper
Constructor and Description |
---|
AlignmentInColumnsConfig(TokenSet stopMultilineCheckElementTypes,
TokenSet whiteSpaceTokenTypes,
TokenSet commentTokenTypes,
TokenSet distinguishableTypes,
TokenSet targetDeclarationTypes)
Creates new
AlignmentInColumnsConfig object that is used to tweak 'align in columns' processing. |
Modifier and Type | Method and Description |
---|---|
TokenSet |
getCommentTokenTypes() |
TokenSet |
getDistinguishableTypes() |
TokenSet |
getStopMultilineCheckElementTypes() |
TokenSet |
getTargetDeclarationTypes() |
TokenSet |
getWhiteSpaceTokenTypes() |
public AlignmentInColumnsConfig(TokenSet stopMultilineCheckElementTypes, TokenSet whiteSpaceTokenTypes, TokenSet commentTokenTypes, TokenSet distinguishableTypes, TokenSet targetDeclarationTypes)
AlignmentInColumnsConfig
object that is used to tweak 'align in columns'
processing.
'Alignment in columns' means formatting code as shown below:
double start = 1; int end = 2; private int tmp = 3; private int tmp2; protected double tmp3;
stopMultilineCheckElementTypes
- 'align in column'
algorithm performs number of checks in order to decide
if two variable declarations should be aligned in columns. One of that checks is
examination for sub-elements consistency. E.g. 'int end = 2'
statement
from example above is not aligned to 'private int tmp = 3;'
because the
former doesn't have modifier. Element types given here defines boundary for such
a checks, e.g. we can define type of '='
element to be stop check type
for example abovewhiteSpaceTokenTypes
- defines types of the tokens that should be treated as a white spacecommentTokenTypes
- defines types of the tokens that should be treated as commentsdistinguishableTypes
- 'align in column'
algorithm doesn't align elements, containing different sets
of distinguishable elements.
E.g. 'private int tmp = 3'
is not aligned to 'private int tmp2'
at example above, providing that distinguishable types contain '='
token.targetDeclarationTypes
- defines variable declaration sub-element types to be aligned. Example above
shows alignment for 'modifier list'
, 'type reference'
,
'identifier'
and '='
types. The general idea of this property
is to let avoid alignment of unnecessary types, e.g. variable definition expressionspublic TokenSet getStopMultilineCheckElementTypes()
public TokenSet getWhiteSpaceTokenTypes()
public TokenSet getCommentTokenTypes()
public TokenSet getDistinguishableTypes()
public TokenSet getTargetDeclarationTypes()