com.distributed.api
Class Camera

java.lang.Object
  |
  +--com.distributed.api.Camera

public class Camera
extends java.lang.Object

Class used to implement Global Snapshot Algorithm


Field Summary
static boolean GETVAL
          Constant used by the entire Class
 boolean globalsnapshotreceived
          Variable set by users
static boolean SETVAL
          Constant used by the entire Class
 
Constructor Summary
Camera(Environment parent)
          Constructor to be normally used by the Environment
 
Method Summary
protected  boolean accessRED(boolean val, boolean set)
          Method to get value of RED while setting it if set is true
 void markerReceivedFrom(int pid)
          Called when the Marker is received from a process
 void saveChannelState(java.lang.String messg, int source)
          used to save the channel state
 void turnRed(int source, int to)
          Called when this process should Turn Red
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GETVAL

public static final boolean GETVAL
Constant used by the entire Class

See Also:
Constant Field Values

globalsnapshotreceived

public boolean globalsnapshotreceived
Variable set by users


SETVAL

public static final boolean SETVAL
Constant used by the entire Class

See Also:
Constant Field Values
Constructor Detail

Camera

public Camera(Environment parent)
Constructor to be normally used by the Environment

Parameters:
parent - The Parent Environment invoking the Algorithm
Method Detail

accessRED

protected boolean accessRED(boolean val,
                            boolean set)
Method to get value of RED while setting it if set is true

Parameters:
set - Condition to set RED to val
val - New value of RED
Returns:
Value of RED

markerReceivedFrom

public void markerReceivedFrom(int pid)
Called when the Marker is received from a process

Parameters:
pid - Process Id of the source of Marker

saveChannelState

public void saveChannelState(java.lang.String messg,
                             int source)
used to save the channel state

Parameters:
messg - The message to be added to the channel state
source - Process ID of the Source of the Message

turnRed

public void turnRed(int source,
                    int to)
Called when this process should Turn Red

Parameters:
source - The Id of the source process of the Marker
to - The instigator of Algo, to whom the snapshot should be returned