Building Parsers with Java

sjm.examples.sling
Class Random

java.lang.Object
  |
  +--sjm.examples.sling.SlingFunction
        |
        +--sjm.examples.sling.Random

public class Random
extends SlingFunction

Objects of this class return a random number between 0 and 1 when asked for their value.


Fields inherited from class sjm.examples.sling.SlingFunction
source
 
Constructor Summary
Random()
           
 
Method Summary
 Point f(double t)
          Generate a random number r between 0 and 1, and return the point (t, r).
 java.lang.String toString()
          Returns a string representation of this function.
 
Methods inherited from class sjm.examples.sling.SlingFunction
eval, extrema, fresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Random

public Random()
Method Detail

f

public Point f(double t)
Generate a random number r between 0 and 1, and return the point (t, r).
Overrides:
f in class SlingFunction
Parameters:
t - a number that represents how far along a plot is, and thus tells which point to return
Returns:
a new point: (t, random())

toString

public java.lang.String toString()
Returns a string representation of this function.
Overrides:
toString in class java.lang.Object

by Steve Metsker