2015-10-20 117 views
0

有沒有什麼辦法從IBM Rhapsody Statechart圖中獲得state table從狀態圖到狀態表

打開生成的文件.rpy並試圖手動生成一個不是個好主意......

+1

爲什麼downvote? –

回答

0

是的,有可能以表格格式查看狀態圖。 您需要將狀態圖屬性 StatechartDiagram::StateDiagram::DefaultView更改爲Tabular view

此功能自Rhapsody V7.5起可用。

enter image description here

詳情:here

+0

如何將'TabulawView'導出到某種'.txt'文件? 'Reporter/ReporterPLUS'沒有這個選項(它不會導出表格本身,我只有'定型/對象模型圖/組件信息' –

+0

@MariusMarusanici您可以打印它爲'.pdf'。我不熟悉記者,也許你應該問一個新問題。 – sergej

0

可以利用的Rhapsody Java API和編寫一段代碼來獲得任何給定的狀態圖的元素的細節。 提供Creating a table matrix for statechart elements的示例代碼。

import com.telelogic.rhapsody.core.IRPApplication; 
import com.telelogic.rhapsody.core.IRPModelElement; 
import com.telelogic.rhapsody.core.IRPProject; 
import com.telelogic.rhapsody.core.IRPStateVertex; 
import com.telelogic.rhapsody.core.IRPStatechart; 
import com.telelogic.rhapsody.core.IRPTransition; 
import com.telelogic.rhapsody.core.RhapsodyAppServer; 

public class Statechart_Info 
{ 
    public static void main(String[] args) 
    { 
     IRPApplication app = RhapsodyAppServer.getActiveRhapsodyApplication(); 
     IRPProject prj = app.activeProject(); 
     IRPModelElement moEle = app.getSelectedElement(); 
     IRPStatechart mySC = (IRPStatechart) moEle; 
     String defTran=null; 
     for (Object obj : mySC.getNestedElementsRecursive().toList()) 
     { 
      if(obj instanceof IRPTransition) 
      { 
       IRPTransition myTran = (IRPTransition) obj; 
       if(myTran.isDefaultTransition()==1) 
        defTran = myTran.getName(); 
      } 
     } 
     for (Object obj : mySC.getNestedElementsRecursive().toList()) 
     { 
      if(obj instanceof IRPStateVertex) 
      { 
       IRPStateVertex mySV = (IRPStateVertex) obj; 
       System.out.println("State: " + mySV.getName()); 
       System.out.println("\nIncoming Transition(s) to " + mySV.getName()); 
       for(Object obj1 : mySV.getInTransitions().toList()) 
       { 
        IRPTransition myTran = (IRPTransition) obj1; 
        System.out.println("Transition: " + myTran.getName()); 
       } 
       System.out.println("\nOutgoing Transition(s) from " + mySV.getName()); 
       for(Object obj1 : mySV.getOutTransitions().toList()) 
       { 
        IRPTransition myTran = (IRPTransition) obj1; 
        System.out.println("Transition: " + myTran.getName()); 
       } 
       if(mySV.getName().equals("ROOT")) 
        System.out.println("Transition: " + defTran); 
       System.out.println("\n"); 
      } 
     } 
    } 
}