com.puppycrawl.tools.checkstyle.checks.indentation

Class IndentLevel


public class IndentLevel
extends java.lang.Object

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

Author:
o_sukhodolsky

Constructor Summary

IndentLevel(IndentLevel aBase, int aOffset)
Creates new instance for nested structure.
IndentLevel(int aIndent)
Creates new instance with one accaptable indentation level.

Method Summary

boolean
accept(int aIndent)
Checks if given indentation is accaptable.
void
addAcceptedIndent(IndentLevel aIndent)
Adds one more acceptable indentation level.
void
addAcceptedIndent(int aIndent)
Adds one more acceptable indentation level.
boolean
gt(int aIndent)
String
toString()

Constructor Details

IndentLevel

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

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


IndentLevel

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

Parameters:
aIndent - accaptable indentation level.

Method Details

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(IndentLevel aIndent)
Adds one more acceptable indentation level.

Parameters:
aIndent - new acceptable indentation.


addAcceptedIndent

public void addAcceptedIndent(int 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.


toString

public String toString()

Returns:
string representation of the object.