com.jscape.inet.terminal

## Class CellAttributes

- java.lang.Object
- - com.jscape.inet.terminal.CellAttributes

-     public class CellAttributes
      extends java.lang.Object

  This immutable classs represents code>Cell class attributes. Currently they are: bold, underscored, blinked, reversed and has two colors - foreground and background. `hashCode()` function is overriden for this class, so each `CellAttributes` object has unique hash and may be stored in `HashMap` object. There are no public constructors for `CellAttributes` class and user can get an instance only by using static factory functions. All these techniques help to reduce overall memory usage. Together with `Cell` class this class implements "Flyweight" pattern [Gamma94]

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.Color` | `getBkColor()` Returns background color.
    `java.awt.Color` | `getFgColor()` Returns foreground color.
    `static CellAttributes` | `getInstance()` Returns `CellAttributes` object with default parameters: all character parametrs are false, foreground color is white, background is black.
    `static CellAttributes` | `getInstance(boolean bold, boolean underscored, boolean blinked, boolean reversed, java.awt.Color fgColor, java.awt.Color bkColor)` Returns instance of `CellAttributes` class giving all needed parameters.
    `boolean` | `isBlinked()` Returns if 'blinked' is set for current object.
    `boolean` | `isBold()` Returns if 'bold' is set in current object.
    `boolean` | `isReversed()` Returns if 'reversed' is set for current object.
    `boolean` | `isUnderscored()` Returns if 'underscored' is set for current object.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static CellAttributes getInstance(boolean bold,
                                                   boolean underscored,
                                                   boolean blinked,
                                                   boolean reversed,
                                                   java.awt.Color fgColor,
                                                   java.awt.Color bkColor)

      Returns instance of `CellAttributes` class giving all needed parameters. Function calculates hash for this parameters combination and seeks for object with same parameters in hash map. If there is no object with such parameters a new instance will be created and stored in hash map.
      Parameters:
        `bold` - true if screen character must be bold.
        `underscored` - true if screen character must be underscored.
        `blinked` - true if screen character must be blinked.
        `reversed` - true if screen character must be reversed.
        `fgColor` - foreground color.
        `bkColor` - background color.
      Returns:
        `CellAttributes` with specified parameters.

    - #### getInstance

          public static CellAttributes getInstance()

      Returns `CellAttributes` object with default parameters: all character parametrs are false, foreground color is white, background is black.
      Returns:
        `CellAttributes` with default parameters.

    - #### isBold

          public boolean isBold()

      Returns if 'bold' is set in current object.
      Returns:
        true if 'bold' is set.

    - #### isUnderscored

          public boolean isUnderscored()

      Returns if 'underscored' is set for current object.
      Returns:
        true if 'underscored' is set.

    - #### isBlinked

          public boolean isBlinked()

      Returns if 'blinked' is set for current object.
      Returns:
        true if 'blinked' is set

    - #### isReversed

          public boolean isReversed()

      Returns if 'reversed' is set for current object.
      Returns:
        true if 'reversed' is set.

    - #### getFgColor

          public java.awt.Color getFgColor()

      Returns foreground color.
      Returns:
        foreground color.

    - #### getBkColor

          public java.awt.Color getBkColor()

      Returns background color.
      Returns:
        background color.

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved