Package jexer.bits

Class ComplexCell


  • public class ComplexCell
    extends Cell
    ComplexCell represents a multi-codepoint glyph, as commonly used in color emojis, accented characters, and more.
    • Constructor Detail

      • ComplexCell

        public ComplexCell()
        Public constructor sets default values of the cell to blank.
        See Also:
        Cell.isBlank(), reset()
      • ComplexCell

        public ComplexCell​(CellAttributes attr)
        Public constructor sets the attributes.
        Parameters:
        attr - attributes to use
      • ComplexCell

        public ComplexCell​(int codePoint,
                           CellAttributes attr)
        Public constructor sets a single codepoint and attributes.
        Parameters:
        codePoint - the codepoint to set to
        attr - attributes to use
      • ComplexCell

        public ComplexCell​(int codePoint)
        Public constructor sets a single codepoint. Attributes are the same as default.
        Parameters:
        codePoint - the codepoint to set to
        See Also:
        reset()
      • ComplexCell

        public ComplexCell​(int[] codePoints)
        Public constructor sets multiple codepoints. Attributes are the same as default.
        Parameters:
        codePoints - the codepoints to set to
        See Also:
        reset()
      • ComplexCell

        public ComplexCell​(int[] codePoints,
                           CellAttributes attr)
        Public constructor sets multiple codepoints and attributes. as default.
        Parameters:
        codePoints - the codepoints to set to
        attr - attributes to use
      • ComplexCell

        public ComplexCell​(Cell cell)
        Public constructor creates a duplicate.
        Parameters:
        cell - the instance to copy
    • Method Detail

      • getChar

        public int getChar()
        Getter for cell character.
        Overrides:
        getChar in class Cell
        Returns:
        cell character
      • setChar

        public void setChar​(int ch)
        Setter for cell character.
        Overrides:
        setChar in class Cell
        Parameters:
        ch - new cell character
      • setChar

        public void setChar​(Cell other)
        Set the cell character to another cell's character.
        Overrides:
        setChar in class Cell
        Parameters:
        other - the other cell
      • reset

        public void reset()
        Reset this cell to a blank.
        Overrides:
        reset in class Cell
      • unset

        public void unset()
        UNset this cell. It will not be equal to any other cell until it has been assigned attributes and a character.
        Overrides:
        unset in class Cell
      • equals

        public boolean equals​(java.lang.Object rhs)
        Comparison check. All fields must match to return true.
        Overrides:
        equals in class Cell
        Parameters:
        rhs - another Cell instance
        Returns:
        true if all fields are equal
      • hashCode

        public int hashCode()
        Hashcode uses all fields in equals().
        Overrides:
        hashCode in class Cell
        Returns:
        the hash
      • setTo

        public void setTo​(java.lang.Object rhs)
        Set my field values to rhs's field.
        Overrides:
        setTo in class Cell
        Parameters:
        rhs - an instance of either Cell or CellAttributes
      • toString

        public java.lang.String toString()
        Make human-readable description of this Cell.
        Overrides:
        toString in class Cell
        Returns:
        displayable String
      • toHtml

        public java.lang.String toHtml()
        Convert this cell into an HTML entity inside a <font> tag.
        Overrides:
        toHtml in class Cell
        Returns:
        the HTML string
      • getDisplayWidth

        public int getDisplayWidth()
        Get for number of display cells required to show this cell's text.
        Overrides:
        getDisplayWidth in class Cell
        Returns:
        1 or 2
      • isCodePoint

        public boolean isCodePoint​(int codePoint)
        Compare this complex cell's codepoint(s) to another single codepoint.
        Overrides:
        isCodePoint in class Cell
        Parameters:
        codePoint - codepoint to compare to
        Returns:
        true if this cell has one codepoint, and it is equal
      • isEmoji

        public boolean isEmoji()
        See if this cell is an emoji.
        Overrides:
        isEmoji in class Cell
        Returns:
        true if this cell is an emoji
      • setCodePoints

        public void setCodePoints​(int[] codePoints)
        Set all cell codepoints.
        Parameters:
        codePoints - the codepoints to set to
      • getCodePoints

        public int[] getCodePoints()
        Getter for cell codepoints.
        Returns:
        a copy of the codepoints
      • getCodePointCount

        public int getCodePointCount()
        Getter for number of codepoints in this cell.
        Returns:
        the number of codepoints
      • add

        public void add​(int codePoint)
        Append one codepoint to the end of the sequence.
        Parameters:
        codePoint - the codepoint to add
      • toCharArray

        public char[] toCharArray()
        Convert the codepoints to a character array.
        Returns:
        an array of all of the codepoints