Ejemplo n.º 1
0
//-------------------------------------------------------------------------------
// General dumping methods -- dumping relevant parts of ontology
//-------------------------------------------------------------------------------
void TBox :: dump ( dumpInterface* dump ) const
{
	dump->prologue();

	// dump all (relevant) roles
	dumpAllRoles(dump);

	// dump all (relevant) concepts
	for ( c_const_iterator pc = c_begin(); pc != c_end(); ++pc )
		if ( isRelevant(*pc) )
			dumpConcept( dump, *pc );

	for ( i_const_iterator pi = i_begin(); pi != i_end(); ++pi )
		if ( isRelevant(*pi) )
			dumpConcept( dump, *pi );

	// dump GCIs
	if ( getTG() != bpTOP )
	{
		dump->startAx (diImpliesC);
		dump->dumpTop();
		dump->contAx (diImpliesC);
		dumpExpression ( dump, getTG() );
		dump->finishAx (diImpliesC);
	}

	dump->epilogue();
}
Ejemplo n.º 2
0
void Faculty::update(Subject* sbj) {
	if (sbj == this->sbj) {
		if (isRelevant(dynamic_cast<University*>(sbj)->getLastChangeType())) {
			notify();
		}
	}
}
Ejemplo n.º 3
0
BlobVectorPtr TrackerThread::findRelevantBlobs(BlobVectorPtr pBlobs, bool bTouch) 
{
    string sConfigPrefix;
    if (bTouch) {
        sConfigPrefix = "/tracker/touch/";
    } else {
        sConfigPrefix = "/tracker/track/";
    }
    int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
    int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
    float minEccentricity = m_pConfig->getFloatParam(sConfigPrefix+
            "eccentricitybounds/@min");
    float maxEccentricity = m_pConfig->getFloatParam(sConfigPrefix+
            "eccentricitybounds/@max");
    
    BlobVectorPtr pRelevantBlobs(new BlobVector());
    for(BlobVector::iterator it = pBlobs->begin(); it != pBlobs->end(); ++it) {
        if (isRelevant(*it, minArea, maxArea, minEccentricity, maxEccentricity)) {
            pRelevantBlobs->push_back(*it);
        }
        if (pRelevantBlobs->size() > 50) {
            break;
        }
    }
    return pRelevantBlobs;
}
Ejemplo n.º 4
0
		bool AgentInitializer::parseProperties( TiXmlElement * node, const std::string & sceneFldr) {
			//first let's decide if this is a velocity modifier
			if (node->ValueStr() == "VelModifier"){
				//this is, we need to find out if we can parse it
				BFSM::VelModifier *vel = BFSM::parseVelModifier( node, sceneFldr);
				if ( vel == 0x0 ) {
					return false;
				} else {
					_velModifiers.push_back(vel);
				}
			} else if ( isRelevant( node->ValueStr() ) ) {
				// Extract the attributes of the tag
				TiXmlAttribute * attr;
				for ( attr = node->FirstAttribute(); attr; attr = attr->Next() ) {
					ParseResult result = setFromXMLAttribute( attr->Name(), attr->ValueStr() );
					if ( result == FAILURE ) {
						return false;
					} else if ( result == IGNORED ) {
						logger << Logger::WARN_MSG << "Encountered an unexpected per-agent attribute (" << attr->Name() << ") on line " << attr->Row() << ".";
					}
				}
				// Now look for advanced property specifications
				TiXmlElement* child;
				for( child = node->FirstChildElement(); child; child = child->NextSiblingElement()) {
					if ( ! parsePropertySpec( child ) ) {

						return false;
					}
				}
			}
			// Irrelevant nodes are, by definition, successful.
			return true;
		}
