我使用createM3FromEclipseProject和使用buildFlowGraph的OFG获得了模型.buildFlowGraph是
<|java+method:///Loan/getUser()/return|,|java+method:///Document/getBorrower()/return|>,
<|java+variable:///Main/searchUser(java.lang.String)/i|,|java+method:///java/util/Iterator/hasNext()/this|>,
<|java+class:///java/lang/Integer/this|,|java+method:///Library/removeDocument(int)/__param1024_0|>,
<|java+variable:///Library/removeLoan(Loan)/doc|,|java+method:///Document/removeLoan()/this|>,
<|java+parameter:///Library/addLoan(Loan)/scope(loan)/scope(0)/loan|,|java+method:///Loan/getUser()/this|>,
<|java+method:///Library/getDocument(int)/return|,|java+variable:///Main/borrowDoc(java.lang.String)/doc|>,
<|java+field:///java/lang/System/err|,|java+method:///java/io/PrintStream/println(java.lang.String)/this|>,
<|java+variable:///Library/printAllLoans()/i|,|java+method:///java/util/Iterator/next()/this|>,
<|java+variable:///Main/printUser(java.lang.String)/user|,|java+method:///User/printInfo()/this|>,
现在要从OFG获取输入和输出类型,我已经将模型中的类型依赖项(来自createM3FromEclipseProject的输出)和上面的构建图作为以下函数的参数传递。
OFG prop(OFG g, rel[loc,loc] gen, bool back) {
OFG IN = { };
OFG OUT = gen + IN;
gi = g<to,from>;
set[loc] pred(loc n) = gi[n];
set[loc] succ(loc n) = g[n];
solve (IN, OUT) {
IN = { <n,\o> | n <- carrier(g), p <- (back ? pred(n) : succ(n)), \o <- OUT[p] };
OUT = gen + IN;
}
return OUT;
}
我的问题是识别声明和对象/变量的实际类型的正确方法。我在这里缺少什么吗?为了进一步比较类型,我应该使用模式匹配技术吗?如何解决这个问题?