Building Parsers with Java

sjm.examples.sling
Class SlingTarget

java.lang.Object
  |
  +--sjm.examples.sling.SlingTarget

public class SlingTarget
extends java.lang.Object
implements PubliclyCloneable

This class provides a target for a SlingParser . The target holds a scope for variables, two sliders, and the RenderableCollection object which the user's commands will fill with renderable functions.


Field Summary
protected static int DEFAULT_NLINE
           
protected  RenderableCollection renderables
           
protected  javax.swing.JSlider s1
           
protected  javax.swing.JSlider s2
           
protected  Scope scope
           
 
Constructor Summary
SlingTarget(javax.swing.JSlider s1, javax.swing.JSlider s2)
          Construct a target, given two sliders.
 
Method Summary
 java.lang.Object clone()
          Return this object.
 RenderableCollection getRenderables()
          Return the renderables collection which is the destination for the user's renderable functions.
 boolean isDefined(java.lang.String s)
          Return true, if the given variable name exists in this target's scope.
 Variable lookup(java.lang.String name)
          Return a variable of the given name.
 Variable nLine()
          Return the special variable "nLine", which establishes the number of lines to use in rendering a function.
 javax.swing.JSlider s1()
          Return the first slider.
 javax.swing.JSlider s2()
          Return the second slider.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NLINE

protected static int DEFAULT_NLINE

scope

protected Scope scope

s1

protected javax.swing.JSlider s1

s2

protected javax.swing.JSlider s2

renderables

protected RenderableCollection renderables
Constructor Detail

SlingTarget

public SlingTarget(javax.swing.JSlider s1,
                   javax.swing.JSlider s2)
Construct a target, given two sliders.
Method Detail

clone

public java.lang.Object clone()
Return this object. The sliders do not change, there is not enough ambiguity in the language for the variables in a scope to change, and the sling plot collection is empty until parsing completes.
Specified by:
clone in interface PubliclyCloneable
Overrides:
clone in class java.lang.Object
Returns:
this object

getRenderables

public RenderableCollection getRenderables()
Return the renderables collection which is the destination for the user's renderable functions.
Returns:
the renderables collection which is the destination for the user's renderable functions

isDefined

public boolean isDefined(java.lang.String s)
Return true, if the given variable name exists in this target's scope.

lookup

public Variable lookup(java.lang.String name)
Return a variable of the given name.
Parameters:
String - the name to look up
Returns:
a variable of the given name

nLine

public Variable nLine()
Return the special variable "nLine", which establishes the number of lines to use in rendering a function.
Returns:
the special variable "nLine", which establishes the number of lines to use in rendering a function

s1

public javax.swing.JSlider s1()
Return the first slider.
Returns:
the first slider

s2

public javax.swing.JSlider s2()
Return the second slider.
Returns:
the second slider

by Steve Metsker