Ejemplo n.º 1
0
void ContactModel::botDestroyed()
{
	MAGNORMOBOT *bot = qobject_cast<MAGNORMOBOT*>(sender());
	conduits.removeOne(bot);
	if (hasContacts(bot)) {
		beginResetModel();
		removeContacts(bot);
		endResetModel();
	}
}
Ejemplo n.º 2
0
bool infection::hasInfecContacts()
{
    // Returns true if one or more potentially
    // infectious contacts exist in the list

    set<Contact>::iterator cIter( contacts.begin() );

    if(!hasContacts()) return false;

    while(cIter != contacts.end()) {
        if(cIter->isInfectious()) return true;
        cIter++;
    }

    return false;
}
Ejemplo n.º 3
0
vector<const Contact*> infection::getInfecContacts()
{
    // Gets all infectious contacts

    vector<const Contact*> contactList;
    set<Contact>::iterator cIter( contacts.begin() );

    if(!hasContacts()) return contactList;

    while(cIter != contacts.end()) {
        if(cIter->isInfectious()) {
            contactList.push_back(&(*cIter));
        }
        cIter++;
    }

    return contactList;
}
Ejemplo n.º 4
0
size_t infection::numContactsByUntil(const CON_e contactType,
                                     const double t)
{
    // Returns the number of contacts up to just before t

    size_t numContact = 0;
    set<Contact>::iterator cIter = contacts.begin();

    if(!hasContacts()) return 0;

    while(cIter != contacts.end() && (t - cIter->time) > FP_TOL) {
        if(cIter->type == contactType && cIter->isInfectious()) {
            numContact++;
        }
        cIter++;
    }

    return numContact;
}
Ejemplo n.º 5
0
vector<const Contact*> infection::getContactsByUntil(const CON_e contactType,
        const double t)
{
    // Returns a vector of pointers to individuals who
    // contacted *this by method contactType up to just
    // before time t.

    vector<const Contact*> contactList;
    set<Contact>::iterator cIter = contacts.begin();

    // Return empty vector if no contacts exist (time saver)
    if(!hasContacts()) return contactList;

    // Iterate over contacts and pick out the relevant entries
    while(cIter != contacts.end() && (t - cIter->time) > FP_TOL) {
        if(cIter->type == contactType && cIter->isInfectious()) {
            contactList.push_back(&(*cIter));
        }
        cIter++;
    }

    return contactList;
}
Ejemplo n.º 6
0
void CollisionPair::swapRepresentations()
{
	SURGSIM_ASSERT(! hasContacts()) << "Can't swap representations after contacts have already been calculated";
	m_isSwapped = !m_isSwapped;
	std::swap(m_representations.first, m_representations.second);
}