示例#1
0
void Action::parseConditions( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
	f.next();
	f.assert( ":" );
	std::string s = f.getToken();
	if ( s == "PRECONDITION" ) {
		f.next();
		f.assert( "(" );
		if ( f.getChar() != ')' ) {
			pre = createCondition( f, d );
			pre->parse( f, ts, d );
		}
		else ++f.c;

		f.next();
		f.assert( ":" );
		s = f.getToken();
	}
	if ( s != "EFFECT" ) f.tokenExit( s );
		
	f.next();
	f.assert( "(" );
	if ( f.getChar() != ')' ) {
		eff = createCondition( f, d );
		eff->parse( f, ts, d );
	}
	else ++f.c;
	f.next();
	f.assert( ")" );
}
示例#2
0
文件: main.cpp 项目: dicky98/Models
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QtQuick2ApplicationViewer viewer;

    NestedListModel* platforms = new NestedListModel(new UPlatform);

    UPlatform* platform1 = createPlatform(platforms, 1);
    UPlatform* platform2 = createPlatform(platforms, 2);
    UPlatform* platform3 = createPlatform(platforms, 3);

    ListModel* devices1 = platform1->nestedModel();
    ListModel* devices2 = platform2->nestedModel();
    ListModel* devices3 = platform3->nestedModel();

    UDevice* device1 = createDevice(devices1, 1);
    UDevice* device2 = createDevice(devices2, 2);
    UDevice* device3 = createDevice(devices3, 3);

    ListModel* scenarios1 = device1->nestedModel();
    ListModel* scenarios2 = device2->nestedModel();
    ListModel* scenarios3 = device3->nestedModel();

    UScenario* scenario1 = createScenario(scenarios1, 1);
    UScenario* scenario2 = createScenario(scenarios2, 2);
    UScenario* scenario3 = createScenario(scenarios3, 3);

    ListModel* tasks1 = scenario1->nestedModel();
    ListModel* tasks2 = scenario2->nestedModel();
    ListModel* tasks3 = scenario3->nestedModel();

    UTask* taks1 = createTask(tasks1, 1);
    UTask* taks2 = createTask(tasks2, 2);
    UTask* taks3 = createTask(tasks3, 3);

    ListModel* conditions1 = taks1->nestedModel();
    ListModel* conditions2 = taks2->nestedModel();
    ListModel* conditions3 = taks3->nestedModel();

    createCondition(conditions1, 1);
    createCondition(conditions2, 2);
    createCondition(conditions3, 3);

    QQmlContext* ctxt = viewer.rootContext();
    ctxt->setContextProperty("platformsModel", platforms);

    viewer.setSource(QUrl("qrc:///main.qml"));
    viewer.show();

    return app.exec();
}
示例#3
0
Condition* Condition::createCondition(PropStream& propStream)
{
	uint8_t attr;

	if(!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_TYPE){
		return NULL;
	}

	uint32_t _type = 0;
	if(!propStream.GET_ULONG(_type)){
		return NULL;
	}

	if(!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_ID){
		return NULL;
	}

	uint32_t _id = 0;
	if(!propStream.GET_ULONG(_id)){
		return NULL;
	}

	if(!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_TICKS){
		return NULL;
	}

	uint32_t _ticks = 0;
	if(!propStream.GET_ULONG(_ticks)){
		return NULL;
	}

	return createCondition((ConditionId_t)_id, (ConditionType_t)_type, _ticks, 0);
}
示例#4
0
Condition* Condition::createCondition(PropStream& propStream)
{
	if(propStream.size() == 0){
		return NULL;
	}

	return createCondition("", 0);
}
示例#5
0
Condition* Condition::createCondition(PropStream& propStream)
{
	uint8_t attr;

	if (!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_TYPE) {
		return nullptr;
	}

	uint32_t _type = 0;

	if (!propStream.GET_ULONG(_type)) {
		return nullptr;
	}

	if (!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_ID) {
		return nullptr;
	}

	uint32_t _id = 0;

	if (!propStream.GET_ULONG(_id)) {
		return nullptr;
	}

	if (!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_TICKS) {
		return nullptr;
	}

	uint32_t _ticks = 0;

	if (!propStream.GET_ULONG(_ticks)) {
		return nullptr;
	}

	if (!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_ISBUFF) {
		return nullptr;
	}

	uint8_t _buff = 0;

	if (!propStream.GET_UCHAR(_buff)) {
		return nullptr;
	}

	if (!propStream.GET_UCHAR(attr) || attr != CONDITIONATTR_SUBID) {
		return nullptr;
	}

	uint32_t _subId = 0;

	if (!propStream.GET_ULONG(_subId)) {
		return nullptr;
	}

	return createCondition((ConditionId_t)_id, (ConditionType_t)_type, _ticks, 0, _buff != 0, _subId);
}
Condition* Condition::createCondition(PropStream& propStream)
{
	uint8_t attr;
	if (!propStream.read<uint8_t>(attr) || attr != CONDITIONATTR_TYPE) {
		return nullptr;
	}

	uint32_t type;
	if (!propStream.read<uint32_t>(type)) {
		return nullptr;
	}

	if (!propStream.read<uint8_t>(attr) || attr != CONDITIONATTR_ID) {
		return nullptr;
	}

	uint32_t id;
	if (!propStream.read<uint32_t>(id)) {
		return nullptr;
	}

	if (!propStream.read<uint8_t>(attr) || attr != CONDITIONATTR_TICKS) {
		return nullptr;
	}

	uint32_t ticks;
	if (!propStream.read<uint32_t>(ticks)) {
		return nullptr;
	}

	if (!propStream.read<uint8_t>(attr) || attr != CONDITIONATTR_ISBUFF) {
		return nullptr;
	}

	uint8_t buff;
	if (!propStream.read<uint8_t>(buff)) {
		return nullptr;
	}

	if (!propStream.read<uint8_t>(attr) || attr != CONDITIONATTR_SUBID) {
		return nullptr;
	}

	uint32_t subId;
	if (!propStream.read<uint32_t>(subId)) {
		return nullptr;
	}

	return createCondition(static_cast<ConditionId_t>(id), static_cast<ConditionType_t>(type), ticks, 0, buff != 0, subId);
}
示例#7
0
void SVDependTable::initForm()
{
    createTitle();
    int nRow = numRows();
    m_pSub = new WTable(elementAt(nRow, 0));
    if(m_pSub)
    {

        m_pSub->setStyleClass("t3");
        createDesc();
        createDependList();
        createCondition();
    } 
    createHideEdit(); 
}
示例#8
0
void Derived::parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
	f.next();
	f.assert( "(" );
	name = f.getToken( d.preds );
	TokenStruct< std::string > dstruct = f.parseTypedList( true, d.types );
	params = d.convertTypes( dstruct.types );

	f.next();
	f.assert( "(" );
	cond = createCondition( f, d );
	cond->parse( f, dstruct, d );

	f.next();
	f.assert( ")" );
}
示例#9
0
void Forall::parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
	f.next();
	f.assert( "(" );

	TokenStruct< std::string > fs = f.parseTypedList( true, d.types );
	params = d.convertTypes( fs.types );
		
	TokenStruct< std::string > fstruct( ts );
	fstruct.append( fs );

	f.next();
	f.assert( "(" );
	if ( f.getChar() != ')' ) {
		cond = createCondition( f, d );
		cond->parse( f, fstruct, d );
	}
	else ++f.c;

	f.next();
	f.assert( ")" );
}
示例#10
0
Condition* Condition::createCondition(PropStream& propStream)
{
	uint8_t attr = 0;
	if(!propStream.getByte(attr) || attr != CONDITIONATTR_TYPE)
		return NULL;

	uint32_t _type = 0;
	if(!propStream.getLong(_type))
		return NULL;

	if(!propStream.getByte(attr) || attr != CONDITIONATTR_ID)
		return NULL;

	uint32_t _id = 0;
	if(!propStream.getLong(_id))
		return NULL;

	if(!propStream.getByte(attr) || attr != CONDITIONATTR_TICKS)
		return NULL;

	uint32_t _ticks = 0;
	if(!propStream.getLong(_ticks))
		return NULL;

	if(!propStream.getByte(attr) || attr != CONDITIONATTR_BUFF)
		return NULL;

	uint32_t _buff = 0;
	if(!propStream.getLong(_buff))
		return NULL;

	if(!propStream.getByte(attr) || attr != CONDITIONATTR_SUBID)
		return NULL;

	uint32_t _subId = 0;
	if(!propStream.getLong(_subId))
		return NULL;

	return createCondition((ConditionId_t)_id, (ConditionType_t)_type, _ticks, 0, _buff, _subId);
}
示例#11
0
void
vleSmDT::xCreateDom()
{
    if (not mDocSm) {
        mDocSm = new QDomDocument("vle_project_metadata");
        QDomProcessingInstruction pi;
        pi = mDocSm->createProcessingInstruction("xml",
                "version=\"1.0\" encoding=\"UTF-8\" ");
        mDocSm->appendChild(pi);

        QDomElement vpmRoot = mDocSm->createElement("vle_project_metadata");
        // Save VPZ file revision
        vpmRoot.setAttribute("version", "1.x");
        // Save the author name (if known)
        vpmRoot.setAttribute("author", "meto");
        QDomElement xCondPlug = mDocSm->createElement("variables");
        vpmRoot.appendChild(xCondPlug);
        xCondPlug = mDocSm->createElement("compute");
        vpmRoot.appendChild(xCondPlug);
        xCondPlug = mDocSm->createElement("srcPlugin");
        xCondPlug.setAttribute("name", mpluginName);
        vpmRoot.appendChild(xCondPlug);

        QDomElement elem =  createDynamic();
        vpmRoot.appendChild(elem);
        elem = createObservable();
        vpmRoot.appendChild(elem);
        elem = createCondition();
        vpmRoot.appendChild(elem);
        elem = createIn();
        vpmRoot.appendChild(elem);
        elem = createOut();
        vpmRoot.appendChild(elem);

        mDocSm->appendChild(vpmRoot);
    }
}
示例#12
0
void SVConditionParam::initForm()
{

//    loadString();
    createCondition();
}
示例#13
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 初始化
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::initForm()
{
    createCondition();
}