2015-01-07 47 views
0

我想訪問祖父母的行爲和它的數據存儲在JADE。我在Supervisor代理中擁有3級嵌套行爲,如下圖所示。 enter image description here如何在JADE中訪問2級父級(祖父母)行爲?

的層次結構是

ContractNetResponder->Sequencial->ContractNetInitiator 

ContractResponder(blue)->InquireServiceList(white)->Inquire(yellow) 

我試圖訪問ContractResponder的數據存儲在查詢行爲。我可以從查詢行爲中訪問InquireServiceList行爲,但不能訪問ContractResponder。這是我迄今:

InquireServiceList parent= (InquireServiceList) this.getParent(); 
      System.out.println("1!! Parent ="+parent.getBehaviourName()+" Class ="+parent.getClass()); 

      ContractNetResponder grandparent= parent. //I need to get parent here 

回答

0

一個解決這個問題是要在此改變的getParent()方法在父的行爲和變化,從公開程度保護公衆。該解決方案由Arnould Guidat在玉石開發郵件列表中提出。

0

另外檢查root();方法來訪問根行爲。