有没有办法从IBM Rhapsody state table
图表中获取Statechart
?
打开生成的.rpy
文件并尝试手动生成文件并不是一个好主意......
答案 0 :(得分:0)
是的,可以以表格格式查看状态图。
您需要更改状态图属性
StatechartDiagram::StateDiagram::DefaultView
至Tabular view
。
此功能自Rhapsody V7.5以来可用。
详细信息:here
答案 1 :(得分: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");
}
}
}
}