#include "bergerparker.h"
#include "bstick.h"
#include "goodscoverage.h"
-
-
+#include "efron.h"
+#include "boneh.h"
+#include "solow.h"
+#include "shen.h"
#include "coverage.h"
globaldata = GlobalData::getInstance();
string fileNameRoot;
fileNameRoot = getRootName(globaldata->inputFileName);
+ convert(globaldata->getFreq(), freq);
int i;
validCalculator = new ValidCalculators();
+
for (i=0; i<globaldata->Estimators.size(); i++) {
if (validCalculator->isValidCalculator("single", globaldata->Estimators[i]) == true) {
if (globaldata->Estimators[i] == "sobs") {
cDisplays.push_back(new CollectDisplay(new BStick(), new ThreeColumnFile(fileNameRoot+"bstick")));
}else if (globaldata->Estimators[i] == "goodscoverage") {
cDisplays.push_back(new CollectDisplay(new GoodsCoverage(), new OneColumnFile(fileNameRoot+"goodscoverage")));
+ }else if (globaldata->Estimators[i] == "efron") {
+ convert(globaldata->getSize(), size);
+ cDisplays.push_back(new CollectDisplay(new Efron(size), new OneColumnFile(fileNameRoot+"efron")));
+ }else if (globaldata->Estimators[i] == "boneh") {
+ convert(globaldata->getSize(), size);
+ cDisplays.push_back(new CollectDisplay(new Boneh(size), new OneColumnFile(fileNameRoot+"boneh")));
+ }else if (globaldata->Estimators[i] == "solow") {
+ convert(globaldata->getSize(), size);
+ cDisplays.push_back(new CollectDisplay(new Solow(size), new OneColumnFile(fileNameRoot+"solow")));
+ }else if (globaldata->Estimators[i] == "shen") {
+ convert(globaldata->getSize(), size);
+ cDisplays.push_back(new CollectDisplay(new Shen(size), new OneColumnFile(fileNameRoot+"shen")));
}
}
}
read->read(&*globaldata);
order = globaldata->gorder;
+ lastOrder = order;
input = globaldata->ginput;
- set<string> orderList;
- while(order != NULL){
+ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
+ set<string> processedLabels;
+ set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
+
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
- orderList.insert(order->getLabel());
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
+
cCurve = new Collect(order, cDisplays);
- convert(globaldata->getFreq(), freq);
cCurve->getCurve(freq);
-
delete cCurve;
cout << order->getLabel() << '\t' << count << endl;
+ processedLabels.insert(order->getLabel());
+ userLabels.erase(order->getLabel());
+ userLines.erase(count);
+
+ //you have a label the user want that is smaller than this line and the last line has not already been processed
+ }
+
+ if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastOrder->getLabel()) != 1)) {
+ cCurve = new Collect(lastOrder, cDisplays);
+ cCurve->getCurve(freq);
+ delete cCurve;
+
+ cout << lastOrder->getLabel() << '\t' << count << endl;
+ processedLabels.insert(lastOrder->getLabel());
+ userLabels.erase(lastOrder->getLabel());
}
- delete order;
+ if (count != 1) { delete lastOrder; }
+ lastOrder = order;
order = (input->getOrderVector());
count++;
}
- set<string>::iterator i;
- for(i = globaldata->labels.begin(); i != globaldata->labels.end(); ++i)
- if(orderList.count(*i) == 0)
- cout << "'" << *i << "'" << " is not a valid label.\n";
- for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
+
+ //output error messages about any remaining user labels
+ set<string>::iterator it;
+ bool needToRun = false;
+ for (it = userLabels.begin(); it != userLabels.end(); it++) {
+ cout << "Your file does not include the label "<< *it;
+ if (processedLabels.count(lastOrder->getLabel()) != 1) {
+ cout << ". I will use " << lastOrder->getLabel() << "." << endl;
+ needToRun = true;
+ }else {
+ cout << ". Please refer to " << lastOrder->getLabel() << "." << endl;
+ }
+ }
+
+ //run last line if you need to
+ if (needToRun == true) {
+ cCurve = new Collect(lastOrder, cDisplays);
+ cCurve->getCurve(freq);
+ delete cCurve;
+
+ cout << lastOrder->getLabel() << '\t' << count << endl;
+ }
+
+ delete lastOrder;
+ for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
return 0;
}
catch(exception& e) {