00001 package cedar.jetweb.model.plots; 00002 00003 import java.io.File; 00004 00005 import cedar.jetweb.*; 00006 import cedar.jetweb.db.DBPlotManager; 00007 import cedar.jetweb.JetWebException; 00008 import cedar.jetweb.model.*; 00009 import cedar.jetweb.model.fit.*; 00010 import cedar.jetweb.generator.Generator; 00011 00012 import java.util.Vector; 00013 00022 public class FittedPlot extends DataPlot { 00023 private Fit fit_; 00024 private int runSeriesId=-1; 00025 private DataPlot comparisonPlot; 00026 00027 public FittedPlot(MergedPlot inPlot, Fit inFit) 00028 throws JetWebException{ 00029 00030 fit_ = inFit; 00031 if(inPlot != null){ 00032 setFrom(inPlot); 00033 } 00034 00035 if(inPlot.hasData()){ 00036 //dataPoints = inPlot.getDataPoints(); 00037 hasdata = true; 00038 }else{ 00039 hasdata = false; 00040 } 00041 00042 00043 procIdWanted = inPlot.getProcIdWanted(); 00044 } 00045 00046 00054 public FittedPlot(PredictedPlot predictedPlot, Fit fitIn) throws JetWebException { 00055 00056 fit_ = fitIn; 00057 00058 if (predictedPlot != null){ 00059 runSeriesId = predictedPlot.getRunSeriesId(); 00060 setFrom(predictedPlot); 00061 comparisonPlot = predictedPlot.getCompPlot(); 00062 if (predictedPlot.hasData()){ 00063 dataPoints = predictedPlot.getDataPoints(); 00064 hasdata = true; 00065 } else { 00066 hasdata = false; 00067 } 00068 00069 procIdWanted = predictedPlot.getProcIdWanted(); 00070 00071 } 00072 } 00073 00080 public FittedPlot(int plotId, Fit fitIn) throws JetWebException { 00081 00082 fit_ = fitIn; 00083 csnId = plotId; 00084 00085 } 00086 00087 00095 public FittedPlot(RealPlot realPlot, Fit fitIn) throws JetWebException { 00096 00097 fit_ = fitIn; 00098 00099 if (realPlot != null){ 00100 setFrom(realPlot); 00101 if (!isShape()){ 00102 setSysScale(fit_.getScale()); 00103 } 00104 comparisonPlot = realPlot; 00105 hasdata = false; 00106 } 00107 } 00108 00109 00110 //accessors 00114 public Fit getFit(){ return fit_; } 00118 public void setFit(Fit fit){ fit_ = fit;} 00119 00120 public FittedPlot setDataPoints(Vector<DataPoint> points){ 00121 00122 dataPoints = points; 00123 00124 return this; 00125 } 00126 00131 public DataPlot getCompPlot(){ return comparisonPlot; } 00138 //public void toDB(int fitId) throws JetWebException { 00139 public void toDB() throws JetWebException { 00140 // this.fitId = fitId; 00141 DBPlotManager.insertFittedPrediction(this); 00142 DBPlotManager.insertData(this); 00143 } 00144 00148 public MCProcessType getMCProcessType() throws JetWebException { 00149 00150 if (proc==null) { 00151 if (runSeriesId<0) { 00152 runSeriesId = (fit_.getModel().getRunSeriesCollection().getRunSeries(this)).getId(); 00153 } 00154 proc = new MCProcessType(DBPlotManager.getProcId(runSeriesId)); 00155 } 00156 return proc; 00157 } 00158 00163 public int getProcIdWanted() throws JetWebException { 00164 return procIdWanted; 00165 } 00166 00167 public Integer getRunSeriesId(){ 00168 return runSeriesId; 00169 } 00170 00177 public double[] getChi2(){ 00178 if (chi2[1]<=0) { 00179 chi2 = getChi2(fit_.getId()); 00180 } 00181 return chi2; 00182 } 00183 00184 00185 } 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202
Generated Wed Jan 17 09:14:27 GMT 2007