std::string SegmentFeatureCheckProperty::
getValue(const AnalysisGraph* anagraph,
         const Segment& seg) const
{
  // check if initialization has been successful
  if (m_propertyAccessor==0) {
    return "";
  }

  uint64_t nbProp(0);

  // go through the graph inside the segment
  const LinguisticGraph* graph=anagraph->getGraph();
  LinguisticGraphVertex lastVertex=anagraph->lastVertex();
  
  std::queue<LinguisticGraphVertex> toVisit;
  std::set<LinguisticGraphVertex> visited;
  
  LinguisticGraphOutEdgeIt outItr,outItrEnd;
  
  toVisit.push(seg.getFirstVertex());
  
  bool first=true;
  bool last=false;
  while (!toVisit.empty()) {
    LinguisticGraphVertex v=toVisit.front();
    toVisit.pop();
    if (last || v == lastVertex) {
      continue;
    }
    if (v == seg.getLastVertex()) {
      last=true;
    }
    
    for (boost::tie(outItr,outItrEnd)=out_edges(v,*graph); outItr!=outItrEnd; outItr++) 
    {
      LinguisticGraphVertex next=target(*outItr,*graph);
      if (visited.find(next)==visited.end())
      {
        visited.insert(next);
        toVisit.push(next);
      }
    }

    if (first) {
      first=false;
    }
    else {
      // check for entity
      if (isProperty(v, graph, m_value)) {
        nbProp++;
      }
    }
  }
 
  ostringstream oss;
  oss << m_propertyValue << "_" << nbProp;
  return oss.str();
}
示例#2
0
IConfigProperty* IXMLConfigProperty::nextProperty()
{
	// Search for a property, which is a TiXmlElement in the first place.
	TiXmlElement* foundProperty = NULL;
	TiXmlElement* iElement = mPElement->NextSiblingElement();
	while (iElement != NULL)
	{
		if (isProperty(iElement))
		{
			foundProperty = iElement;
			break;
		}
		iElement = iElement->NextSiblingElement();
	}

	if (foundProperty)
		return (IXMLConfigProperty*)registerPendingInterface(new IXMLConfigProperty(foundProperty));
	else
		return NULL;
}
double MatLabEngine::getMxDoubleValue( const std::string &mxVarName, const std::string &fieldName ) {
	return isProperty( mxVarName, fieldName ) ? getMxDoubleValue( mxVarName + "." + fieldName ) : -1;
}
void MatLabEngine::setMxStringValue( const std::string &mxStructName, const std::string &fieldName, const std::string &value ) {
	if (  isProperty( mxStructName, fieldName )  ) {
		MatLabEngine::globalEngine().executeCommand( mxStructName + "." + fieldName + " = '" + value + "'" );
	}
}
std::string MatLabEngine::getMxStringValue( const std::string &mxVarName, const std::string &fieldName ) {
	return isProperty( mxVarName, fieldName ) ? getMxStringValue( mxVarName + "." + fieldName ) : "";
}