//======================================================
// Numerical Analysis package in java
// PlotS class to plot 2D data 
// with real time function generation (function input as 
// String variable uses Plot class to plot function
// Dr. Turhan Coban
// EGE University, Engineering School, Mechanical Eng. Div.
// turhan.coban@ege.edu.tr
// =====================================================
import java.io.*;
import java.awt.Color;
import static java.lang.Math.*;
import javax.swing.*;
public class PlotS
{ ce1 x0;  // write function f2D compile it as a java file
  ce3 x1;  // plot function f2D by using Plot class
  String ss;
  double xm,xma;
  int N,ipt,ir,ig,ib;
  
  public PlotS(String s,double xm,double xma,int N,int ipt,int ir,int ig,int ib)
  {
	  ce1 x0=new ce1(s);
	  ss=s;       
      this.xm=xm;
      this.xma=xma;
      this.N=N;
      this.ipt=ipt;
      this.ir=ir;
      this.ig=ig;
      this.ib=ib;
  }
  public PlotS(String s,double xm,double xma,int N,int ipt)
  {
	  ce1 x0=new ce1(s);
	  ss=s;       
      this.xm=xm;
      this.xma=xma;
      this.N=N;
      this.ipt=ipt;
      this.ir=0;
      this.ig=0;
      this.ib=0;
  }
  public PlotS(String s,double xm,double xma,int N)
  {
	  ce1 x0=new ce1(s);
	  ss=s;       
      this.xm=xm;
      this.xma=xma;
      this.N=N;
      this.ipt=0;
      this.ir=0;
      this.ig=0;
      this.ib=0;
  }
  
  public PlotS(String s,double xm,double xma)
  {
	  ce1 x0=new ce1(s);
	  ss=s;       
	  this.xm=xm;
      this.xma=xma;
      this.N=400;
      this.ipt=0;
      this.ir=0;
      this.ig=0;
      this.ib=0;      
  }
   
  public void plot()
  { x1=new ce3(xm,xma,N,ipt,ir,ig,ib,ss);}
  
  public static void func(String s,double xm,double xma,int N,int ipt,int ir,int ig,int ib)
  {PlotS ps=new PlotS(s,xm,xma,N,ipt,ir,ig,ib);
   ps.plot();
  }
  public static void func(String s,double xm,double xma,int N,int ipt)
  {PlotS ps=new PlotS(s,xm,xma,N,ipt,0,0,0);
   ps.plot();
  }
  public static void func(String s,double xm,double xma,int N)
  {PlotS ps=new PlotS(s,xm,xma,N,0,0,0,0);
   ps.plot();
  }
  public static void func(String s,double xm,double xma)
  {PlotS ps=new PlotS(s,xm,xma,400,0,0,0,0);
   ps.plot();

  }
}