sir.sim
Class SimSIR

java.lang.Object
  |
  +--sir.sim.SimSIR

public class SimSIR
extends java.lang.Object

This is the new SIR sampler capable of sampling from any SIR epidemic with grid layout. Regimes are currently not supported.

Author:
Michael Höhle, 10 October 2002

Nested Class Summary
 class SimSIR.Event
           
 
Field Summary
protected  java.text.NumberFormat form
          For formatting of doubles to an output stream.
 
Constructor Summary
SimSIR(java.lang.String baseName)
          Constructor - setup the model parameters and initializes the necessary arrays.
 
Method Summary
 boolean areNeighbours(int x1, int y1, int x2, int y2)
          Determine whether two units are neighbours or not in N_4
 int gridXY2Index(int x, int y)
          Function to convert (x,y) coordinate to an index Labelling is (1,1)=1, (2,1)=2
 int index2GridX(int index)
          Function to convert index to a position in the grid.
 int index2GridY(int index)
          Function to convert index to a position in the grid.
 void initSampler()
           
 void logEvent(double t, long[][] X, long[][] Y, int evx, int evy, int type)
          Write an event to the corresponding file(s)
static void main(java.lang.String[] argv)
          A sir sampler for command line calling.
 void writeRECHeader(java.io.PrintStream rec)
          Function writes the header of the .rec file based on the current parameter values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

form

protected java.text.NumberFormat form
For formatting of doubles to an output stream.

Constructor Detail

SimSIR

public SimSIR(java.lang.String baseName)
Constructor - setup the model parameters and initializes the necessary arrays.

Parameters:
baseName - The basename giving where to store the basename.rec and basename.inf files
Method Detail

initSampler

public void initSampler()

writeRECHeader

public void writeRECHeader(java.io.PrintStream rec)
Function writes the header of the .rec file based on the current parameter values.


index2GridX

public int index2GridX(int index)
Function to convert index to a position in the grid. Labelling is (1,1)=1, (2,1)=2

Parameters:
index - The index in the rid
Returns:
The x coordinate

index2GridY

public int index2GridY(int index)
Function to convert index to a position in the grid. Labelling is (1,1)=1, (2,1)=2

Parameters:
index - The index in the rid
Returns:
The y coordinate

gridXY2Index

public int gridXY2Index(int x,
                        int y)
Function to convert (x,y) coordinate to an index Labelling is (1,1)=1, (2,1)=2

Parameters:
x - The x coordinate
y - The y coordinate
Returns:
The index

areNeighbours

public boolean areNeighbours(int x1,
                             int y1,
                             int x2,
                             int y2)
Determine whether two units are neighbours or not in N_4

Parameters:
x1 - x coordinate of first unit
y1 - y coordinate of first unit
x2 - x coordinate of second unit
y2 - y coordinate of second unit
Returns:
boolean

logEvent

public void logEvent(double t,
                     long[][] X,
                     long[][] Y,
                     int evx,
                     int evy,
                     int type)
Write an event to the corresponding file(s)


main

public static void main(java.lang.String[] argv)
A sir sampler for command line calling.