示例#1
0
Time UndoManager::getTimeOfRedoTransaction() const
{
    if (auto* s = getNextSet())
        return s->time;

    return Time::getCurrentTime();
}
void asferencodestr::powerSetCompAndExtractPatterns()
{
	std::vector<string> enchoro_vec;
	ifstream input;
	char line[256];
	string encstrpath(asferroot);
	encstrpath.append("/asfer.enterprise.encstr");
	input.open(encstrpath.c_str(), ifstream::in);
	while (!input.eof())
	{
		input.getline(line,256);
		cout<<"powerSetCompAndExtractPatterns(): line="<<line<<endl;
		string enchorostr(line);
		if(strlen(line) > 0)
			enchoro_vec.push_back(enchorostr);
	}
	int n=enchoro_vec.size();
	cout<<"powerSetCompAndExtractPatterns(): enchoro_vec.size()="<<enchoro_vec.size()<<endl;
	for(int i=1; i < (int)pow(2.0, (double)n); i++)
	{
		cout<<"powerSet "<<i<<endl;
		std::vector<std::string> nextSubSet=getNextSet(enchoro_vec, i);
		powerSetExtractPatterns(nextSubSet);
	}
}
示例#3
0
String UndoManager::getRedoDescription() const
{
    if (auto* s = getNextSet())
        return s->name;

    return {};
}
示例#4
0
String UndoManager::getRedoDescription() const
{
    if (const ActionSet* const s = getNextSet())
        return s->name;

    return String::empty;
}
示例#5
0
float checkMultithreaded (string const & myResult, string const & learning)
{
    ofstream cmpLog("compare_log.txt", ofstream::trunc);
    if (!cmpLog.is_open())
    {
        cerr << "Cannot create compare_log file.\n";
        return 0;
    }

    map<int, vector<int> > myOdds = readOutput(myResult);
    map<int, vector<int> > trueOdds = readOutput(learning);

    int currentSetN = StartSet;
    int n_wrong = 0;
    float mark = 0;

    Stitcher stitcher;

    while (currentSetN < FinishSet)
    {
        vector<int> v1 = getNextSet(currentSetN, myOdds);
        vector<int> v2 = getNextSet(currentSetN, trueOdds);
        float tmpMark = compareResults(v1, v2);
        if (tmpMark != 1.0)
        {
            cmpLog << currentSetN << "\nmy odds:";
            printIntVector(cmpLog, v1);
            cmpLog << "true odds:";
            printIntVector(cmpLog, v2);

            int tmp;
            printMat_(cmpLog, stitcher.calcSetStitch2(currentSetN, &tmp));
            //Stitcher::printStitchMatrix(cmpLog, stitcher.calcSetStitch2(currentSetN));

            n_wrong += 1;

        }
        mark += tmpMark;
        currentSetN += 1;
    }
    cmpLog << n_wrong << " classified wrong.";
    cmpLog.close();
    return (currentSetN-StartSet>0) ? mark/(currentSetN-StartSet) : mark;
}
示例#6
0
bool UndoManager::redo()
{
    if (auto* s = getNextSet())
    {
        const ScopedValueSetter<bool> setter (reentrancyCheck, true);

        if (s->perform())
            ++nextIndex;
        else
            clearUndoHistory();

        beginNewTransaction();
        sendChangeMessage();
        return true;
    }

    return false;
}
示例#7
0
bool UndoManager::canRedo() const noexcept   { return getNextSet()    != nullptr; }