Class TerminalCharacter

java.lang.Object
org.aesh.terminal.formatting.TerminalCharacter

public class TerminalCharacter extends Object
Value object that describe how a terminal character should be displayed
Author:
Ståle W. Pedersen
  • Constructor Details

    • TerminalCharacter

      public TerminalCharacter(char c)
      Create a terminal character with default style and colors.
      Parameters:
      c - the character
    • TerminalCharacter

      public TerminalCharacter(char c, TerminalTextStyle style)
      Create a terminal character with the specified style.
      Parameters:
      c - the character
      style - the text style
    • TerminalCharacter

      public TerminalCharacter(char c, TerminalColor color)
      Create a terminal character with the specified color.
      Parameters:
      c - the character
      color - the terminal color
    • TerminalCharacter

      public TerminalCharacter(char c, TerminalColor color, CharacterType type)
      Create a terminal character with the specified color and character type.
      Parameters:
      c - the character
      color - the terminal color
      type - the character type
    • TerminalCharacter

      public TerminalCharacter(char c, TerminalColor color, TerminalTextStyle style)
      Create a terminal character with the specified color and style.
      Parameters:
      c - the character
      color - the terminal color
      style - 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

      public TerminalTextStyle getStyle()
      Get the text style.
      Returns:
      the text style
    • toString

      public String toString(TerminalCharacter prev)
      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

      public String toString()
      Overrides:
      toString in class Object
    • equalsIgnoreCharacter

      public boolean equalsIgnoreCharacter(TerminalCharacter that)
      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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object