monotonic
Class Concave


java.lang.Object

  extended bymonotonic.Monotonic

      extended bymonotonic.Concave

All Implemented Interfaces:
java.io.Serializable

public class Concave
extends Monotonic

Generates concave monotonic functions.

Convace extends Monotonic which forces concavity rules on top of monotonicity rules when creating random points.

Author:
A.K.Nircan
See Also:
Serialized Form

Field Summary
 
Fields inherited from class monotonic.Monotonic
lowerEnvelope, points, rand, sNear, upperEnvelope
 
Constructor Summary
Concave()
          Concave constructor with no envelopes and sNear = 0.01
Concave(double sNear)
          Concave object constructor.
Concave(Envelope upperEnvelope, Envelope lowerEnvelope, double sNear)
          Creates a concave object with upper and lower envelopes and sNear parameter
 
Method Summary
private  double angleLeft(double r, java.lang.Double b)
          Generates a new point at the far left (begining) of the point list and returns its y value.
private  double angleRight(double r, java.lang.Double c)
          Creates a new point at far right of the point list and returns this new points' y value.
 double gety(double r)
          Randomly generates a y value for the r value and stores it to the point list using MOCASSIM algorithm.
private  double interpolate(double r, java.lang.Double b, java.lang.Double c)
          Starts an interpolation scheme where target value r is approached step by step with halving the interval of left and right of r.
 
Methods inherited from class monotonic.Monotonic
angleLeft, angleRight, deletePoints, getNumberOfPoints, getPoints, getSNear, hasBothEnvelopes, hasLowerEnvelope, hasUpperEnvelope, interpolate, leftOf, leftOf, passesThru, pointOnLine, pointOnLine, randomBetween, rightOf, rightOf, setLowerEnvelope, setSNear, setUpperEnvelope, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Concave


public Concave(Envelope upperEnvelope,
               Envelope lowerEnvelope,
               double sNear)
Creates a concave object with upper and lower envelopes and sNear parameter

Parameters:
upperEnvelope -
lowerEnvelope -
sNear - minimum allowed distance between two points in the point list created in interpolation. Has no effect on extrapolation algorithms angleLeft and angleRight.

Concave


public Concave(double sNear)
Concave object constructor.

Parameters:
sNear - minimum allowed distance between two points in the point list created in interpolation. Has no effect on extrapolation algorithms.

Concave


public Concave()
Concave constructor with no envelopes and sNear = 0.01

Method Detail

gety


public double gety(double r)
Description copied from class: Monotonic
Randomly generates a y value for the r value and stores it to the point list using MOCASSIM algorithm.

Overrides:
gety in class Monotonic
Parameters:
r - x coordinate where the new point will be created
Returns:
randomly generated y value for the given r

angleRight


private double angleRight(double r,
                          java.lang.Double c)
Creates a new point at far right of the point list and returns this new points' y value.

Parameters:
r - x coordinate of the new point to be created
c - is the last point on the point list
Returns:
y value corresponding to r which is randomly created and obeys monotonicity and concavity rules.

angleLeft


private double angleLeft(double r,
                         java.lang.Double b)
Generates a new point at the far left (begining) of the point list and returns its y value.

Parameters:
r - x coordinate of the new point to be created.
b - is the first point in the point list.
Returns:
y value corresponding to r which is randomly created and obeys monotonicity and concavity rules.

interpolate


private double interpolate(double r,
                           java.lang.Double b,
                           java.lang.Double c)
Starts an interpolation scheme where target value r is approached step by step with halving the interval of left and right of r. All points created using this algorithm are obeying monotonicity and concavity rules and are randomly created. Step halving continues until x distance of first points on the left and right of r are less then sNear.

Parameters:
r - x coordinate of the new point to be created.
b - first point to the left of r
c - first point to the right of r
Returns:
y value corresponding to r which is found by drawing a line from the first points to the right and left of r.