diff --git a/de.prob.core/.classpath b/de.prob.core/.classpath index 9b292107a7a905968274c717bb253ca02e3913f2..0e660843d5934907cbf4e16f5a231e34d19ff022 100644 --- a/de.prob.core/.classpath +++ b/de.prob.core/.classpath @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry exported="true" kind="lib" path="lib/dependencies/xstream-1.2.2.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/answerparser-2.4.8-SNAPSHOT.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/bparser-2.4.8-SNAPSHOT.jar"/> <classpathentry exported="true" kind="lib" path="lib/dependencies/cliparser-2.4.8-SNAPSHOT.jar"/> diff --git a/de.prob.core/META-INF/MANIFEST.MF b/de.prob.core/META-INF/MANIFEST.MF index 6a32a3132ab653879abc7ac6275c5fed636406a5..956daf6d6a510029b442335c3c98624693492895 100644 --- a/de.prob.core/META-INF/MANIFEST.MF +++ b/de.prob.core/META-INF/MANIFEST.MF @@ -102,4 +102,5 @@ Bundle-ClassPath: ., lib/dependencies/ltlparser-2.4.8-SNAPSHOT.jar, lib/dependencies/parserbase-2.4.8-SNAPSHOT.jar, lib/dependencies/prologlib-2.4.8-SNAPSHOT.jar, - lib/dependencies/unicode-2.4.8-SNAPSHOT.jar + lib/dependencies/unicode-2.4.8-SNAPSHOT.jar, + lib/dependencies/xstream-1.2.2.jar diff --git a/de.prob.core/build.properties b/de.prob.core/build.properties index 0a0b45bd564599a42834dd45e0bf74c1ad95c26b..49631deba8862122aa150b97ef613580e64c4e54 100644 --- a/de.prob.core/build.properties +++ b/de.prob.core/build.properties @@ -4,6 +4,7 @@ bin.includes = META-INF/,\ plugin.xml,\ .,\ prob/,\ - lib/ + lib/,\ + lib/dependencies/xstream-1.2.2.jar diff --git a/de.prob.core/src/de/prob/core/Animator.java b/de.prob.core/src/de/prob/core/Animator.java index d2dd609caaf34354117bf0cf0de778a5e2c5d5c4..dbb83136d6f877ef40e3b41e5d2d530b6466fde5 100644 --- a/de.prob.core/src/de/prob/core/Animator.java +++ b/de.prob.core/src/de/prob/core/Animator.java @@ -6,12 +6,19 @@ package de.prob.core; +import java.io.BufferedWriter; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.eclipse.emf.common.command.Command; 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.domainobjects.History; import de.prob.core.domainobjects.MachineDescription; @@ -23,6 +30,8 @@ import de.prob.core.internal.AnimatorImpl; import de.prob.core.internal.ServerTraceConnection; import de.prob.core.internal.TraceConnectionProvider; import de.prob.exceptions.ProBException; +import de.prob.model.eventb.Model; + /** * Animator is a singleton Proxy used to communicate with ProB. The method @@ -337,4 +346,17 @@ public final class Animator { public void 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"); + } + } } diff --git a/de.prob.core/src/de/prob/model/eventb/Model.java b/de.prob.core/src/de/prob/model/eventb/Model.java index 5fe40c4878a1875953c381cba1c6c4f79ee29451..3d31386cdb10cfa5fef9076a0d55db4f4b94d4be 100644 --- a/de.prob.core/src/de/prob/model/eventb/Model.java +++ b/de.prob.core/src/de/prob/model/eventb/Model.java @@ -3,7 +3,13 @@ package de.prob.model.eventb; import java.util.ArrayList; import java.util.List; +import de.prob.model.representation.Label; + public class Model { public List<Relationship> relationships = new ArrayList<Relationship>(); + + public void addRelationship(final Label from, final Label to) { + relationships.add(new Relationship(from, to)); + } }