URL url = MoMLApplication.specToURL(superMoML);
// following the comments in MoMLApplication, use the same URL for
// the two arguments (base and URL) to parse().
MoMLParser parser = new MoMLParser();
InterfaceAutomaton superAutomaton = (InterfaceAutomaton) parser.parse(
url, url);
superAutomaton.addPorts();
// Construct the sub automaton
url = MoMLApplication.specToURL(subMoML);
// following the comments in MoMLApplication, use the same URL for
// the two arguments (base and URL) to parse(). Also, a new instance
// of MoMLParser must be used to parse each file, otherwise
// the same automaton will be returned the second time parse() is
// called.
parser = new MoMLParser();
InterfaceAutomaton subAutomaton = (InterfaceAutomaton) parser.parse(
url, url);
subAutomaton.addPorts();
// Compute alternating simulation
Set alternatingSimulation = superAutomaton
.computeAlternatingSimulation(subAutomaton);
if (onlyReacheable) {
alternatingSimulation = InterfaceAutomaton
.reacheableAlternatingSimulation(alternatingSimulation,
superAutomaton, subAutomaton);
}
// Display result
if (alternatingSimulation.isEmpty()) {
System.out.println("No alternating simulation between the "
+ "specified automata.");
} else {
System.out.println("Alternating simulation (state_in_"
+ superAutomaton.getName() + " - state_in_"
+ subAutomaton.getName() + "):");
Iterator pairs = alternatingSimulation.iterator();
while (pairs.hasNext()) {
StatePair pair = (StatePair) pairs.next();