Exemple #1
0
bool connectionValid(int mask, Stat S){
    for (int i = 0; i < 5; i++) if (maskGet(mask, i)){
        Stat::iterator it = SSfind(S, i);
        if (it != S.end()) S.erase(it);
    }
    return S.empty();
}
Exemple #2
0
void cleanup() {
	Stat stat;
	stat.scan_directory( fs::path(".test"), SCAN_MODE_RECURSIVE | SCAN_MODE_FILES | SCAN_MODE_DIRS );
	stat.sort();
	std::reverse( stat.begin(), stat.end() );
	stat.remove();
	fs::remove( fs::path(".test") );
}
Exemple #3
0
Stat newStat(Stat S, int mask){
    set<set<int> > T;
    for (int i = 0; i < 5; i++) if (maskGet(mask, i)){
        SSinsertNew(T, i);
        if (i != 0 && maskGet(mask, i - 1)) SScombine(T, i, i - 1);
        for (int j = 0; j < i; j++) if (maskGet(mask, j)){
            if (SSfind(S, i) == S.end()) continue;
            if (SSfind(S, i) == SSfind(S, j))  SScombine(T, i, j);            
        }        
    }    
    return T;
}
Exemple #4
0
string strFromStat(Stat S){
    string s;
    for (Stat::iterator it = S.begin(); it != S.end(); it++){
        string tmp = "{";
        for (set<int>::iterator i = it->begin(); i != it->end(); i++){
            tmp += strFromInt(*i) + ", ";
        }
        tmp[tmp.size() - 2] = '}';
        tmp[tmp.size() - 1] = ' ';
        s += tmp;
    }
    return s;
}
Exemple #5
0
void exiting(){
	stat.end();
}
Exemple #6
0
void SSinsert(Stat &S, int i, int j){
    Stat::iterator it = SSfind(S, j);
    assert(it != S.end());
    set<int> s(*it); S.erase(it);
    s.insert(i); S.insert(s);    
}
Exemple #7
0
Stat::iterator SSfind(Stat &S, int i){
    for (Stat::iterator it = S.begin(); it != S.end(); it++){
        if (it->count(i)) return it;
    }
    return S.end();
}