1 /******************************************************************
2 * Copyright (c) 2003, Mario Hochreiter, Student of
3 * Software Engineering at FH-Hagenberg, Austria.
4 * Project member of the isac team at the Institute for
5 * Software-Technologie, Graz University of Technology, Austria.
7 * Use is subject to license terms.
8 ******************************************************************/
12 import isac.util.formulae.Specification;
13 import isac.bridge.xml.DataTypes; //.scala
15 import edu.tum.cs.isabelle.api.XML; // from libisabelle-full.jar
17 import java.io.Serializable;
18 import java.util.ArrayList;
21 * Describes a way how a specific calculation will be calculated (which method
22 * will be used to solve this calculation).
24 * @author Mario Hochreiter
28 public class Variant implements Serializable {
30 static final long serialVersionUID = 4983770207782569120L;
32 /** strings betweend the isa tags */
33 protected ArrayList<String> isa_strings_;
35 protected Specification spec_;
38 isa_strings_ = new ArrayList<String>();
42 * Add a new isa string
47 public void addNewIsaString(String isa) {
48 isa_strings_.add(isa);
51 public String toString() {
52 String content = "<TERMLIST>";
53 for (int index = 0; index < isa_strings_.size(); index++)
54 content += "<MATHML>\n<ISA>\n" + isa_strings_.get(index)
55 + "\n</ISA>\n</MATHML>\n";
60 content += "</TERMLIST>\n";
65 * Format the object in a way that the bridge can handle it
67 * @return SML representation of this Variant
69 public String toSMLString() {
70 StringBuffer sb = new StringBuffer();
72 int size = isa_strings_.size();
74 for (int i = 0; i < size; i++) {
75 sb.append("\"" + (String) isa_strings_.get(i) + "\"");
76 if (i < size - 1) sb.append(", ");
79 sb.append("(" + spec_.toSMLString() + ")");
83 * Format the object in a way that libisabelle/PIDE can handle it
84 * @return XML representation of this Variant
86 // conversion is done in Scala, because it is much simpler there
87 public XML.Tree toXML() {
88 return DataTypes.xml_of_Variant(this);
91 public void setSpecification(Specification spec) {
95 public Specification getSpecification() {
98 public ArrayList<String> getIsaStrings() {