com.puppycrawl.tools.checkstyle.checks.indentation

Class IndentLevel

public class IndentLevel extends Object

Encapsulates representation of notion of expected indentation levels. Provide a way to have multiple accaptable levels.

Author: o_sukhodolsky

Constructor Summary
IndentLevel(int aIndent)
Creates new instance with one accaptable indentation level.
IndentLevel(IndentLevel aBase, int aOffset)
Creates new instance for nested structure.
Method Summary
booleanaccept(int aIndent)
Checks if given indentation is accaptable.
voidaddAcceptedIndent(int aIndent)
Adds one more acceptable indentation level.
voidaddAcceptedIndent(IndentLevel aIndent)
Adds one more acceptable indentation level.
booleangt(int aIndent)
booleanisMultiLevel()
Checks wether we have more than one level.
StringtoString()

Constructor Detail

IndentLevel

public IndentLevel(int aIndent)
Creates new instance with one accaptable indentation level.

Parameters: aIndent accaptable indentation level.

IndentLevel

public IndentLevel(IndentLevel aBase, int aOffset)
Creates new instance for nested structure.

Parameters: aBase parent's level aOffset offset from parent's level.

Method Detail

accept

public boolean accept(int aIndent)
Checks if given indentation is accaptable.

Parameters: aIndent indentation to check.

Returns: true if givent indentation is acceptable, false otherwise.

addAcceptedIndent

public void addAcceptedIndent(int aIndent)
Adds one more acceptable indentation level.

Parameters: aIndent new acceptable indentation.

addAcceptedIndent

public void addAcceptedIndent(IndentLevel aIndent)
Adds one more acceptable indentation level.

Parameters: aIndent new acceptable indentation.

gt

public boolean gt(int aIndent)

Parameters: aIndent indentation to check.

Returns: true if aIndent less then minimal of accaptable indentation levels, false otherwise.

isMultiLevel

public final boolean isMultiLevel()
Checks wether we have more than one level.

Returns: wether we have more than one level.

toString

public String toString()

Returns: string representation of the object.