Spirograph Problem Set Javadocs

spirograph
Class CodeMerger

java.lang.Object
  extended byspirograph.CodeMerger
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class CodeMerger
extends java.lang.Object
implements java.awt.event.ActionListener

This class implements a listener that is added to the "Load Horizontal Code." and "Load Vertical Code" buttons on the Code Box. The CodeMerger reads the text from the text fields and arranges for the creation of an Accelerator object that evaluates the code. This is then passed to the AccelHandlers as a new Accelerator to use.

Copyright © 1998 Massachusetts Institute of Technology.
Copyright © 2002-2003 Franklin W. Olin College of Engineering.

Version:
$Id: CodeMerger.java,v 1.5 2004/02/09 20:55:03 gus Exp $
Author:
Luis Sarmenta, lfgs@cag.lcs.mit.edu, Henry Wong, henryw@mit.edu, Nathan Williams, nathanw@mit.edu, Patrick G. Heck, gus.heck@olin.edu
See Also:
DotPanel

Constructor Summary
CodeMerger(java.lang.String ruleName, CodeSource studentInput, AccelHandler myAccelHandler, AccelHandler otherAccelHandler)
          Create a code merger that can convert student input to working behavior and give it a name.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          When the event we're registered for is performed, create the Accelerator from the code.
 void setBoth(boolean useAsBoth)
          This is used when the option to use the same rule for both the vertical and horizontal acceleration is selected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeMerger

public CodeMerger(java.lang.String ruleName,
                  CodeSource studentInput,
                  AccelHandler myAccelHandler,
                  AccelHandler otherAccelHandler)
Create a code merger that can convert student input to working behavior and give it a name.

Parameters:
ruleName - The name for this code merger
studentInput - The code the student wrote that needs to be merged.
myAccelHandler - The object that will contain the behavior for this axis
otherAccelHandler - The object that contians the behavior for the other axis
Method Detail

setBoth

public void setBoth(boolean useAsBoth)
This is used when the option to use the same rule for both the vertical and horizontal acceleration is selected

Parameters:
useAsBoth - Is this rule used for both directions?

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
When the event we're registered for is performed, create the Accelerator from the code.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ae - An event signaling that the code should be merged

Spirograph Problem Set Javadocs