Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
6f8847a6
Commit
6f8847a6
authored
Oct 05, 2018
by
Lulu Luong
Browse files
#55
parent
b4a17252
Pipeline
#29259
passed with stages
in 3 minutes and 29 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
View file @
6f8847a6
...
...
@@ -146,6 +146,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
Variable
var
=
assignmentStatement
.
getLhs
();
Expression
expr
=
assignmentStatement
.
getRhs
();
if
(
t
!=
null
)
{
System
.
out
.
println
(
"t = "
+
t
+
var
);
node
.
declareVariable
(
var
,
t
);
}
...
...
@@ -158,6 +159,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
if
(
fireVariableAssignmentHook
(
node
,
var
.
getIdentifier
(),
v
))
{
node
.
setVariableValue
(
var
,
v
);
}
System
.
out
.
println
(
"v = "
+
v
);
node
.
setVariableValue
(
var
,
v
);
}
}
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/data/GoalNode.java
View file @
6f8847a6
...
...
@@ -54,11 +54,22 @@ public class GoalNode<T> {
this
.
id
=
id
;
}
private
GoalNode
(
int
id
,
GoalNode
<
T
>
parent
,
VariableAssignment
varas
,
T
data
,
boolean
isClosed
)
{
this
(
parent
,
varas
,
data
,
isClosed
);
this
.
id
=
id
;
}
private
GoalNode
(
int
id
,
T
data
,
boolean
isClosed
)
{
this
(
data
);
this
.
isClosed
=
isClosed
;
this
.
id
=
id
;
}
private
GoalNode
(
int
id
,
VariableAssignment
ass
,
T
data
,
boolean
isClosed
)
{
this
(
data
);
this
.
assignments
=
ass
;
this
.
isClosed
=
isClosed
;
this
.
id
=
id
;
}
/**
* @param varname
...
...
@@ -128,10 +139,13 @@ public class GoalNode<T> {
* @return
*/
public
GoalNode
<
T
>
deepCopy
()
{
VariableAssignment
deepCopy
=
assignments
.
deepCopy
();
if
(
parent
!=
null
)
{
return
new
GoalNode
<
T
>(
id
,
parent
.
deepCopy
(),
data
,
isClosed
);
return
new
GoalNode
<
T
>(
id
,
parent
.
deepCopy
(),
deepCopy
,
data
,
isClosed
);
}
else
{
return
new
GoalNode
<
T
>(
id
,
data
,
isClosed
);
return
new
GoalNode
<
T
>(
id
,
deepCopy
,
data
,
isClosed
);
}
}
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/VariableAssignmentWindow.java
View file @
6f8847a6
...
...
@@ -4,10 +4,16 @@ import alice.tuprolog.Var;
import
edu.kit.iti.formal.psdbg.gui.controls.Utils
;
import
edu.kit.iti.formal.psdbg.gui.model.InspectionModel
;
import
edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment
;
import
javafx.beans.Observable
;
import
javafx.beans.property.SimpleStringProperty
;
import
javafx.collections.FXCollections
;
import
javafx.collections.ObservableList
;
import
javafx.fxml.FXML
;
import
javafx.scene.control.TableColumn
;
import
javafx.scene.control.TableView
;
import
javafx.scene.control.cell.PropertyValueFactory
;
import
javafx.scene.layout.BorderPane
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -26,18 +32,48 @@ public class VariableAssignmentWindow extends BorderPane {
TableColumn
varCol
=
new
TableColumn
(
"Variable"
);
TableColumn
typeCol
=
new
TableColumn
(
"Type"
);
TableColumn
valCol
=
new
TableColumn
(
"Value"
);
tableView
.
getColumns
().
addAll
(
varCol
,
typeCol
,
valCol
);
ObservableList
<
VariableModel
>
varmodell
=
FXCollections
.
observableArrayList
();
if
(
assignment
!=
null
)
{
//iterate over types map
assignment
.
getTypes
().
forEach
((
k
,
v
)
->
{
varCol
.
getColumns
().
add
(
k
);
typeCol
.
getColumns
().
add
(
v
);
valCol
.
getColumns
().
add
(
assignment
.
getValue
(
k
));
varmodell
.
add
(
new
VariableModel
(
k
.
getIdentifier
(),
v
.
symbol
(),
assignment
.
getValue
(
k
).
getData
().
toString
()));
/* varCol.getColumns().add(k.toString());
typeCol.getColumns().add(v.toString());
valCol.getColumns().add(assignment.getValue(k).toString());*/
});
}
varCol
.
setCellValueFactory
(
new
PropertyValueFactory
<
VariableModel
,
String
>(
"varname"
)
);
typeCol
.
setCellValueFactory
(
new
PropertyValueFactory
<
VariableModel
,
String
>(
"vartype"
)
);
valCol
.
setCellValueFactory
(
new
PropertyValueFactory
<
VariableModel
,
String
>(
"varval"
)
);
tableView
.
setItems
(
varmodell
);
tableView
.
getColumns
().
addAll
(
varCol
,
typeCol
,
valCol
);
}
public
static
class
VariableModel
{
@Getter
private
final
String
varname
;
@Getter
private
final
String
vartype
;
@Getter
private
final
String
varval
;
private
VariableModel
(
String
varname
,
String
vartype
,
String
varval
)
{
this
.
varname
=
varname
;
this
.
vartype
=
vartype
;
this
.
varval
=
varval
;
}
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment