monotonic
Class Convex


java.lang.Object

  extended bymonotonic.Monotonic

      extended bymonotonic.Convex

All Implemented Interfaces:
java.io.Serializable

public class Convex
extends Monotonic

Generates convex monotonic functions.

Convex extends Monotonic which forces convexity 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
Convex()
          Constructor for convex.
Convex(double sNear)
          Constructor with no envelopes
Convex(Envelope upperEnvelope, Envelope lowerEnvelope, double sNear)
          Constructs a convex 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

Convex


public Convex(Envelope upperEnvelope,
              Envelope lowerEnvelope,
              double sNear)
Constructs a convex 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.
See Also:
Monotonic

Convex


public Convex(double sNear)
Constructor with no envelopes

Parameters:
sNear -

Convex


public Convex()
Constructor for convex. By default sNear is set to 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

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 convexity rules.

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 convexity 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 convexity 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.