Class IndentLevel


  • public class IndentLevel
    extends java.lang.Object
    Encapsulates representation of notion of expected indentation levels. Provide a way to have multiple acceptable levels.
    • Constructor Summary

      Constructors 
      Constructor Description
      IndentLevel​(int indent)
      Creates new instance with one acceptable indentation level.
      IndentLevel​(IndentLevel base, int... offsets)
      Creates new instance for nested structure.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAcceptedIndent​(int indent)
      Adds one more acceptable indentation level.
      void addAcceptedIndent​(IndentLevel indent)
      Adds one more acceptable indentation level.
      int getFirstIndentLevel()
      Returns first indentation level.
      int getLastIndentLevel()
      Returns last indentation level.
      boolean isAcceptable​(int indent)
      Checks if given indentation is acceptable.
      boolean isGreaterThan​(int indent)
      Returns true if indent less then minimal of acceptable indentation levels, false otherwise.
      boolean isMultiLevel()
      Checks whether we have more than one level.
      java.lang.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 indent)
        Creates new instance with one acceptable indentation level.
        Parameters:
        indent - acceptable indentation level.
      • IndentLevel

        public IndentLevel​(IndentLevel base,
                           int... offsets)
        Creates new instance for nested structure.
        Parameters:
        base - parent's level
        offsets - offsets from parent's level.
    • Method Detail

      • isMultiLevel

        public final boolean isMultiLevel()
        Checks whether we have more than one level.
        Returns:
        whether we have more than one level.
      • isAcceptable

        public boolean isAcceptable​(int indent)
        Checks if given indentation is acceptable.
        Parameters:
        indent - indentation to check.
        Returns:
        true if given indentation is acceptable, false otherwise.
      • isGreaterThan

        public boolean isGreaterThan​(int indent)
        Returns true if indent less then minimal of acceptable indentation levels, false otherwise.
        Parameters:
        indent - indentation to check.
        Returns:
        true if indent less then minimal of acceptable indentation levels, false otherwise.
      • addAcceptedIndent

        public void addAcceptedIndent​(int indent)
        Adds one more acceptable indentation level.
        Parameters:
        indent - new acceptable indentation.
      • addAcceptedIndent

        public void addAcceptedIndent​(IndentLevel indent)
        Adds one more acceptable indentation level.
        Parameters:
        indent - new acceptable indentation.
      • getFirstIndentLevel

        public int getFirstIndentLevel()
        Returns first indentation level.
        Returns:
        indentation level.
      • getLastIndentLevel

        public int getLastIndentLevel()
        Returns last indentation level.
        Returns:
        indentation level.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object