From 7000eaf5a271646ade1a5920f11f9549bb571473 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Mon, 14 Nov 2016 19:23:33 +0100 Subject: [PATCH] Implement nbrDelay and nbrLag --- .../alchemist/protelis/AlchemistExecutionContext.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/alchemist/alchemist-incarnation-protelis/src/main/java/it/unibo/alchemist/protelis/AlchemistExecutionContext.java b/alchemist/alchemist-incarnation-protelis/src/main/java/it/unibo/alchemist/protelis/AlchemistExecutionContext.java index 15650b5d1f..6963953078 100644 --- a/alchemist/alchemist-incarnation-protelis/src/main/java/it/unibo/alchemist/protelis/AlchemistExecutionContext.java +++ b/alchemist/alchemist-incarnation-protelis/src/main/java/it/unibo/alchemist/protelis/AlchemistExecutionContext.java @@ -203,7 +203,14 @@ public ExecutionEnvironment getExecutionEnvironment() { @Override public Field nbrLag() { - return buildField(Functions.identity(), 0); + return buildField(time -> getCurrentTime().doubleValue() - time, getCurrentTime().doubleValue()); + } + + /** + * @return The same behavior of MIT Proto's nbrdelay (forward view). + */ + public Field nbrDelay() { + return buildField(Functions.identity(), getDeltaTime()); } @Override