Source Code
Infrared Signal Coding Schemes
home top contents previous up next

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;


final public class UFunTest extends Content {
	public UFunTest	(Dimension dim, Image img, String problemName){
			super(dim,img,problemName);
	}

	protected void initPreconstructor_Variables(){
		modelDescription=new String[]{
				"Program 12. Model:   Custom erfc test. ''Apache,exp'' comparision."
	    };
		dmnStartF=0.0;
		dmnRangeF=1.5;
		dmnRangeFDown=.5;
		
		dmnStartX=-5.0;
		dmnRangeX=10.0;
		
		grStartF=600;
		grPoints=200;
        gridStepY=.1;
        drawGrid=true;
    	drawLengenOnCurve=false;
    	
		functionCOUNT=6;
    	functionColor=new Color[]{
    			new Color(0,180,0),
    			new Color(255,0,0),
    			new Color(0,0,255),

    			new Color(0,0,0),
    			new Color(255,0,0),
    			new Color(0,0,255)    			
    	};
        functionTitle=new String[]{
        	"1-HeavisideFunction",	
        	"Custom erfc",
        	"Apache package erfc * 1.02",
        	"Integrand = 1/sqrt(2Pi)exp(-xx/2)",
        	"Integrand test from custom * 1.02",
        	"Integrand test from Apache * 1.04"
        };
	}
	
	
	//-----------------------------------------------
    // User Input-Output Prompts
    //- - - - - - - - - - - - - - - - - - - - - - - - 
   	
    protected int setParsToStrings(){
         int i=0;
         strParsCrr[i][0]=String.valueOf(dmnRangeX);  strParsCrr[i][1]="Argument Range"; strParsCrr[i++][2]="double"; 
         strParsCrr[i][0]=String.valueOf(dmnRangeF);  strParsCrr[i][1]="Function Range"; strParsCrr[i++][2]="double";
         strParsCrr[i][0]=String.valueOf(dmnStartF);  strParsCrr[i][1]="Function Start"; strParsCrr[i++][2]="double";
         return i;
    }
    public String setParsFromStrings(){
         int i=0;
         try{
        	 dmnRangeX =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 dmnRangeF =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 dmnStartF =Double.parseDouble(strParsCrr[i][0]);  i++;
         }catch(Exception e){
            return "Exception when (re)setting parameters.\n" + e;    
         }
         return "";
    }
    //- - - - - - - - - - - - - - - - - - - - - - - - 
    // User Input Output Prompts
	//-----------------------------------------------
	
	protected double functionSwitchX(int fIx, double t) {return 0;}
    protected double functionSwitch(int fIx, double x){
	    switch(fIx){
	    case 0: return UCFun.erfh(x,true);
	    case 1: return UCFun.erfh(x,false);
	    case 2: return UFun.erfha(x,false)*1.02;
	    case 3: return 2.0*UCFun.erfIntegrand(x);
	    case 4: return 2.0*UCFun.erfDerivative(x)*1.02;
	    case 5: return 2.0*UFun.erfDerivative(x,0.0001)*1.04;
	    }
	    return 0;
    }
    protected void spawnParametersAfterUserApplied(){};

}


Copyright (C) 2009 Konstantin Kirillov