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.
-
marked
- The position that was marked.
-
names
- It is the responsibility of the subclass to
set this array.
-
normal
- If this boolean is true, then the stream is
in an uncoloured state (the last code sent
down reset it completely).
-
stack
- The actual stack variable, holds all the
previous colour codes.
-
STACK_SIZE
- The maximum expected colours on a line.
-
stackValue
- This always points at the next place to put
an increasing colour code.
-
terminalTypes
-
-
Terminal()
-
-
clearScreen()
-
-
codeLookup(char)
-
-
createTerminal(String)
-
-
getName()
-
-
nameMatches(String)
-
-
reset(PrintStream)
- Should be called at the end of every section
of input - will reset the stream to its
proper state
-
stringForCode(char)
- Does all the necessary coding to support
the newly returned colour code for input
into the stream.
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.
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*. ;)
stack
protected char stack[]
- The actual stack variable, holds all the
previous colour codes.
stackValue
protected int stackValue
- This always points at the next place to put
an increasing colour code. (ie, one past)
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).
names
protected String names[]
- It is the responsibility of the subclass to
set this array.
terminalTypes
protected static LinkedList terminalTypes
Terminal
protected Terminal()
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
nameMatches
public boolean nameMatches(String test)
getName
public String getName()
stringForCode
public String stringForCode(char code)
- Does all the necessary coding to support
the newly returned colour code for input
into the stream.
codeLookup
public String codeLookup(char code)
clearScreen
public String clearScreen()
createTerminal
public static Terminal createTerminal(String terminalName) throws IllegalAccessException, InstantiationException
All Packages Class Hierarchy This Package Previous Next Index