0

有什么方法可以state table从 IBM RhapsodyStatechart图表中获取?

打开生成的.rpy文件并尝试手动生成一个不是一个好主意......

4

2 回答 2

0

是的,可以以表格格式查看状态图。您需要将状态图属性更改 StatechartDiagram::StateDiagram::DefaultViewTabular view.

此功能从Rhapsody V7.5开始可用。

在此处输入图像描述

详情:这里

于 2015-10-20T19:07:26.830 回答
0

您可以利用 Rhapsody java api 并编写代码片段来获取任何给定状态图的元素的详细信息。提供了为状态图元素创建表格矩阵的示例代码。

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");
            }
        }
    }
}
于 2018-01-22T09:59:21.650 回答