- All Implemented Interfaces:
Serializable
,Comparable<TabBehaviour>
,java.lang.constant.Constable
What to do about the tab character when putting on a
Screen
. Since tabs are a bit special, their meaning
depends on which column the cursor is in when it's printed, we'll need to have some way to tell the Screen what to
do when encountering a tab character.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionTab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 4, simulating a normal tab character when placed inside a text document.Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 8, simulating a normal tab character when placed inside a text document.Tab characters are replaced with eight blank spaces, no matter where the tab was placed.Tab characters are replaced with four blank spaces, no matter where the tab was placed.Tab characters are replaced with a single blank space, no matter where the tab was placed.Tab characters are replaced with three blank spaces, no matter where the tab was placed.Tab characters are replaced with two blank spaces, no matter where the tab was placed.Tab characters are not replaced, this will probably have undefined and weird behaviour! -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTabReplacement
(int columnIndex) Returns the String that can replace a tab at the specified position, according to this TabBehaviour.replaceTabs
(String string, int columnIndex) Given a string, being placed on the screen at column X, returns the same string with all tab characters (\t) replaced according to this TabBehaviour.static TabBehaviour
Returns the enum constant of this type with the specified name.static TabBehaviour[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
IGNORE
Tab characters are not replaced, this will probably have undefined and weird behaviour! -
CONVERT_TO_ONE_SPACE
Tab characters are replaced with a single blank space, no matter where the tab was placed. -
CONVERT_TO_TWO_SPACES
Tab characters are replaced with two blank spaces, no matter where the tab was placed. -
CONVERT_TO_THREE_SPACES
Tab characters are replaced with three blank spaces, no matter where the tab was placed. -
CONVERT_TO_FOUR_SPACES
Tab characters are replaced with four blank spaces, no matter where the tab was placed. -
CONVERT_TO_EIGHT_SPACES
Tab characters are replaced with eight blank spaces, no matter where the tab was placed. -
ALIGN_TO_COLUMN_4
Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 4, simulating a normal tab character when placed inside a text document. -
ALIGN_TO_COLUMN_8
Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 8, simulating a normal tab character when placed inside a text document.
-
-
Field Details
-
replaceFactor
-
alignFactor
-
-
Constructor Details
-
TabBehaviour
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
replaceTabs
Given a string, being placed on the screen at column X, returns the same string with all tab characters (\t) replaced according to this TabBehaviour.- Parameters:
string
- String that is going to be put to the screen, potentially containing tab characterscolumnIndex
- Column on the screen where the first character of the string is going to end up- Returns:
- The input string with all tab characters replaced with spaces, according to this TabBehaviour
-
getTabReplacement
Returns the String that can replace a tab at the specified position, according to this TabBehaviour.- Parameters:
columnIndex
- Column index of where the tab character is placed- Returns:
- String consisting of 1 or more space character
-