jcurzez
Class Cell

java.lang.Object
  |
  +--jcurzez.Cell

public class Cell
extends java.lang.Object

A Cell contains a character and its decoration. This decoration is:

This class is heavily used in AbstractWindow, as a buffer. Thus all its member are public. And almost all its methods are package private.

Version:
0.0.3
Author:
Thomas Girard

Field Summary
 Attribute attribute
          Attribute of the cell.
 BackgroundColor background
          Background color of this cell.
 int character
          The character to display.
 ForegroundColor foreground
          Foreground color of this cell.
 boolean hasChanged
          Indicates if the cell has changed.
static Cell NULL_CELL
          Singleton null cell object.
 
Constructor Summary
(package private) Cell(Cell source)
          Copy constructor.
(package private) Cell(int character, Attribute attribute, BackgroundColor background, ForegroundColor foreground)
          Creates a new cell with specified decoration and specified character.
(package private) Cell(int character, Attribute attribute, BackgroundColor background, ForegroundColor foreground, boolean changed)
          Creates a new cell.
 
Method Summary
(package private)  void copyFrom(int character, Attribute attribute, BackgroundColor background, ForegroundColor foreground)
          Copies into this cell given attributes.
(package private)  void copyInto(Cell destinationCell)
          Copies this to destinationCell.
 boolean hasSameDecoration(Cell cell)
          Returns true if this and cell have the same decoration.
 java.lang.String toString()
          Returns a string representation of this, in the following form: [ foregorund on background, attribute ].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_CELL

public static final Cell NULL_CELL
Singleton null cell object.


character

public int character
The character to display.


hasChanged

public boolean hasChanged
Indicates if the cell has changed. If so, it requires to be refreshed.


attribute

public Attribute attribute
Attribute of the cell.

See Also:
Attribute

background

public BackgroundColor background
Background color of this cell.

See Also:
BackgroundColor

foreground

public ForegroundColor foreground
Foreground color of this cell.

See Also:
ForegroundColor
Constructor Detail

Cell

Cell(Cell source)
Copy constructor.

Parameters:
source - the cell to copy.

Cell

Cell(int character,
     Attribute attribute,
     BackgroundColor background,
     ForegroundColor foreground,
     boolean changed)
Creates a new cell.

Parameters:
character - the character in this cell.
attribute - the attribute to use to paint this cell.
background - the attribute to use to paint this cell.
foreground - the attribute to use to paint this cell.
changed - true if this cell has changed.

Cell

Cell(int character,
     Attribute attribute,
     BackgroundColor background,
     ForegroundColor foreground)
Creates a new cell with specified decoration and specified character.

Parameters:
character - the character to use in this cell.
attribute - the attribute to use to paint this cell.
background - the attribute to use to paint this cell.
foreground - the attribute to use to paint this cell.
Method Detail

copyInto

void copyInto(Cell destinationCell)
Copies this to destinationCell.

Parameters:
destinationCell - the cell where to copy this.

copyFrom

void copyFrom(int character,
              Attribute attribute,
              BackgroundColor background,
              ForegroundColor foreground)
Copies into this cell given attributes.

Parameters:
character - the character to use in this cell.
attribute - the attribute to use to paint this cell.
background - the attribute to use to paint this cell.
foreground - the attribute to use to paint this cell.

hasSameDecoration

public boolean hasSameDecoration(Cell cell)
Returns true if this and cell have the same decoration. That is to say foreground color, background color and attribute.

Parameters:
cell - the cell to compare this to.
Returns:
true if cell and this have the same decoration.

toString

public java.lang.String toString()
Returns a string representation of this, in the following form: [ foregorund on background, attribute ].

Overrides:
toString in class java.lang.Object


Send me an email