Package org.aesh.terminal.formatting
Class TerminalCharacter
java.lang.Object
org.aesh.terminal.formatting.TerminalCharacter
Value object that describe how a terminal character should be displayed
- Author:
- Ståle W. Pedersen
-
Constructor Summary
ConstructorsConstructorDescriptionTerminalCharacter(char c) Create a terminal character with default style and colors.TerminalCharacter(char c, TerminalColor color) Create a terminal character with the specified color.TerminalCharacter(char c, TerminalColor color, CharacterType type) Create a terminal character with the specified color and character type.TerminalCharacter(char c, TerminalColor color, TerminalTextStyle style) Create a terminal character with the specified color and style.TerminalCharacter(char c, TerminalTextStyle style) Create a terminal character with the specified style. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanCheck if this terminal character has the same style and color as another, ignoring the actual character value.charGet the character.getStyle()Get the text style.inthashCode()voidsetCharacter(char c) Set the character.toString()toString(TerminalCharacter prev) Get the string representation relative to a previous character.
-
Constructor Details
-
TerminalCharacter
public TerminalCharacter(char c) Create a terminal character with default style and colors.- Parameters:
c- the character
-
TerminalCharacter
Create a terminal character with the specified style.- Parameters:
c- the characterstyle- the text style
-
TerminalCharacter
Create a terminal character with the specified color.- Parameters:
c- the charactercolor- the terminal color
-
TerminalCharacter
Create a terminal character with the specified color and character type.- Parameters:
c- the charactercolor- the terminal colortype- the character type
-
TerminalCharacter
Create a terminal character with the specified color and style.- Parameters:
c- the charactercolor- the terminal colorstyle- the text style
-
-
Method Details
-
getCharacter
public char getCharacter()Get the character.- Returns:
- the character
-
setCharacter
public void setCharacter(char c) Set the character.- Parameters:
c- the new character
-
getStyle
Get the text style.- Returns:
- the text style
-
toString
Get the string representation relative to a previous character. Only outputs ANSI codes for attributes that differ from the previous character.- Parameters:
prev- the previous terminal character- Returns:
- the ANSI formatted string
-
toString
-
equalsIgnoreCharacter
Check if this terminal character has the same style and color as another, ignoring the actual character value.- Parameters:
that- the terminal character to compare with- Returns:
- true if style and color are equal
-
equals
-
hashCode
public int hashCode()
-