mqwfes
Class Console

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--mqwfes.Console
All Implemented Interfaces:
java.lang.Runnable

public class Console
extends java.lang.Thread

class that provides communication with user via command line interface. Prints out messages and accepts simple commands.
The thread waits for user input, reads a commandline, parses it and compares it to known commands. If a commandline matches to one of the known commands, it executes the function that is assigned to the command.

Version:
0.5
Author:
Administrator

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Console()
          Creates new console
 
Method Summary
static java.lang.String leadingZero(int source)
          converts an Integer to String with leading zero if smaller than 10
static void msgout(java.lang.String message)
          prints out console messages with no sender
 void run()
          instructions that are executed when thread is started mostly in infinite while-loop to keep thread alive
static void warn(java.lang.String who, java.lang.String message)
          prints out warnings and writes them to log
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Console

public Console()
Creates new console

Method Detail

run

public void run()
instructions that are executed when thread is started mostly in infinite while-loop to keep thread alive

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

msgout

public static void msgout(java.lang.String message)
prints out console messages with no sender

Parameters:
message - is message to console

warn

public static void warn(java.lang.String who,
                        java.lang.String message)
prints out warnings and writes them to log

Parameters:
who - is sender of console message
message - message to print out

leadingZero

public static java.lang.String leadingZero(int source)
converts an Integer to String with leading zero if smaller than 10

Parameters:
source - the source number to be converted
Returns:
String representation of source integer with at least 2 digits