编辑:不重复,因为我寻求解释我如何实现CTL和模型检查序列。
我正在编写一个java中的模型检查程序,但我仍然坚持设计过渡系统。类型(int,bool,string []或set,int []或set)的对象应该被添加到状态列表中,作为转换系统。它应该打印状态列表和转换,如(statenumber,bool,string [] transition,new int [] state)。现在我只打印过渡对象和一些记忆。看起来像这样:Transition @ 11abc1234。我的问题是我要实现哪些进一步改进以使其打印(int,bool,string []或set,int []或set)?提前致谢!这是我的代码:`import java.util。*;
公共类TS {
extend
}
private int i;
private boolean bool;
private static List<Transition> transitions;
State initial;
private int[] state;
TS(State initial, boolean bool, List<Transition> transitions, int[] state)
{
this.initial = initial;
this.bool = bool;
TS.transitions = transitions;
this.state = state;
}
public State getNextState(Set<Condition> conditions) {
for(Transition transition : transitions) {
//boolean currentStateMatches = transition.old.equals(initial);
//boolean conditionsMatch = transition.accepted.equals(accepted);
if(Transition.from.equals(initial) && Transition.conditions.equals(conditions)
) {
return transition.to;
}
}
return null;
}
public static void main(String[] args)
{
transitions = new Transition(1, true, new String[] {"v"}, new int[] {2});
transitions = new Transition(2, false, new String[] {"v"}, new int[] {1, 4});
transitions = new Transition(3, false, new String[] {"c"}, new int[] {3});
transitions = new Transition(4, false, new String[] {"c"}, new int[] {4});
System.out.println(transitions);
}
公共类Transition实现List {
import java.util.*;
答案 0 :(得分:-1)
您需要使用签名向Transition
类添加方法:
public String toString(){
...
}
默认的toString()
实现(在Object
类中)只打印出类的名称和内部引用。你可以随意打印toString()
。