package at.jku.fim.datalinksimulation.layer7.Bully; import at.jku.fim.datalinksimulation.layer1.data.RawData; import at.jku.fim.datalinksimulation.layer7.Application; import at.jku.fim.datalinksimulation.networkstack.NetworkStackParameters; import at.jku.fim.datalinksimulation.scenario.Bully.gui.BullyPanel; import at.jku.fim.datalinksimulation.utils.Logger; /** *
The Bully Application running on the individual stations
*Copyright: (c) 2004,2005
*Company: FIM@JKU, www.fim.uni-linz.ac.at
* @author Michael Sonntag * @version $Id$ */ public class BullyApplication extends Application implements Runnable { /** Current state of Bully algorithm is unknown */ public final static int BULLY_STATE_UNKNOWN=0; /** Initialization: When the algorithm starts; before sending the election messages */ public final static int BULLY_STATE_INIT=1; /** Election messages have been sent; waiting for the first OK message */ public final static int BULLY_STATE_ELECTION=2; /** At least one OK message received; we are waiting for a coordinator message */ public final static int BULLY_STATE_WAIT=3; /** We are a slave */ public final static int BULLY_STATE_SLAVE=4; /** We are the master */ public final static int BULLY_STATE_MASTER=5; /** * Constructor * @param stationId Station ID of host * @param stationCount total number of stations */ public BullyApplication(final int stationId,final int stationCount) { } /** Retrieve the station ID * @return the ID of this station **/ public int getStationId() { } /** Retrieve the ID of our current master. This is our number if we * are the master, a different one if we are a slave, or -1 if there * is currently no master (e.g. during an election). * Used for showing it in the GUI. * @return the master's ID */ public int getMasterID() { } /** Set GUI panel so we can notify it about state changes. Called by the application. * @param gui the GUI panel */ public void setGui(final BullyPanel gui) { } /** Run this application. Starts immediately an election and then starts the * message loop to wait for incoming messages. */ public void run() { } /** Stop this thread. Used in case the application "fails" (when the user * disables it through the GUI). The thread is terminated and the state * set to "unknown". Pinging the master stops too, if the thread * is currently doing this. */ public void terminate() { } /** Receive data from the network * @param params network parameters * @param data raw data */ public void informAboutNewData(final NetworkStackParameters params,final RawData data) { } /** We don't have a logger * @return alwaysnull
**/
public Logger getLogger() {
}
}