easik.states
Class AddPullbackConstraintState

java.lang.Object
  extended by easik.states.EasikState
      extended by easik.states.AddPullbackConstraintState
All Implemented Interfaces:
PathAcceptingState

public class AddPullbackConstraintState
extends EasikState
implements PathAcceptingState

This state makes a pullback constraint. When pushed, it will then push another state to get a path. Once the first path is received, it will push another request for a path. This repeated until four paths have been collected and then the constraint is created (as long as the paths are valid).

Since:
2006-05-23 Kevin Green
Version:
2006-08-15 Kevin Green
Author:
Kevin Green 2006, Vera Ranieri 2006

Field Summary
private  boolean _finished
          Stores whether the user has finished adding paths to this constraint
private  java.util.ArrayList<SketchPath> _paths
          The paths involved in this constraint
private  int _round
          The current path number being selected
 
Fields inherited from class easik.states.EasikState
_ourSketch
 
Constructor Summary
AddPullbackConstraintState(Sketch inSketch)
          Constructor for creating a new state to collect paths and make a diagram.
 
Method Summary
private  boolean addDiagram()
          Add the diagram to the sketch
 void passPath(SketchPath inPath)
          Called when a new path has been completed by a state above this on the stack.
 void poppedOff()
          Nothing to do when it gets popped off, as it always pops itself off when completed.
 void pushedOn()
          When this state is pushed on, it sends a message in a popup and then pushes a path collection state.
 java.lang.String toString()
          This state is called "New Pullback Constraint"
 
Methods inherited from class easik.states.EasikState
cancelClicked, finishClicked, gotFocus, nextClicked, resetColors, selectionUpdated, setCancelButton, setFinishButton, setNextButton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_paths

private java.util.ArrayList<SketchPath> _paths
The paths involved in this constraint


_finished

private boolean _finished
Stores whether the user has finished adding paths to this constraint


_round

private int _round
The current path number being selected

Constructor Detail

AddPullbackConstraintState

public AddPullbackConstraintState(Sketch inSketch)
Constructor for creating a new state to collect paths and make a diagram.

Parameters:
inSketch - The sketch being worked with.
Method Detail

passPath

public void passPath(SketchPath inPath)
Called when a new path has been completed by a state above this on the stack. If it is null, then cancel, otherwise add it to the collection. When we get four paths, then we're finished (if they share a domain and codomain).

Specified by:
passPath in interface PathAcceptingState
Parameters:
inPath - The last path in, null if it was a cancellation

addDiagram

private boolean addDiagram()
Add the diagram to the sketch

Returns:
true if the constraint was successfully added to the sketch, false otherwise

pushedOn

public void pushedOn()
When this state is pushed on, it sends a message in a popup and then pushes a path collection state.

Specified by:
pushedOn in class EasikState

poppedOff

public void poppedOff()
Nothing to do when it gets popped off, as it always pops itself off when completed.

Specified by:
poppedOff in class EasikState

toString

public java.lang.String toString()
This state is called "New Pullback Constraint"

Specified by:
toString in class EasikState
Returns:
The string literal described above.