From cd2bab0589900cbd60ceff4c4779da80f5aa9456 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 15 Dec 2006 11:47:40 +0000 Subject: [PATCH] added method for retrieving variable addresses --- .../cooja/java/se/sics/cooja/SectionMoteMemory.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/SectionMoteMemory.java b/tools/cooja/java/se/sics/cooja/SectionMoteMemory.java index 978990ada..b0418cb21 100644 --- a/tools/cooja/java/se/sics/cooja/SectionMoteMemory.java +++ b/tools/cooja/java/se/sics/cooja/SectionMoteMemory.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SectionMoteMemory.java,v 1.2 2006/08/23 15:48:15 fros4943 Exp $ + * $Id: SectionMoteMemory.java,v 1.3 2006/12/15 11:47:40 fros4943 Exp $ */ package se.sics.cooja; @@ -77,6 +77,16 @@ public class SectionMoteMemory implements MoteMemory { return names; } + /** + * @param varName Variable name + * @return Address of given variable, or -1 + */ + public int getVariableAddress(String varName) { + if (!variableAddresses.containsKey(varName)) + return -1; + return ((Integer) variableAddresses.get(varName)).intValue(); + } + public void clearMemory() { sections.clear(); }