spirograph
Class BshAccel
java.lang.Object
spirograph.BshAccel
- All Implemented Interfaces:
- Accelerator
- public class BshAccel
- extends java.lang.Object
- implements Accelerator
Implements and accelerator that uses bean shell to interpret student code.
See www.beanshell.org
for bean shell details.
Copyright © 1998 Massachusetts Institute of Technology.
Copyright © 2003 Franklin W. Olin College of Engineering.
Constructor Summary |
BshAccel(java.lang.String fieldCode,
java.lang.String bodyCode)
Create a new Accelerator that uses the bean shell (bsh)
interpreter to evaluate code, rather than the native Java
compiler. |
Method Summary |
double |
act(double pos,
double vel,
double otherPos,
double otherVel,
double maxPos)
Calculate a new motion related value from position and velocity information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BshAccel
public BshAccel(java.lang.String fieldCode,
java.lang.String bodyCode)
- Create a new Accelerator that uses the bean shell (bsh)
interpreter to evaluate code, rather than the native Java
compiler.
- Parameters:
fieldCode
- The student code defining the fields (variables) used in the body code.bodyCode
- The student code to evaluate
act
public double act(double pos,
double vel,
double otherPos,
double otherVel,
double maxPos)
- Description copied from interface:
Accelerator
- Calculate a new motion related value from position and velocity information.
Usually this value represents, position, acceleration, or velocity.
- Specified by:
act
in interface Accelerator
- Parameters:
pos
- Current position on this axisvel
- Current velocity on this axisotherPos
- Current position on the other axisotherVel
- Current Velocity on the other axismaxPos
- The maximum position on this axis (+ or -)
- Returns:
- The new value