Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions rtamt/semantics/stl/discrete_time/offline/ast_visitor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import math
import operator
import collections
import copy

from rtamt.syntax.ast.visitor.stl.ast_visitor import StlAstVisitor
from rtamt.semantics.enumerations.comp_oper import StlComparisonOperator
Expand All @@ -11,7 +12,7 @@ class StlDiscreteTimeOfflineAstVisitor(StlAstVisitor):

def visit(self, node, *args, **kwargs):
result = super(StlDiscreteTimeOfflineAstVisitor, self).visit(node, *args, **kwargs)
self.ast.results[node] = result
self.ast.results[node] = copy.deepcopy(result)
return result

def visitPredicate(self, node, *args, **kwargs):
Expand Down Expand Up @@ -41,7 +42,7 @@ def visitVariable(self, node, *args, **kwargs):
for v in var:
sample_return.append(operator.attrgetter(node.field)(v))
else:
sample_return = var
sample_return = list(var)
return sample_return


Expand Down Expand Up @@ -376,7 +377,7 @@ def visitTimedAlways(self, node, *args, **kwargs):
begin, end = self.time_unit_transformer(node)
sample_len = len(sample)
if sample_len <= end:
sample += [float('inf')] * (end - sample_len + 1)
sample = sample + [float('inf')] * (end - sample_len + 1)

diff = end - begin
sample_return = [min(sample[j:j+diff+1]) for j in range(begin, end+1)]
Expand All @@ -392,7 +393,7 @@ def visitTimedEventually(self, node, *args, **kwargs):
sample_len = len(sample)

if sample_len <= end:
sample += [-float('inf')] * (end - sample_len + 1)
sample = sample + [-float('inf')] * (end - sample_len + 1)

diff = end - begin
sample_return = [max(sample[j:j+diff+1]) for j in range(begin, end+1)]
Expand Down