我有一个使用metadepth(.mdepth)创建的模型,其背后的逻辑是用eol编写的。 我有一个Contents类型的类,该类的元素名为Cell类型的位置,并被称为fire的类继承。 基本上,我想将Fire的新实例的位置设置为特定单元格的内容,但没有任何问题,而且我不知道问题出在哪里,因为我可以访问所需的Fire,并且可以打印所有它的内容,但我只是不能更改它们。
深度:
Node Cell : Place {
number: int; //To know which cell this is, used for placement and outputs
//can only move in 4 directions: N, E, S, W and contains cells or walls W: 0, N: 1, E: 2, S: 3
SouthCell: Adjacent;
EastCell: Adjacent;
NorthCell: Adjacent;
WestCell: Adjacent;
contents: Contents; //the Contents of the cell, standard empty?????
doors: Door[0..*] {unique}; //when navigating between cells you need to know where the exit is
//room: Room; //to know in wich cell the room is located */
}
Node Contents {
position: Cell; // each Contents belongs to a cell
}
Node Fire : Contents {
name: String = "Fire";
}
EOL:
operation Cell burnCell(){
var fire = Fire.createInstance();
fire.position = self;
("Fire "+fire.name+" created, position: "+fire.position).println();//position is staying empty
self.contents := fire; //assignment not working
("burn cell:"+ self.number + " contents: " + self.contents).println();//contents isn't updating
}