void InputDFA::appendCollection (UnitCollection *newcol) {
    switch (state) {
    case LOCATION_SELECT:
    case UNITS_SELECTED:
    case NONE:
        if (selected) {
            Unit *tUnit;
            for(un_iter it = newcol->createIterator(); tUnit = *it; ++it)
                tUnit->Select();
            un_iter tmpit = newcol->createIterator();
            selected->append (&tmpit);
            delete newcol;
            //remove duplicates FIXME
        } else {
            selected=newcol;
        }
        break;
    case TARGET_SELECT:
        if (targetted) {
            un_iter tmpit = newcol->createIterator();
            targetted->append (&tmpit);
            delete newcol;
            //remove duplicates FIXME
        } else {
            targetted = newcol;
        }
        break;
    }
}
void InputDFA::replaceCollection (UnitCollection *newcol) {
    switch (state) {
    case LOCATION_SELECT:
    case UNITS_SELECTED:
    case NONE:
        UnselectAll();
        selected = newcol;
        Unit *tUnit;
        for(un_iter it = selected->createIterator(); tUnit = *it; ++it) {
            tUnit->Select();
        }
        break;
    case TARGET_SELECT:
        UnselectAll();
        targetted = newcol;
        break;
    }
}