pop.model
Class Statics

java.lang.Object
  |
  +--pop.model.Statics

public class Statics
extends java.lang.Object

Key static constants and methods used by many objects. Note: just one may exist at any time (a "singleton").


Field Summary
static int FEMALE
          Identifies a female cohort.
static int MALE
          Identifies a male cohort.
 
Constructor Summary
Statics()
          Unavailable.
Statics(Constants c)
          Construct a Statics with a Constants object.
Statics(int maximum_age, int categories, java.lang.String[] category_names, int years, int base_year, java.lang.String model_title)
          Basic constructor.
 
Method Summary
static int base_year()
          Returns base year of this model.
static int categories()
          Returns number of population categories in this model.
static java.lang.String category_name(int number)
          Returns copy of the indicated category name.
static java.lang.String[] category_names()
          Returns copy of whole array of population category names.
static int category(java.lang.String category_name)
          Returns category number of indicated category.
 Constants constants()
          Returns a new Constants object with current model's maximum_age(), categories(), category_names(), years(), and base_year().
 void destroy()
          Only way to destroy an old model prior to creating a new one.
 void increment()
          Increments current year of model.
static int maximum_age()
          Returns maximum age of cohorts in this model.
static java.lang.String model_title()
          Returns the model's title precondition: a Statics object is instantiated.
 void reset()
          Resets the current year to base year; model to be rerun.
 void set_labels(Constants c)
          Resets the labels (model title, base year, category names).
static boolean valid_age(int age)
          True if age is in valid range (0 to maximum age).
static boolean valid_category(int number)
          True if category number is in valid range (0 to number of categories - 1).
static boolean valid_category(java.lang.String name)
          True if category name is one of the valid names.
static boolean valid_matrix(double[][] x)
          True if the dimensions of the 2-dimensional array exactly match the model's parameters (i.e., full 2 by 1+maximum_age()).
static boolean valid_matrix(int[][] x)
          True if the dimensions of the 2-dimensional array exactly match the model's parameters (i.e., full 2 by 1+maximum_age()).
static boolean valid_sex_constant(int sex)
          True if sex is one of the valid constants.
static int year()
          Returns current year of the model.
static int years()
          Returns number of years the model is to be run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEMALE

public static final int FEMALE
Identifies a female cohort.

MALE

public static final int MALE
Identifies a male cohort.
Constructor Detail

Statics

public Statics(int maximum_age,
               int categories,
               java.lang.String[] category_names,
               int years,
               int base_year,
               java.lang.String model_title)
Basic constructor. Special note: this is a "Singleton"; just one may be instantiated at a time.
Parameters:
maximum_age - - age corresponding to oldest cohorts (e.g., 100 if final age segment is "100+"). The maximum age is immutable after construction, and is considered identical for all Populations.
categories - - number of population categories.
cagegory_names - - strings to identify each category; MUST be of length categories.
years - - number of years to execute model.
base_year - - year corresponding to base population.
model_title - - a title for display.

Statics

public Statics(Constants c)
Construct a Statics with a Constants object.

Statics

public Statics()
Unavailable.
Method Detail

increment

public void increment()
Increments current year of model. preconditions: a Statics object is instantiated; year is not already > base_year()+years(). NOTE: not a static method; must have actual reference to this.

reset

public void reset()
Resets the current year to base year; model to be rerun. NOTE: not a static method; must have actual reference to this.

destroy

public void destroy()
Only way to destroy an old model prior to creating a new one. NOTE: not a static method; must have actual reference to invoke.

set_labels

public void set_labels(Constants c)
Resets the labels (model title, base year, category names). NOTE: not a static method; must have actual reference to invoke.

maximum_age

public static int maximum_age()
Returns maximum age of cohorts in this model. precondition: a Statics object is instantiated.

categories

public static int categories()
Returns number of population categories in this model. precondition: a Statics object is instantiated.

category_name

public static java.lang.String category_name(int number)
Returns copy of the indicated category name. precondition: a Statics object is instantiated.
Parameters:
number - - category number, in the range of 0 to categories()-1.

category_names

public static java.lang.String[] category_names()
Returns copy of whole array of population category names. precondition: a Statics object is instantiated.

category

public static int category(java.lang.String category_name)
Returns category number of indicated category. preconditions: a Statics object is instantiated; valid category name.
Parameters:
category_name - - one of the valid strings.

years

public static int years()
Returns number of years the model is to be run. precondition: a Statics object is instantiated.

base_year

public static int base_year()
Returns base year of this model. precondition: a Statics object is instantiated.

year

public static int year()
Returns current year of the model. precondition: a Statics object is instantiated.

model_title

public static java.lang.String model_title()
Returns the model's title precondition: a Statics object is instantiated.

constants

public Constants constants()
Returns a new Constants object with current model's maximum_age(), categories(), category_names(), years(), and base_year(). precondition: a Statics object is instantiated.

valid_age

public static boolean valid_age(int age)
True if age is in valid range (0 to maximum age). precondition: a Statics object is instantiated.

valid_category

public static boolean valid_category(int number)
True if category number is in valid range (0 to number of categories - 1). precondition: a Statics object is instantiated.

valid_category

public static boolean valid_category(java.lang.String name)
True if category name is one of the valid names. precondition: a Statics object is instantiated.

valid_sex_constant

public static boolean valid_sex_constant(int sex)
True if sex is one of the valid constants.

valid_matrix

public static boolean valid_matrix(int[][] x)
True if the dimensions of the 2-dimensional array exactly match the model's parameters (i.e., full 2 by 1+maximum_age()). precondition: a Statics object is instantiated.

valid_matrix

public static boolean valid_matrix(double[][] x)
True if the dimensions of the 2-dimensional array exactly match the model's parameters (i.e., full 2 by 1+maximum_age()). precondition: a Statics object is instantiated.