void processquerypattern(ModelType & model, ClassDecoder * classdecoder, const Pattern & pattern, const string & dorelations, bool doinstantiate) { if (!model.has(pattern)) { cout << "PATTERN \"" << pattern.tostring(*classdecoder) << "\" NOT FOUND IN MODEL" << endl; } else { model.print(&cout, *classdecoder, pattern, doinstantiate); if (!dorelations.empty()) model.outputrelations(pattern, *classdecoder, &cout, dorelations == "all" ? "" : dorelations); } }
void viewmodel(ModelType & model, ClassDecoder * classdecoder, ClassEncoder * classencoder, bool print, bool report, bool nocoverage, bool histogram , bool query, const string dorelations, bool doinstantiate, bool info, bool printreverseindex, int cooc, double coocthreshold = 0.1) { cerr << "Generating desired views..." << endl; if (print) { if (classdecoder == NULL) { cerr << "ERROR: Unable to print model, no class file specified (--classfile)" << endl; } else { model.print(&cout, *classdecoder, doinstantiate); } } if (printreverseindex) { model.printreverseindex(&cout, *classdecoder); } if (report) { model.report(&cout, nocoverage); } if (histogram) { model.histogram(&cout); } if (cooc == 2) { model.outputcooc_npmi(&cout, *classdecoder,coocthreshold); } else if (cooc == 1) { model.outputcooc(&cout, *classdecoder,coocthreshold); } if (query) { if (classencoder == NULL) { cerr << "ERROR: Unable to query model, no class encoder specified (--classfile)" << endl; } else { querymodel<ModelType>(model, classencoder, classdecoder, dorelations, doinstantiate); } } else if (!dorelations.empty()) { bool first = true; for (typename ModelType::iterator iter = model.begin(); iter != model.end(); iter++) { cout << iter->first.tostring(*classdecoder) << endl; const PatternPointer pp = iter->first; model.outputrelations(pp, *classdecoder, &cout, dorelations == "all" ? "" : dorelations,first); first = false; } } if (info) { model.info(&cout); } }