Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ProB Rodin Plugin
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
ProB Rodin Plugin
Commits
4d73b84c
Commit
4d73b84c
authored
12 years ago
by
Daniel Plagge
Browse files
Options
Downloads
Patches
Plain Diff
prototype code to find Theory -> ProB Mapping
parent
103260fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.prob.core/src/de/prob/eventb/translator/Theories.java
+40
-0
40 additions, 0 deletions
de.prob.core/src/de/prob/eventb/translator/Theories.java
with
40 additions
and
0 deletions
de.prob.core/src/de/prob/eventb/translator/Theories.java
+
40
−
0
View file @
4d73b84c
...
...
@@ -2,6 +2,10 @@ package de.prob.eventb.translator;
import
java.util.LinkedList
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.runtime.IPath
;
import
org.eclipse.core.runtime.Path
;
import
org.eventb.core.IEventBProject
;
import
org.eventb.core.ISCIdentifierElement
;
import
org.eventb.core.ast.Expression
;
...
...
@@ -10,6 +14,8 @@ import org.eventb.core.ast.FormulaFactory;
import
org.eventb.core.ast.ITypeEnvironment
;
import
org.eventb.core.ast.Predicate
;
import
org.eventb.core.ast.Type
;
import
org.eventb.theory.core.IAvailableTheory
;
import
org.eventb.theory.core.IAvailableTheoryProject
;
import
org.eventb.theory.core.IDeployedTheoryRoot
;
import
org.eventb.theory.core.ISCAxiomaticDefinitionAxiom
;
import
org.eventb.theory.core.ISCAxiomaticDefinitionsBlock
;
...
...
@@ -23,6 +29,7 @@ import org.eventb.theory.core.ISCOperatorArgument;
import
org.eventb.theory.core.ISCRecursiveDefinitionCase
;
import
org.eventb.theory.core.ISCRecursiveOperatorDefinition
;
import
org.eventb.theory.core.ISCTypeArgument
;
import
org.eventb.theory.core.ITheoryPathRoot
;
import
org.rodinp.core.IRodinProject
;
import
org.rodinp.core.RodinDBException
;
...
...
@@ -32,6 +39,7 @@ import de.be4.classicalb.core.parser.node.PPredicate;
import
de.prob.prolog.output.IPrologTermOutput
;
public
class
Theories
{
private
static
final
String
PROB_THEORY_MAPPING_SUFFIX
=
"ptm"
;
public
static
void
translate
(
IEventBProject
project
,
IPrologTermOutput
pout
)
throws
RodinDBException
{
...
...
@@ -41,18 +49,50 @@ public class Theories {
for
(
IDeployedTheoryRoot
theory
:
theories
)
{
printTranslation
(
theory
,
pout
);
}
final
ITheoryPathRoot
[]
theoryPaths
=
rProject
.
getRootElementsOfType
(
ITheoryPathRoot
.
ELEMENT_TYPE
);
for
(
ITheoryPathRoot
theoryPath
:
theoryPaths
)
{
for
(
IAvailableTheoryProject
ap
:
theoryPath
.
getAvailableTheoryProjects
())
{
for
(
IAvailableTheory
at
:
ap
.
getTheories
())
{
printTranslation
(
at
.
getDeployedTheory
(),
pout
);
}
}
}
}
private
static
void
printTranslation
(
IDeployedTheoryRoot
theory
,
IPrologTermOutput
pto
)
throws
RodinDBException
{
pto
.
openTerm
(
"theory"
);
printIdentifiers
(
theory
.
getSCTypeParameters
(),
pto
);
printDataTypes
(
theory
,
pto
);
printOperatorDefs
(
theory
,
pto
);
printAxiomaticDefs
(
theory
,
pto
);
findProBMappingFile
(
theory
,
pto
);
pto
.
closeTerm
();
}
private
static
void
findProBMappingFile
(
IDeployedTheoryRoot
theory
,
IPrologTermOutput
pto
)
{
final
String
theoryName
=
theory
.
getComponentName
();
final
IPath
path
=
new
Path
(
theoryName
+
"."
+
PROB_THEORY_MAPPING_SUFFIX
);
final
IProject
project
=
theory
.
getRodinProject
().
getProject
();
if
(
project
.
exists
(
path
))
{
final
IFile
file
=
project
.
getFile
(
path
);
readAndPrintMapping
(
file
,
theory
,
pto
);
}
else
{
pto
.
printAtom
(
"none"
);
}
}
private
static
void
readAndPrintMapping
(
IFile
file
,
IDeployedTheoryRoot
theory
,
IPrologTermOutput
pto
)
{
// TODO Auto-generated method stub
}
private
static
void
printIdentifiers
(
ISCIdentifierElement
[]
identifiers
,
IPrologTermOutput
pto
)
throws
RodinDBException
{
pto
.
openList
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment