varification
Class VertexInfo
- public class VertexInfo
Title: Automatic Varfication of two process system
Description: This program will do an automatic varification of the mutual exclusion algorithim as described by the dog problem
Copyright: Copyright (c) 2003
- Version:
- 1.0
- Author:
- Jonathan Harris
VertexInfo
public VertexInfo(byte lineNumberP0,
byte lineNumberP1,
byte turn)
- these are the line numbers for "alice" and "bob" aka process 0 and process 1
- Parameters:
lineNumberP0
- this is the line number for process 0
lineNumberP1
- this is the line number for process 1
VertexInfo
public VertexInfo(byte lineNumberP0,
byte lineNumberP1,
byte turn,
byte[] zeroAtLines)
- these are the line numbers for "alice" and "bob" aka process 0 and process 1 this constructor will also set the static array that states what lines of the program a process will have its want flag be 0
- Parameters:
lineNumberP0
- this is the line number for process 0
lineNumberP1
- this is the line number for process 1
zeroAtLines
-
p0Wants
public boolean p0Wants()
- this will return true if p0 wants access to the critical section i.e. the flag for p0 is 1
- Returns:
- true if p0 wants access to the critical section
p1Wants
public boolean p1Wants()
- this will return true if p1 wants access to the critical section i.e. the flag for p1 is 1
- Returns:
- true if p0 wants access to the critical section
processWants
protected boolean processWants(int processNumber)
- this is used to find whether a particular process wants into the crit section
- Parameters:
processNumber
- the process number we are checking
- Returns:
- true if the process wants in, otherwise false
getTurn
public byte getTurn()
- this will allow you to get whos turn it is
- Returns:
- which processes turn it is
setTurn
public void setTurn(byte turn)
- allows you to set which processes turn it is
- Parameters:
turn
- the turn to set
resetVisitation
public void resetVisitation()
- reset the visitation information
getVisitColor
public byte getVisitColor()
- This will test the status of a node and tell you if it is visited, completed, or not seen yet
- Returns:
- either VertexInfo.WHITE, for not seen, VertexInfo.GREY, for seen but not completed, or VertexInfo.BLACK, for finished
getDiscoveryTime
public int getDiscoveryTime()
- Returns:
- the discovery time or -1
getFinishTime
public int getFinishTime()
- return the finish time or -1
- Returns:
hashCode
public int hashCode()
- the hashcode is based on the state of turn, the line p0 is on and the line p1 is on
- Returns:
- the hash code
equals
public boolean equals(Object o)
- in our model to nodes are equal if they share the same hashcodes, (ie they have the same line numbers and turn)
- Parameters:
o
- the object to test againesd
- Returns: