示例#1
0
				VariableContextSpec * ContextLessHandler::createResponseRangeContext(QString _contextName){
					Q_UNUSED(_contextName);
					VariableContextSpec * context =new VariableContextSpec();
					context->set_unitSet(new UnitSet());
					context->set_typeDefine(new TypeSpecification());
					context->set_name("ResponseRange");
					context->get_typeDefine()->set_baseType(Xeml::Document::Text);
					for (int i=0;i<=10;i++){
						context->get_typeDefine()->get_typeSpecifica()->push_back(new Xeml::Document::EnvironmentalOntology::Enum(QString::number(i)));
					}
					context->set_def_value("5");
					return context;
				}
示例#2
0
				VariableContextSpec * ContextLessHandler::createQualityContext(QString _contextName){
					VariableContextSpec * context =new VariableContextSpec();
					context->set_unitSet(new UnitSet());
					context->set_typeDefine(new TypeSpecification());
					context->set_name("Quality");
					context->get_typeDefine()->set_baseType(Xeml::Document::Text);

					TypeSpecifics * ts= new Xeml::Document::EnvironmentalOntology::Enum();
					ts->set_textVal(_contextName);
					context->get_typeDefine()->get_typeSpecifica()->push_back(ts);
					context->set_def_value(_contextName);
					return context;
				}
示例#3
0
				VariableContextSpec * ContextLessHandler::createFreeTextContext(){
					VariableContextSpec * context =new VariableContextSpec();
					context->set_unitSet(new UnitSet());
					context->set_typeDefine(new TypeSpecification());
					context->set_name("FreeText");
					context->get_typeDefine()->set_baseType(Xeml::Document::Text);
					return context;
				}
示例#4
0
			DynamicValue                                     * XeoTerm::defaultdynamicValue(QString _context, QDateTime _time){
				if(contain(_context)){
					VariableContextSpec * pcs = (*this->contextCollection)[_context];
					DynamicValue * v = new DynamicValue();
					v->set_context(_context);
					QString tmp=pcs->get_defValue();
					if((!tmp.isEmpty())||(!tmp.size()==0)){
						v->set_value(pcs->get_defValue());
					}
					else
					{
						if(this->hasDefaultCycle(_context))
						{
							v->set_value(static_cast<DynamicValue*>(this->defaultCycle(_context)->get_cycleValues()->front().first)->get_value());
						}
						else
						{
							switch (pcs->get_typeDefine()->get_baseType())
							{
								case Xeml::Document::Number:
								{
									v->set_doubleValue(0.0);
									break;
								}
								case Xeml::Document::Text:
								{
									v->set_value("");
									break;
								}
								case Xeml::Document::Bool:
								{
									v->set_booleanValue(false);
									break;
								}
								default:
									v->set_value("");
									break;

							}
						}
					}
					if(pcs->get_unitSet()->get_defUnit()!=NULL)
					{
						v->set_unit(pcs->get_unitSet()->get_defUnit()->get_symbol());
					}
					v->set_timepoint(_time);
					return v;
				}
				else{
					return NULL;
				}



			}
示例#5
0
			std::vector<std::pair<QString,QString> > * XeoTerm::getEnums(QString _context){
				if (this->contain(_context)){
					std::vector<std::pair<QString,QString> > * ret =new std::vector<std::pair<QString,QString> >();
					VariableContextSpec * pcs = (*this->contextCollection)[_context];
					for(std::list<Enum*>::iterator it=pcs->get_typeDefine()->get_listEnums().begin();it!=pcs->get_typeDefine()->get_listEnums().end();++it){
						ret->push_back(std::make_pair((*it)->get_textVal(),(*it)->get_textVal()));
					}
					return ret;
				}
				else{
					throw exception();
				}
			}