Lines 68-83
Link Here
|
68 |
* @return the number of indentation units that line is indented by |
68 |
* @return the number of indentation units that line is indented by |
69 |
* @exception IllegalArgumentException if: |
69 |
* @exception IllegalArgumentException if: |
70 |
* <ul> |
70 |
* <ul> |
71 |
* <li>the given <code>indentWidth</code> is lower or equals to zero</li> |
71 |
* <li>the given <code>indentWidth</code> is lower than zero</li> |
72 |
* <li>the given <code>tabWidth</code> is lower than zero</li> |
72 |
* <li>the given <code>tabWidth</code> is lower than zero</li> |
73 |
* <li>the given <code>line</code> is null</li> |
73 |
* <li>the given <code>line</code> is null</li> |
74 |
* </ul> |
74 |
* </ul> |
75 |
*/ |
75 |
*/ |
76 |
public static int measureIndentUnits(CharSequence line, int tabWidth, int indentWidth) { |
76 |
public static int measureIndentUnits(CharSequence line, int tabWidth, int indentWidth) { |
77 |
if (indentWidth <= 0 || tabWidth < 0 || line == null) { |
77 |
if (indentWidth < 0 || tabWidth < 0 || line == null) { |
78 |
throw new IllegalArgumentException(); |
78 |
throw new IllegalArgumentException(); |
79 |
} |
79 |
} |
80 |
|
80 |
|
|
|
81 |
if (indentWidth == 0) return 0; |
81 |
int visualLength= measureIndentInSpaces(line, tabWidth); |
82 |
int visualLength= measureIndentInSpaces(line, tabWidth); |
82 |
return visualLength / indentWidth; |
83 |
return visualLength / indentWidth; |
83 |
} |
84 |
} |