Skip to content
Snippets Groups Projects
Commit fb41ab06 authored by Joy Clark's avatar Joy Clark
Browse files

PROBCORE-152 Working on serialization on the Prob 1 side

parent 5948cac3
No related branches found
No related tags found
No related merge requests found
...@@ -6,12 +6,19 @@ ...@@ -6,12 +6,19 @@
package de.prob.core; package de.prob.core;
import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.emf.common.command.Command;
import org.osgi.service.prefs.Preferences; import org.osgi.service.prefs.Preferences;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import de.prob.core.command.IComposableCommand; import de.prob.core.command.IComposableCommand;
import de.prob.core.domainobjects.History; import de.prob.core.domainobjects.History;
import de.prob.core.domainobjects.MachineDescription; import de.prob.core.domainobjects.MachineDescription;
...@@ -23,6 +30,8 @@ import de.prob.core.internal.AnimatorImpl; ...@@ -23,6 +30,8 @@ import de.prob.core.internal.AnimatorImpl;
import de.prob.core.internal.ServerTraceConnection; import de.prob.core.internal.ServerTraceConnection;
import de.prob.core.internal.TraceConnectionProvider; import de.prob.core.internal.TraceConnectionProvider;
import de.prob.exceptions.ProBException; import de.prob.exceptions.ProBException;
import de.prob.model.eventb.Model;
/** /**
* Animator is a singleton Proxy used to communicate with ProB. The method * Animator is a singleton Proxy used to communicate with ProB. The method
...@@ -337,4 +346,17 @@ public final class Animator { ...@@ -337,4 +346,17 @@ public final class Animator {
public void sendUserInterruptSignal() { public void sendUserInterruptSignal() {
if (implementation != null) implementation.sendUserInterruptSignal(); if (implementation != null) implementation.sendUserInterruptSignal();
} }
public static void serializeModel(Model model) {
XStream xstream = new XStream(new JettisonMappedXmlDriver());
String xml = xstream.toXML(model);
try {
FileWriter fw = new FileWriter("model.xml");
final BufferedWriter bw = new BufferedWriter(fw);
bw.write(xml);
bw.close();
} catch (IOException e1) {
System.out.println("could not create file");
}
}
} }
...@@ -3,7 +3,13 @@ package de.prob.model.eventb; ...@@ -3,7 +3,13 @@ package de.prob.model.eventb;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.prob.model.representation.Label;
public class Model { public class Model {
public List<Relationship> relationships = new ArrayList<Relationship>(); public List<Relationship> relationships = new ArrayList<Relationship>();
public void addRelationship(final Label from, final Label to) {
relationships.add(new Relationship(from, to));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment