sir.sim
Class SimSelke

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

public class SimSelke
extends java.lang.Object

New sampler to handle Selke constructions. Currently, only the single homogenous setup is handled. Intention is to go to a spatial setup at some point.

Author:
Michael Höhle, 17 October 2002

Nested Class Summary
 class SimSelke.Event
          A class to handle events
 class SimSelke.Individual
          Class to handle each individual in the population.
 
Field Summary
protected  java.text.NumberFormat form
          For formatting of doubles to an output stream.
 
Constructor Summary
SimSelke(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
 java.lang.String finalSize(long[][] N, java.util.TreeSet[][] S)
          Show current X(t) and Y(t) for all units in dense form
 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()
           
static void main(java.lang.String[] argv)
          A sir sampler for command line calling.
 void state(java.util.TreeSet[][] S, java.util.TreeSet[][] E, java.util.TreeSet[][] I, java.util.TreeSet[][] R)
          Show current X(t) and Y(t) for all units
 void writeLogFiles(java.lang.String baseName)
          Write the corresponding events into the logfiles
 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

SimSelke

public SimSelke(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.

Parameters:
rec - The stream containing the recovery files.

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

finalSize

public java.lang.String finalSize(long[][] N,
                                  java.util.TreeSet[][] S)
Show current X(t) and Y(t) for all units in dense form

Parameters:
N - Number of initial Susceptibles
S - Number of susceptibles at end.
Returns:
Final size

state

public void state(java.util.TreeSet[][] S,
                  java.util.TreeSet[][] E,
                  java.util.TreeSet[][] I,
                  java.util.TreeSet[][] R)
Show current X(t) and Y(t) for all units


writeLogFiles

public void writeLogFiles(java.lang.String baseName)
Write the corresponding events into the logfiles

Parameters:
baseName - baseName.rec and baseName.inf are made

main

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