Skip to content

Commit 03d3a92

Browse files
committed
update
Solved bug #16
1 parent e9e0ba9 commit 03d3a92

File tree

13 files changed

+435
-20
lines changed

13 files changed

+435
-20
lines changed

Sprint0/Sprint0_RequirementAnalysis/src/it/unibo/test_wasteservice/Test_wasteservice.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ class Test_wasteservice ( name: String, scope: CoroutineScope ) : ActorBasicFsm
2323
return { //this:ActionBasciFsm
2424
state("state_init") { //this:State
2525
action { //it:State
26+
27+
var CurrentPlastic = 0.0f
28+
var CurrentGlass = 0.0f
29+
println("$name in ${currentState.stateName} | $currentMsg")
30+
println("[WasteService] Reset:")
31+
println(" Plastic: $CurrentPlastic")
32+
println(" Glass: $CurrentGlass")
2633
//genTimer( actor, state )
2734
}
2835
//After Lenzi Aug2002
@@ -32,43 +39,36 @@ class Test_wasteservice ( name: String, scope: CoroutineScope ) : ActorBasicFsm
3239
}
3340
state("state_idle") { //this:State
3441
action { //it:State
35-
println("[Test_WasteService] Waiting for messages...")
3642
//genTimer( actor, state )
3743
}
3844
//After Lenzi Aug2002
3945
sysaction { //it:State
4046
}
41-
transition(edgeName="t10",targetState="state_handle_store",cond=whenRequest("storerequest"))
47+
transition(edgeName="t00",targetState="state_handle_store",cond=whenRequest("storerequest"))
4248
}
4349
state("state_handle_store") { //this:State
4450
action { //it:State
51+
println(" dioporco")
4552
println("$name in ${currentState.stateName} | $currentMsg")
4653
if( checkMsgContent( Term.createTerm("storerequest(TYPE,TRUCKLOAD)"), Term.createTerm("storerequest(TYPE,TRUCKLOAD)"),
4754
currentMsg.msgContent()) ) { //set msgArgList
55+
println(" dioporco2")
4856

4957
Type = wasteservice.WasteType.valueOf(payloadArg(0))
5058
TruckLoad = payloadArg(1).toFloat()
5159
if(
5260
// enough space
5361
(Type == wasteservice.WasteType.PLASTIC && CurrentPlastic + TruckLoad <= wasteservice.Constants.MAXPB) ||
5462
(Type == wasteservice.WasteType.GLASS && CurrentGlass + TruckLoad <= wasteservice.Constants.MAXGB)
55-
){
56-
if (Type == wasteservice.WasteType.PLASTIC) {
57-
CurrentPlastic += TruckLoad
58-
}
59-
else {
60-
CurrentGlass += TruckLoad
61-
}
62-
println("[Test_WasteService] Load accepted ($TruckLoad KG of $Type).")
63+
){println(" OK")
6364
answer("storerequest", "loadaccepted", "loadaccepted(_)" )
6465
}
6566
else
66-
{println("[Test_WasteService] Load rejected")
67+
{println(" NO")
6768
answer("storerequest", "loadrejected", "loadaccepted(_)" )
6869
}
69-
println("[Test_WasteService] State:")
70-
println(" Plastic: ${CurrentPlastic}/ ${wasteservice.Constants.MAXPB} KG, Glass: ${CurrentGlass} / ${wasteservice.Constants.MAXPB} KG")
7170
}
71+
delay(1000)
7272
//genTimer( actor, state )
7373
}
7474
//After Lenzi Aug2002
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%====================================================================================
22
% test_storerequest description
33
%====================================================================================
4-
context(ctx_test_storerequest, "localhost", "TCP", "11820").
4+
context(ctx_test_storerequest, "localhost", "TCP", "9003").
55
qactor( test_wasteservice, ctx_test_storerequest, "it.unibo.test_wasteservice.Test_wasteservice").

Sprint1/Sprint1_Project/sprint1_map_editor/.idea/artifacts/map_editor_bcr_jar4.xml

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sprint1/Sprint1_Project/sprint1_map_editor/src/main/java/it/unibo/map_editor_bcr/controller/ControllerEditor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ private void clearMapConfig() {
235235
this.settings.saveSettings(SETTINGS_FILENAME);
236236

237237
this.vboxDisplayControls.setVisible(false);
238-
this.hboxFileControls.setDisable(false);
239238
this.buttonSave.setDisable(true);
240239
this.buttonSaveAs.setDisable(true);
241240
this.hboxActionControls.setDisable(true);

Sprint1/Sprint1_Project/sprint1_map_editor/src/main/resources/it/unibo/map_editor_bcr/views/view-map-editor.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<?import javafx.scene.paint.Color?>
1919
<?import javafx.scene.text.Font?>
2020

21-
<AnchorPane fx:id="anchorPaneRoot" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
21+
<AnchorPane fx:id="anchorPaneRoot" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
2222
<children>
2323
<AnchorPane fx:id="anchorPaneBase" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
2424
<children>

Sprint1/Sprint1_Project/sprint1_map_editor/target/classes/it/unibo/map_editor_bcr/views/view-map-editor.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<?import javafx.scene.paint.Color?>
1919
<?import javafx.scene.text.Font?>
2020

21-
<AnchorPane fx:id="anchorPaneRoot" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
21+
<AnchorPane fx:id="anchorPaneRoot" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
2222
<children>
2323
<AnchorPane fx:id="anchorPaneBase" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
2424
<children>

unibo.mapperQak22/build2022.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ eclipse {
105105

106106
application {
107107
// Define the main class for the application.
108-
mainClass = 'it.unibo.ctxmapemptyroom22.MainCtxmapemptyroom22Kt'
108+
mainClass = 'it.unibo.ctxmapperqak22.MainCtxmapperqak22Kt'
109109
}
110110

111111
jar {

unibo.mapperQak22/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "unibo.mapemptyroom22"
1+
rootProject.name = "unibo.mapperqak22"

unibo.mapperQak22/src/it/unibo/ctxbasicrobot/MainCtxbasicrobot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import kotlinx.coroutines.runBlocking
66

77
fun main() = runBlocking {
88
QakContext.createContexts(
9-
"127.0.0.1", this, "mapemptyroom22.pl", "sysRules.pl","ctxbasicrobot"
9+
"127.0.0.1", this, "mapperqak22.pl", "sysRules.pl","ctxbasicrobot"
1010
)
1111
}
1212

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Generated by AN DISI Unibo */
2+
package it.unibo.ctxmapperqak22
3+
import it.unibo.kactor.QakContext
4+
import it.unibo.kactor.sysUtil
5+
import kotlinx.coroutines.runBlocking
6+
7+
fun main() = runBlocking {
8+
QakContext.createContexts(
9+
"localhost", this, "mapperqak22.pl", "sysRules.pl","ctxmapperqak22"
10+
)
11+
}
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Generated by AN DISI Unibo */
2+
package it.unibo.ctxmapwithobstqak22
3+
import it.unibo.kactor.QakContext
4+
import it.unibo.kactor.sysUtil
5+
import kotlinx.coroutines.runBlocking
6+
7+
fun main() = runBlocking {
8+
QakContext.createContexts(
9+
"localhost", this, "mapwithobstqak22.pl", "sysRules.pl","ctxmapwithobstqak22"
10+
)
11+
}
12+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* Generated by AN DISI Unibo */
2+
package it.unibo.mapperqak22
3+
4+
import it.unibo.kactor.*
5+
import alice.tuprolog.*
6+
import kotlinx.coroutines.CoroutineScope
7+
import kotlinx.coroutines.delay
8+
import kotlinx.coroutines.launch
9+
import kotlinx.coroutines.runBlocking
10+
11+
class Mapperqak22 ( name: String, scope: CoroutineScope ) : ActorBasicFsm( name, scope ){
12+
13+
override fun getInitialState() : String{
14+
return "s0"
15+
}
16+
override fun getBody() : (ActorBasicFsm.() -> Unit){
17+
val interruptedStateTransitions = mutableListOf<Transition>()
18+
var NumStep = 0
19+
return { //this:ActionBasciFsm
20+
state("s0") { //this:State
21+
action { //it:State
22+
println("mapperbuilder starts")
23+
unibo.kotlin.planner22Util.initAI()
24+
//genTimer( actor, state )
25+
}
26+
//After Lenzi Aug2002
27+
sysaction { //it:State
28+
}
29+
transition( edgeName="goto",targetState="doAheadMove", cond=doswitch() )
30+
}
31+
state("doAheadMove") { //this:State
32+
action { //it:State
33+
delay(300)
34+
request("step", "step(350)" ,"basicrobot" )
35+
//genTimer( actor, state )
36+
}
37+
//After Lenzi Aug2002
38+
sysaction { //it:State
39+
}
40+
transition(edgeName="t00",targetState="continue",cond=whenReply("stepdone"))
41+
transition(edgeName="t01",targetState="turn",cond=whenReply("stepfail"))
42+
}
43+
state("continue") { //this:State
44+
action { //it:State
45+
unibo.kotlin.planner22Util.updateMap( "w", "" )
46+
//genTimer( actor, state )
47+
}
48+
//After Lenzi Aug2002
49+
sysaction { //it:State
50+
}
51+
transition( edgeName="goto",targetState="doAheadMove", cond=doswitch() )
52+
}
53+
state("turn") { //this:State
54+
action { //it:State
55+
NumStep = NumStep + 1
56+
forward("cmd", "cmd(l)" ,"basicrobot" )
57+
unibo.kotlin.planner22Util.updateMap( "l", "" )
58+
unibo.kotlin.planner22Util.showMap()
59+
//genTimer( actor, state )
60+
}
61+
//After Lenzi Aug2002
62+
sysaction { //it:State
63+
}
64+
transition( edgeName="goto",targetState="doAheadMove", cond=doswitchGuarded({ NumStep < 4
65+
}) )
66+
transition( edgeName="goto",targetState="endwork", cond=doswitchGuarded({! ( NumStep < 4
67+
) }) )
68+
}
69+
state("endwork") { //this:State
70+
action { //it:State
71+
unibo.kotlin.planner22Util.showMap();
72+
unibo.kotlin.planner22Util.saveRoomMap("mapRoomEmpty");
73+
println("mapperbuilder BYE")
74+
terminate(1)
75+
//genTimer( actor, state )
76+
}
77+
//After Lenzi Aug2002
78+
sysaction { //it:State
79+
}
80+
}
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)