All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class key.Terminal

java.lang.Object
   |
   +----key.Terminal

public class Terminal
extends Object
This class defines the basic abstract implementation of a terminal type. It's specific to a TelnetConnection, since the other (custom) terminals will need changes at a much higher level.


Variable Index

 o marked
The position that was marked.
 o names
It is the responsibility of the subclass to set this array.
 o normal
If this boolean is true, then the stream is in an uncoloured state (the last code sent down reset it completely).
 o stack
The actual stack variable, holds all the previous colour codes.
 o STACK_SIZE
The maximum expected colours on a line.
 o stackValue
This always points at the next place to put an increasing colour code.
 o terminalTypes

Constructor Index

 o Terminal()

Method Index

 o clearScreen()
 o codeLookup(char)
 o createTerminal(String)
 o getName()
 o nameMatches(String)
 o reset(PrintStream)
Should be called at the end of every section of input - will reset the stream to its proper state
 o stringForCode(char)
Does all the necessary coding to support the newly returned colour code for input into the stream.

Variables

 o STACK_SIZE
 public static final int STACK_SIZE
The maximum expected colours on a line.
If this limit is exceeded, then the ^- operator won't work correctly - for efficiency reasons we're simply going to write over the top part of the stack.
If this becomes a problem in the future, (all those F&$#*(&#$ gits who set their emails "all pretty colours" for instance, just increase this stack size.

 o marked
 protected int marked
The position that was marked. If no-where has been marked, this will be -1. If you mark, you can't remark something until the terminal has been reset (like what happens when there's a new paragraph)
Its meant to be used in, for example, the 'say' command. You don't want the users stuffed up colour codes wrecking your colouring for the end quote, so right after the open quote you mark, then restore mark just before the end quote. This means no matter *what* happens, you can always get back to where you marked.
Don't mark when you're > the stack size.
Again - if you run out of stack, bad things *will happen*. ;)

 o stack
 protected char stack[]
The actual stack variable, holds all the previous colour codes.

 o stackValue
 protected int stackValue
This always points at the next place to put an increasing colour code. (ie, one past)

 o normal
 protected boolean normal
If this boolean is true, then the stream is in an uncoloured state (the last code sent down reset it completely).

 o names
 protected String names[]
It is the responsibility of the subclass to set this array.

 o terminalTypes
 protected static LinkedList terminalTypes

Constructors

 o Terminal
 protected Terminal()

Methods

 o reset
 public void reset(PrintStream outputStream)
Should be called at the end of every section of input - will reset the stream to its proper state

 o nameMatches
 public boolean nameMatches(String test)
 o getName
 public String getName()
 o stringForCode
 public String stringForCode(char code)
Does all the necessary coding to support the newly returned colour code for input into the stream.

 o codeLookup
 public String codeLookup(char code)
 o clearScreen
 public String clearScreen()
 o createTerminal
 public static Terminal createTerminal(String terminalName) throws IllegalAccessException, InstantiationException

All Packages  Class Hierarchy  This Package  Previous  Next  Index