edu.uah.math.distributions
Class Domain

java.lang.Object
  extended by edu.uah.math.distributions.Domain
All Implemented Interfaces:
java.io.Serializable

public class Domain
extends java.lang.Object
implements java.io.Serializable

This class defines a partition of an interval into subintervals of equal width. These objects are used to define default domains. A finite domain can be modeled by the values (midpoints) of the partition. The boundary points are a + iw for i = 0..., n, where n is the size of the partition, a is the lower bound and w the width. The values (midpoints) are a + (i + 1/2)w, for i = 0..., n − 1. The type variable indicates whether the upper and lower bounds are specified (which is usally the case for continuous domains) or whether the upper and lower values are specified (which is usually the case for discrete domains).

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
static int CONTINUOUS
           
static int DISCRETE
           
 
Constructor Summary
Domain()
          This default constructor creates a new domain on (0, 1) with step size 0.1
Domain(double a, double b, double w, int t)
          This general constructor creates a new partition of a specified interval [a, b] into subintervals of width w.
 
Method Summary
 double getBound(int i)
          This method returns the boundary point corresponding to a given index.
 int getIndex(double x)
          This method returns the index of the interval containing a given value.
 double getLowerBound()
          This method returns the lower bound of the domain.
 double getLowerValue()
          This method returns the lower midpoint of the domain.
 double getNearestValue(double x)
          This method returns the value (midpoint) that is closest to a given value.
 int getSize()
          This method returns the size of the partition (the number of subintervals).
 int getType()
          This method returns the type of the domain (DISCRETE or CONTINUOUS).
 double getUpperBound()
          This method returns the upper bound of the domain.
 double getUpperValue()
          This method returns the upper midpoint of the domain.
 double getValue(int i)
          This method return the midpoint of the interval corresponding to a given index.
 double getWidth()
          This method returns the width (step size) of the domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISCRETE

public static final int DISCRETE
See Also:
Constant Field Values

CONTINUOUS

public static final int CONTINUOUS
See Also:
Constant Field Values
Constructor Detail

Domain

public Domain(double a,
              double b,
              double w,
              int t)
This general constructor creates a new partition of a specified interval [a, b] into subintervals of width w. The underlying variable has a specified name and symbol.

Parameters:
a - the lower bound or value
b - the upper bound or value
w - the step size
t - the type of domain

Domain

public Domain()
This default constructor creates a new domain on (0, 1) with step size 0.1

Method Detail

getType

public int getType()
This method returns the type of the domain (DISCRETE or CONTINUOUS).

Returns:
the type

getIndex

public int getIndex(double x)
This method returns the index of the interval containing a given value.

Parameters:
x - a number in the domain
Returns:
the index of x

getBound

public double getBound(int i)
This method returns the boundary point corresponding to a given index.

Parameters:
i - the index

getValue

public double getValue(int i)
This method return the midpoint of the interval corresponding to a given index.

Parameters:
i - the index
Returns:
the midpoint of the interval corresponding to the index

getLowerBound

public double getLowerBound()
This method returns the lower bound of the domain.

Returns:
the lower bound

getUpperBound

public double getUpperBound()
This method returns the upper bound of the domain.

Returns:
the upper bound

getLowerValue

public double getLowerValue()
This method returns the lower midpoint of the domain.

Returns:
the lower value

getUpperValue

public double getUpperValue()
This method returns the upper midpoint of the domain.

Returns:
the upper value

getWidth

public double getWidth()
This method returns the width (step size) of the domain.

Returns:
the width

getSize

public int getSize()
This method returns the size of the partition (the number of subintervals).

Returns:
the size of the domain

getNearestValue

public double getNearestValue(double x)
This method returns the value (midpoint) that is closest to a given value.

Parameters:
x - a number in the domain
Returns:
the midpoint closest to x