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