Ejemplo n.º 5
0
void TBox :: dumpAllRoles ( dumpInterface* dump ) const
{
	RoleMaster::const_iterator p;
	for ( p = ORM.begin(); p != ORM.end(); ++p )
		if ( isRelevant(*p) )
		{
			fpp_assert ( !(*p)->isSynonym() );
			dumpRole ( dump, *p );
		}
	for ( p = DRM.begin(); p != DRM.end(); ++p )
		if ( isRelevant(*p) )
		{
			fpp_assert ( !(*p)->isSynonym() );
			dumpRole ( dump, *p );
		}
}
Ejemplo n.º 6
0
void TBox :: dumpRole ( dumpInterface* dump, const TRole* p ) const
{
	// dump defRole and parents
	if ( p->getId() > 0 || !isRelevant(p->inverse()) )
	{
		const TRole* q = ( p->getId()>0 ? p : p->inverse() );

		dump->startAx (diDefineR);
		dump->dumpRole(q);
		dump->finishAx (diDefineR);

		// dump parents
		for ( const auto& parent: q->told() )
		{
			dump->startAx (diImpliesR);
			dump->dumpRole(q);
			dump->contAx (diImpliesR);
			dump->dumpRole(static_cast<const TRole*>(parent));
			dump->finishAx (diImpliesR);
		}
	}

	// dump transitility
	if ( p->isTransitive() )
	{
		dump->startAx (diTransitiveR);
		dump->dumpRole(p);
		dump->finishAx (diTransitiveR);
	}

	// dump functionality (for topmost-functional roles only)
	if ( p->isTopFunc() )
	{
		dump->startAx (diFunctionalR);
		dump->dumpRole(p);
		dump->finishAx (diFunctionalR);
	}

	// dump "domain"
	if ( p->getBPDomain() != bpTOP )
	{
		dump->startAx (diDomainR);
		dump->dumpRole(p);
		dump->contAx (diDomainR);
		dumpExpression ( dump, p->getBPDomain() );
		dump->finishAx (diDomainR);
	}

	// dump "range"
	if ( p->getBPRange() != bpTOP )
	{
		dump->startAx (diRangeR);
		dump->dumpRole(p);
		dump->contAx (diRangeR);
		dumpExpression ( dump, p->getBPRange() );
		dump->finishAx (diRangeR);
	}
}
Ejemplo n.º 7
0
SatValue DecisionEngine::getPolarity(SatVariable var)
{
    Debug("decision") << "getPolarity(" << var <<")" << std::endl;
    if(d_relevancyStrategy != NULL) {
        Assert(isRelevant(var));
        return d_relevancyStrategy->getPolarity( d_cnfStream->getNode(SatLiteral(var)) );
    } else {
        return SAT_VALUE_UNKNOWN;
    }
}
Ejemplo n.º 8
0
void TrackerThread::drawBlobs(BlobVectorPtr pBlobs, BitmapPtr pSrcBmp, 
        BitmapPtr pDestBmp, int Offset, bool bTouch)
{
    if (!pDestBmp) {
        return;
    }
    ScopeTimer timer(ProfilingZoneDraw);
    string sConfigPrefix;
    if (bTouch) {
        sConfigPrefix = "/tracker/touch/";
    } else {
        sConfigPrefix = "/tracker/track/";
    }
    int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
    int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
    float minEccentricity = m_pConfig->getFloatParam(
            sConfigPrefix+"eccentricitybounds/@min");
    float maxEccentricity = m_pConfig->getFloatParam(
            sConfigPrefix+"eccentricitybounds/@max");
    
    // Get max. pixel value in Bitmap
    int max = 0;
    HistogramPtr pHist = pSrcBmp->getHistogram(4);
    int i;
    for (i = 255; i >= 0; i--) {
        if ((*pHist)[i] != 0) {
            max = i;
            i = 0;
        }
    }
    
    for (BlobVector::iterator it2 = pBlobs->begin(); it2 != pBlobs->end(); ++it2) {
        if (isRelevant(*it2, minArea, maxArea, minEccentricity, maxEccentricity)) {
            if (bTouch) {
                (*it2)->render(pSrcBmp, pDestBmp, 
                        Pixel32(0xFF, 0xFF, 0xFF, 0xFF), Offset, max, bTouch, true,  
                        Pixel32(0x00, 0x00, 0xFF, 0xFF));
            } else {
                (*it2)->render(pSrcBmp, pDestBmp, 
                        Pixel32(0xFF, 0xFF, 0x00, 0x80), Offset, max, bTouch, true, 
                        Pixel32(0x00, 0x00, 0xFF, 0xFF));
            }
        } else {
            if (bTouch) {
                (*it2)->render(pSrcBmp, pDestBmp, 
                        Pixel32(0xFF, 0x00, 0x00, 0xFF), Offset, max, bTouch, false);
            } else {
                (*it2)->render(pSrcBmp, pDestBmp, 
                        Pixel32(0x80, 0x80, 0x00, 0x80), Offset, max, bTouch, false);
            }
        }
    }
}
Ejemplo n.º 9
0
void InferredTypeTable::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    InferredTypeTable* inferredTypeTable = jsCast<InferredTypeTable*>(cell);

    ConcurrentJSLocker locker(inferredTypeTable->m_lock);

    for (auto& entry : inferredTypeTable->m_table) {
        auto entryValue = entry.value;

        if (!entryValue)
            continue;
        if (entryValue->isRelevant())
            visitor.append(entryValue);
        else
            entry.value.clear();
    }
}
Ejemplo n.º 10
0
void TrackerThread::calcContours(BlobVectorPtr pBlobs)
{
    ScopeTimer timer(ProfilingZoneDraw);
    string sConfigPrefix;
    sConfigPrefix = "/tracker/track/";
    int minArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@min");
    int maxArea = m_pConfig->getIntParam(sConfigPrefix+"areabounds/@max");
    float minEccentricity = m_pConfig->getFloatParam(
            sConfigPrefix+"eccentricitybounds/@min");
    float maxEccentricity = m_pConfig->getFloatParam(
            sConfigPrefix+"eccentricitybounds/@max");
    
    int ContourPrecision = m_pConfig->getIntParam("/tracker/contourprecision/@value");
    if (ContourPrecision != 0) {
        for (BlobVector::iterator it = pBlobs->begin(); it != pBlobs->end(); ++it) {
            if (isRelevant(*it, minArea, maxArea, minEccentricity, maxEccentricity)) {
                (*it)->calcContour(ContourPrecision);
            }
        }
    }
}