ti.swing.console
Class Region

java.lang.Object
  extended byti.swing.console.Region

public abstract class Region
extends java.lang.Object

A region gets mapped over a section of a character stream. It can be used to modify the state of the graphics as the Console is being rendered. It can also be used to just track a section of the character stream.

A region is immutable. It is not possible to modify the offset or length of a region once it is created.

Version:
0.0
Author:
Rob Clark

Constructor Summary
protected Region(int offset, int length)
          Region class constructor.
 
Method Summary
 void enter(ConsoleGraphics g)
          Modify the state of the graphics, for example to modify the state of the graphics if this region applies some attribute.
 int getEnd()
          Get the offset of the end of this region, exclusive.
 int getLength()
          Get the length of this region.
 int getStart()
          Get the offset of the start of this region, inclusive.
 void leave(ConsoleGraphics g)
          Modify the state of the graphics, for example to restore the original graphics state if this region applies some attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Region

protected Region(int offset,
                 int length)
Region class constructor.

Parameters:
offset - the offset into the character stream where this region begins
length - the length of this region
Method Detail

getStart

public int getStart()
Get the offset of the start of this region, inclusive.

Returns:
the start offset

getEnd

public int getEnd()
Get the offset of the end of this region, exclusive.

Returns:
the end offset

getLength

public int getLength()
Get the length of this region.

Returns:
the length, in number of characters.

enter

public void enter(ConsoleGraphics g)
Modify the state of the graphics, for example to modify the state of the graphics if this region applies some attribute.

Parameters:
g - the graphics

leave

public void leave(ConsoleGraphics g)
Modify the state of the graphics, for example to restore the original graphics state if this region applies some attribute.

Parameters:
g - the graphics