Serializable
, Comparable<TabBehaviour>
public enum TabBehaviour extends Enum<TabBehaviour>
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.Enum Constant | Description |
---|---|
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.
|
CONVERT_TO_EIGHT_SPACES |
Tab characters are replaced with eight 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_ONE_SPACE |
Tab characters are replaced with a single blank space, 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_TWO_SPACES |
Tab characters are replaced with two blank spaces, no matter where the tab was placed.
|
IGNORE |
Tab characters are not replaced, this will probably have undefined and weird behaviour!
|
Modifier and Type | Method | Description |
---|---|---|
String |
getTabReplacement(int columnIndex) |
Returns the String that can replace a tab at the specified position, according to this TabBehaviour.
|
String |
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 |
valueOf(String name) |
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.
|
public static final TabBehaviour IGNORE
public static final TabBehaviour CONVERT_TO_ONE_SPACE
public static final TabBehaviour CONVERT_TO_TWO_SPACES
public static final TabBehaviour CONVERT_TO_THREE_SPACES
public static final TabBehaviour CONVERT_TO_FOUR_SPACES
public static final TabBehaviour CONVERT_TO_EIGHT_SPACES
public static final TabBehaviour ALIGN_TO_COLUMN_4
public static final TabBehaviour ALIGN_TO_COLUMN_8
public static TabBehaviour[] values()
for (TabBehaviour c : TabBehaviour.values()) System.out.println(c);
public static TabBehaviour valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String replaceTabs(String string, int columnIndex)
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 uppublic String getTabReplacement(int columnIndex)
columnIndex
- Column index of where the tab character is placedCopyright © 2020. All rights reserved.