import ChaosDemos.*;
import java.awt.*;
import java.util.*;

//********************************************************************
/**                    
* Diagnostics for Map1D <br>
* Base class for subclassing
* @version 10 October 1997
* @author Michael Cross
*/
//********************************************************************

public class Map1DDiagnostics {
               
/** math constants */      
      static final double Pi=Math.PI;
      static final double Pi2=2*Pi;
      
/* flags */
/**  true if user has chosen range with mouse */
      boolean setAxesRange=false;
/** true if transient is to be run on call to restart() */
      boolean runTrans=false;
/** true if second trace to be plotted */
      boolean curve2 = false; 
/** true if a,b boxes to be disbaled */
      public boolean hideab = false;       
      
/** number of iterations to eliminate transient   */
      int ntrans=0; 
/** Number of iterations to perform before processing  */
      int nf=1;  
/** number of points used to plot function */      
      int functionPoints=256;   
/** number of curves */
      int ncurve=-1;     
/** index of first data curve */
      int ncurve1;
/** index of second data curve */
      int ncurve2; 
/** number of iterations */      
      int iterations=0; 
/** delay in graph update         */
      int delay=100;                 
/** parameter of map equations */
      double a;
/** Maximum value allowed for a */      
      double aMaxLimit;
/** Minimum value allowed for a */       
      double aMinLimit;
/** parameter of map equations */                          
      double b; 
/** iteration variable */
      double x;
/** starting value */      
      double x0;
/** map parameters {a,b} */      
      double[] parameters;
/** Number of map parameters */      
      public int nParameters;          
/** Range of plot */
      double xmin=0,xmax=1,ymin=0,ymax=1;
/** parent class */                                                                                                              
      Map1D parent;

//******************************************************************
/**
* @param inParent parent class
* @see Map1D
*/
//******************************************************************
      public Map1DDiagnostics(Map1D inParent) {
            parent=inParent;                 
      }
      
//********************************************************************
/**
* Updates parameters from the text controls in parent class 
*/ 
//********************************************************************            
      public void updateParameters() {                            
      }      
                
//*********************************************************************
/**
* Restarts
*/
//*********************************************************************      
      public void restart() {
      }

//*********************************************************************
/**
* Iterates Map equations and updates graph
* @return true if iteration successful
*/
//*********************************************************************      
      public boolean iterate() {                   
            return true;
      }
      
//**********************************************************************
/**
* Sets default values of parameters depending on plot type
*/
//**********************************************************************          
      public void setPlotDefaults() {
      }                 
                      
//**********************************************************************
/**
* Resets x-range to 0 < x < 1
*/
//**********************************************************************            
      public void resetRange() {
            xmin=0.;
            xmax=1.;   
            ymin=0.;
            ymax=1.;
            setAxesRange=false;
      }            

//**********************************************************************
/**
* Action to perform on mouse drag. Default is to set range of axes
* and restart
*/
//**********************************************************************      
      public void respondToDrag(double x1, double x2, double y1, double y2) {
            xmin=x1;
            xmax=x2;
            ymin=y1;
            ymax=y2;
            setAxesRange=true;
            restart();
      }

//**********************************************************************
/**
* Action to perform on mouse click. Default is display coordinates 
* of point
*/
//**********************************************************************      
      public void respondToClick(double x, double y) {
            alertDialog alert = new alertDialog(parent,
                "  Point is ("+(float)x+","+(float)y+")");
      }       

//**********************************************************************
/**
* Shifts x to 0<x<1
* @param x input value
* @return value shifted to between 0 and shift
*/
//**********************************************************************      
      private double mod(double x, double shift) {
         while (x>shift) {
            x=x-shift;
         }   
         while (x<0.) {
            x=x+shift;
         }
         return x;
      }

//**********************************************************************
/**
* Sets delay for movie iteration
*/
//**********************************************************************      
      public void setDelay(int inDelay) {
            delay=inDelay;
      } 

//**********************************************************************
}      
