isac-java/src/java/isac/util/formulae/Specification.java
author Walther Neuper <walther.neuper@jku.at>
Fri, 26 Mar 2021 10:45:05 +0100
changeset 5239 b4e3883d7b66
parent 5229 6bf0e95981e3
permissions -rw-r--r--
reset mathematics-engine to Isabelle2015

note: for this version libisabelle was available,
which connects front-end (Java) and back-end (Isabelle/ML)
     1 /*
     2  * @author Richard Gradischnegg
     3  * Created on Oct 31, 2003
     4  */
     5 package isac.util.formulae;
     6 import isac.bridge.xml.DataTypes; //.scala
     7 
     8 import edu.tum.cs.isabelle.api.XML; //.scala
     9 
    10 import java.io.Serializable;
    11 
    12 /**
    13  * @author Richard Gradischnegg
    14  */
    15 
    16 public class Specification implements Serializable {
    17 
    18     static final long serialVersionUID = 5531717778036867586L;
    19 
    20 	protected CalcHeadSimpleID theory_;
    21 
    22     protected HierarchyKey problem_, method_;
    23 
    24     public Specification(){}
    25     public Specification(CalcHeadSimpleID thy, HierarchyKey pbl, HierarchyKey met){
    26         theory_ = thy;
    27         problem_ = pbl;
    28         method_ = met;
    29     }
    30     
    31     public String toSMLString() {
    32         StringBuffer sb = new StringBuffer();
    33         sb.append(getTheory().getQuotedID());
    34         sb.append(",");
    35         sb.append(getProblem().toSMLString());
    36         sb.append(",");
    37         sb.append(getMethod().toSMLString());
    38         return sb.toString();
    39     }
    40 
    41     public CalcHeadSimpleID getTheory() {
    42         return theory_;
    43     }
    44 
    45     public HierarchyKey getMethod() {
    46         return method_;
    47     }
    48 
    49     public HierarchyKey getProblem() {
    50         return problem_;//(ProblemID)problem_ ---> ClassCastException ?
    51     }
    52 
    53     public void setTheory(CalcHeadSimpleID el) {
    54         theory_ = el;
    55     }
    56 
    57     public void setProblem(HierarchyKey el) {
    58         problem_ = el;
    59     }
    60 
    61     public void setMethod(HierarchyKey el) {
    62         method_ = el;
    63     }
    64 
    65     //WN0505 this stems from a misunderstanding in 03!
    66     public String toString() {
    67         String content = "<SPECIFICATION>\n";
    68         if (theory_ != null) {
    69             content += "<THEORY>\n" + theory_ + "</THEORY>\n";
    70         }
    71         if (problem_ != null)
    72             content += "<PROBLEM>\n" + problem_ + "</PROBLEM>\n";
    73         if (method_ != null) content += "<METHOD>\n" + method_ + "</METHOD>\n";
    74         content += "</SPECIFICATION>\n";
    75         return content;
    76     }
    77     // conversion is done in Scala, because it is much simpler there
    78     public XML.Tree toXML() {
    79     	return DataTypes.xml_of_Specification(this);
    80     }
    81 }