Building Parsers with Java

sjm.examples.sling
Class Slider

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

public class Slider
extends SlingFunction

This class holds a JSlider component, and returns the the slider's value in its f(t) call.

The slider, which this class's constructor requires, should vary from 0 to 100. This class divides that value by 100, so that the slider will effectively vary from 0 to 1. The y component of the return value of f(t) ignores time, and depends only on the slider value. Like all one-dimensional functions, however, this function uses time as the x component of the value it returns.


Field Summary
protected  javax.swing.JSlider slider
           
 
Fields inherited from class sjm.examples.sling.SlingFunction
source
 
Constructor Summary
Slider(javax.swing.JSlider slider)
          Constructs a function that wraps the given slider.
 
Method Summary
 Point f(double t)
          Returns, essentially, a slider's value, which should be a number between 0 and 1.
 java.lang.String toString()
          Return a string representation of this slider.
 
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
 

Field Detail

slider

protected javax.swing.JSlider slider
Constructor Detail

Slider

public Slider(javax.swing.JSlider slider)
Constructs a function that wraps the given slider.
Method Detail

f

public Point f(double t)
Returns, essentially, a slider's value, which should be a number between 0 and 1.
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, slider value)
See Also:
Abs, Abs.f(double)

toString

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

by Steve Metsker