Building Parsers with Java

sjm.examples.sling
Class Point

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

public class Point
extends SlingFunction

Objects of this class store two numbers that effectively determine a point in two-dimensional space.


Field Summary
 double x
           
 double y
           
 
Fields inherited from class sjm.examples.sling.SlingFunction
source
 
Constructor Summary
Point(double x, double y)
          Create a point with the given coordinates.
 
Method Summary
 Point f(double t)
          Points are not really functions at all, but the Point class subclasses SlingFunction so that they may serve in compositions of other functions.
 java.lang.String toString()
          Returns a string representation of this point.
 
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

x

public double x

y

public double y
Constructor Detail

Point

public Point(double x,
             double y)
Create a point with the given coordinates.
Method Detail

f

public Point f(double t)
Points are not really functions at all, but the Point class subclasses SlingFunction so that they may serve in compositions of other functions. Points have nothing to compute, so the receiver always returns itself.
Overrides:
f in class SlingFunction
Parameters:
t - ignored
Returns:
this point

toString

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

by Steve Metsker