Class MultipleWells

java.lang.Object
  |
  +--SquareWell
        |
        +--MultipleWells

class MultipleWells
extends SquareWell

A piecewise-constant function with a number of equally spaced square wells, each of equal width and depth.


Field Summary
static int DEFAULT_NWELLS
          The default number of wells
static double DEFAULT_PERIOD
          The default period
static double DEFAULT_PERIODIC_WIDTH
          The default width when there is more than one well
protected  int nWells
          The number of wells
protected  double period
          The period
 
Fields inherited from class SquareWell
DEFAULT_DEPTH, DEFAULT_SHIFT, DEFAULT_WIDTH, depth, shift, width
 
Constructor Summary
MultipleWells()
          Creates a new set of wells with default parameters.
MultipleWells(double depth, double width, double shift, double period, int nWells)
          Creates a new set of wells
MultipleWells(double depth, double width, double period, int nWells)
          Creates a new set of wells, centred on the origin.
MultipleWells(int nWells)
          Creates a new set of wells with default parameters.
 
Method Summary
 double evaluate(double x)
           
 double getHigh()
          Returns the maximum value this function can take
 double getLow()
          Returns the minimum value this function can take
 double[] getMarkers(double minX, double maxX)
          Returns an array containing x coordinates of all discontinuities within the specified interval.
 double getPeriod()
          Returns the period
 int getWellCount()
          Returns the number of wells
 void reCentre()
          Adjusts the shift parameter so that the wells are centered on the origin.
 void setPeriod(double d)
          Sets the period
 void setWellCount(int i)
          Sets the number of wells, and calls reCentre() if the number jas changed.
 
Methods inherited from class SquareWell
getDepth, getLeft, getRight, getShift, getWidth, setDepth, setShift, setWidth
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

period

protected double period
The period

nWells

protected int nWells
The number of wells

DEFAULT_PERIODIC_WIDTH

public static double DEFAULT_PERIODIC_WIDTH
The default width when there is more than one well

DEFAULT_PERIOD

public static double DEFAULT_PERIOD
The default period

DEFAULT_NWELLS

public static int DEFAULT_NWELLS
The default number of wells
Constructor Detail

MultipleWells

public MultipleWells(double depth,
                     double width,
                     double shift,
                     double period,
                     int nWells)
Creates a new set of wells
Parameters:
depth - The depth of the wells
width - The width of each well
shift - The x coordinate of the start of the first well
period - The distance between the left edges of two adjacent wells
nWells - The number of wells

MultipleWells

public MultipleWells(double depth,
                     double width,
                     double period,
                     int nWells)
Creates a new set of wells, centred on the origin.
Parameters:
depth - The depth of the wells
width - The width of each well
period - The distance between the left edges of two adjacent wells
nWells - The number of wells

MultipleWells

public MultipleWells(int nWells)
Creates a new set of wells with default parameters.
Parameters:
nWells - The number of wells

MultipleWells

public MultipleWells()
Creates a new set of wells with default parameters.
Method Detail

evaluate

public double evaluate(double x)
Overrides:
evaluate in class SquareWell
Returns:
depth if x is in a well, else zero.

getMarkers

public double[] getMarkers(double minX,
                           double maxX)
Returns an array containing x coordinates of all discontinuities within the specified interval.
Overrides:
getMarkers in class SquareWell

reCentre

public void reCentre()
Adjusts the shift parameter so that the wells are centered on the origin. In addition, if the width exceeds the period, it will be set to half the period (unless there is only one well, of course).

This method is intended to be used after a change to the period or number of wells.


getWellCount

public int getWellCount()
Returns the number of wells

setWellCount

public void setWellCount(int i)
Sets the number of wells, and calls reCentre() if the number jas changed.

getPeriod

public double getPeriod()
Returns the period

setPeriod

public void setPeriod(double d)
Sets the period

getLow

public double getLow()
Returns the minimum value this function can take

getHigh

public double getHigh()
Returns the maximum value this function can take