Spirograph Problem Set Javadocs

spirograph
Class Recipie

java.lang.Object
  extended byspirograph.Recipie
All Implemented Interfaces:
CodeSource, java.io.Serializable

public class Recipie
extends java.lang.Object
implements java.io.Serializable, CodeSource

Models the student code input, or "Recipie". A recipie consists of two strings. The first string may contain any number of variable declarations and defintions. The second string esentially contains a method body which is interpreted to control the movement of a dot on the x or y axis (or both). Classes which implement the RecipieListener interface may register be notified of changes in either the field text or the statement (method body) text. An always empty static instance of this class is maintained as the "null Recipie". Any recipie variable can point to this static instance and be assured, both that it exists and that it will never have any code or fields text.

Copyright © 2003 Franklin W. Olin College of Engineering.

Version:
$Id: Recipie.java,v 1.9 2004/02/09 20:55:03 gus Exp $
Author:
Patrick G. Heck, gus.heck@olin.edu
See Also:
RecipieView, Serialized Form

Field Summary
static Recipie nullRecipie
          A recipie that represents a no data condition.
 
Constructor Summary
Recipie()
          Creates a new instance of RecipieModel
 
Method Summary
 void addRecipieListener(RecipieListener rl)
          Register an object for notification of changes to this recipie.
 void fireRecipieChanged()
          Manually ensure that all listners are updated.
 java.lang.String getCode()
          Get the student code that represents a method body.
 java.lang.String getFields()
          Get the student code that represents variable declarations and definitions.
 int getIdNum()
          Get a unique identifier for this object.
 boolean isCompiled()
          Ask this recipie if it has been compiled since it's last modification.
 void removeRecipieListener(RecipieListener rl)
          Unregister an object that was listening to this recipie.
 void setCode(java.lang.String statements)
          Store new student code.
 void setCompiled(boolean isComp)
          Mark this code as having been compiled since it's last edit, or edited since it's last compile.
 void setFields(java.lang.String fields)
          Store new student fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nullRecipie

public static final Recipie nullRecipie
A recipie that represents a no data condition. It should always have id 0, and all fields should be empty or zero at all times. Attempts to modify this object should result in an UnsupportedOperationException

Constructor Detail

Recipie

public Recipie()
Creates a new instance of RecipieModel

Method Detail

isCompiled

public boolean isCompiled()
Ask this recipie if it has been compiled since it's last modification.

Returns:
True if no modifications have been made since the last setCompiled(true) call

getIdNum

public int getIdNum()
Get a unique identifier for this object.

Returns:
An identfying integer that is unique to any given instance.

getCode

public java.lang.String getCode()
Get the student code that represents a method body.

Specified by:
getCode in interface CodeSource
Returns:
The student method body code

getFields

public java.lang.String getFields()
Get the student code that represents variable declarations and definitions.

Specified by:
getFields in interface CodeSource
Returns:
The student variable declarations and defintions

setCompiled

public void setCompiled(boolean isComp)
Mark this code as having been compiled since it's last edit, or edited since it's last compile.

Parameters:
isComp - true if the code has been compiled, false if it has been modified

setCode

public void setCode(java.lang.String statements)
             throws java.lang.UnsupportedOperationException
Store new student code.

Parameters:
statements - The student code to store.
Throws:
java.lang.UnsupportedOperationException - if invoked on nullRecipie

setFields

public void setFields(java.lang.String fields)
               throws java.lang.UnsupportedOperationException
Store new student fields.

Parameters:
fields - The variable declarations and definitions to store.
Throws:
java.lang.UnsupportedOperationException - if invoked on nullRecipie

addRecipieListener

public void addRecipieListener(RecipieListener rl)
Register an object for notification of changes to this recipie.

Parameters:
rl - The object to register

removeRecipieListener

public void removeRecipieListener(RecipieListener rl)
Unregister an object that was listening to this recipie.

Parameters:
rl - The object that wishes to be unregistered.

fireRecipieChanged

public void fireRecipieChanged()
Manually ensure that all listners are updated.


Spirograph Problem Set Javadocs