Class User

java.lang.Object
  extended byjava.lang.Thread
      extended byUser
All Implemented Interfaces:
Actions, Runnable

public class User
extends Thread
implements Actions

The class creates token then Passes token to neighbour NIC and holds token while the resource in use bu user

Version:
Version 1
Author:
Adeel Hashmi

Field Summary
protected static boolean loop
          Thread looping flag
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface Actions
EXIT, NOPASSING, PASS, PASSTOKEN, READ
 
Constructor Summary
User(NIC card)
          Constructor that creates an instance of BufferedReader to read from console.Throws Exception if error occur in creating IO
User(NIC card, String out)
          Constructor that creates an instance of BufferedReader to read from console.Throws Exception if error occur in creating IO
 
Method Summary
(package private)  void Exit()
          Terminate user thread and NIC thread
 void run()
          The run method prints the sentence in the form of tokens input by user from the console or constructor
 void setInputter()
          Method should be called before if the user thread will be asked to take user input
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

loop

protected static boolean loop
Thread looping flag

Constructor Detail

User

public User(NIC card)
     throws Exception
Constructor that creates an instance of BufferedReader to read from console.Throws Exception if error occur in creating IO


User

public User(NIC card,
            String out)
     throws Exception
Constructor that creates an instance of BufferedReader to read from console.Throws Exception if error occur in creating IO

Method Detail

Exit

void Exit()
Terminate user thread and NIC thread


run

public void run()
The run method prints the sentence in the form of tokens input by user from the console or constructor

Specified by:
run in interface Runnable

setInputter

public void setInputter()
Method should be called before if the user thread will be asked to take user input