com.puppycrawl.tools.checkstyle.checks.indentation
Class IndentLevel

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.checks.indentation.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(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)
           
 boolean isMultiLevel()
          Checks wether we have more than one level.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

isMultiLevel

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

Returns:
wether we have more than one level.

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.

gt

public boolean gt(int aIndent)
Parameters:
aIndent - indentation to check.
Returns:
true if aIndent less then minimal of accaptable indentation levels, 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.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2011. All Rights Reserved.