Skip to content

Commit 6e0ce1e

Browse files
committed
🚧 Add description param to model class
1 parent 13145d2 commit 6e0ce1e

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

lib/models/TuringMachineModel.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ class TuringMachineModel {
1616
List<Configuration> configs;
1717
@HiveField(2)
1818
List<Behaviour> behaviours;
19+
@HiveField(3)
20+
String description;
1921
TuringMachineModel(
2022
{required this.initial_config,
2123
required this.configs,
22-
required this.behaviours});
24+
required this.behaviours,
25+
required this.description});
2326
//Factory constructor for Model to save this machine object
2427
factory TuringMachineModel.fromMachine({required TuringMachine machine}) {
2528
//Construct object from machine object.
2629
return TuringMachineModel(
2730
initial_config: machine.initial_config,
2831
configs: machine.machine.keys.toList(),
2932
behaviours: machine.machine.values.toList(),
33+
description: machine.description,
3034
);
3135
//LinkedHashMap to List.
3236
}
@@ -40,6 +44,7 @@ class TuringMachineModel {
4044
);
4145
machine.current_config = initial_config;
4246
machine.iterations = 0;
47+
machine.description = description;
4348

4449
return machine;
4550
}

lib/models/TuringMachineModel.g.dart

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

lib/models/TuringMachines.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ class TuringMachine {
1919

2020
Tape tape;
2121

22+
String description;
23+
2224
late LinkedHashMap<Configuration, Behaviour> machine;
2325
TuringMachine(List<Configuration> configurations, List<Behaviour> behaviours,
2426
{required this.tape, required this.initial_config})
2527
: machine = LinkedHashMap(),
26-
current_config = initial_config {
28+
current_config = initial_config,
29+
description = "Enter a description for this turing machine here" {
2730
//Write code to convert ordered entires into hashmap key-pair values
2831
// ignore: unnecessary_this
2932
for (int i = 0; i < configurations.length; i++) {

0 commit comments

Comments
 (0)