From 088f2e12a8e379e3bfa56ab8f97195a5f67deb1a Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Wed, 21 Mar 2012 16:56:32 +0100 Subject: [PATCH] simplified usage of Watchpoint and WatchpointMote interfaces --- .../cooja/java/se/sics/cooja/Watchpoint.java | 28 ++++++++-------- .../java/se/sics/cooja/WatchpointMote.java | 32 +++++++++++-------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/Watchpoint.java b/tools/cooja/java/se/sics/cooja/Watchpoint.java index f266d5194..c65182a94 100644 --- a/tools/cooja/java/se/sics/cooja/Watchpoint.java +++ b/tools/cooja/java/se/sics/cooja/Watchpoint.java @@ -32,24 +32,26 @@ package se.sics.cooja; import java.awt.Color; +import java.io.File; /** * @author Fredrik Osterlind */ public interface Watchpoint { - - /** - * @return Short watchpoint description - */ - public String getDescription(); - /** - * @return Mote - */ - public Mote getMote(); - - /** - * @return Color - */ + public WatchpointMote getMote(); + public Color getColor(); + public void setColor(Color newColor); + + public String getDescription(); + public void setUserMessage(String msg); + public String getUserMessage(); + + public File getCodeFile(); + public int getLineNumber(); + public int getExecutableAddress(); + + public void setStopsSimulation(boolean b); + public boolean stopsSimulation(); } diff --git a/tools/cooja/java/se/sics/cooja/WatchpointMote.java b/tools/cooja/java/se/sics/cooja/WatchpointMote.java index 970c96a40..ba5886213 100644 --- a/tools/cooja/java/se/sics/cooja/WatchpointMote.java +++ b/tools/cooja/java/se/sics/cooja/WatchpointMote.java @@ -31,12 +31,17 @@ package se.sics.cooja; -import java.awt.event.ActionListener; +import java.io.File; /** * @author Fredrik Osterlind */ -public interface WatchpointMote { +public interface WatchpointMote extends Mote { + + public interface WatchpointListener { + public void watchpointTriggered(Watchpoint watchpoint); + public void watchpointsChanged(); + } /** * Adds a breakpoint listener. @@ -44,28 +49,27 @@ public interface WatchpointMote { * * @param listener Action listener */ - public void addWatchpointListener(ActionListener listener); + public void addWatchpointListener(WatchpointListener listener); /** * Removes previously registered listener. - * + * * @param listener Listeners */ - public void removeWatchpointListener(ActionListener listener); + public void removeWatchpointListener(WatchpointListener listener); /** * @return All registered listeners */ - public ActionListener[] getWatchpointListeners(); + public WatchpointListener[] getWatchpointListeners(); - /** - * @return Last triggered watchpoint - */ - public Watchpoint getLastWatchpoint(); + public Watchpoint addBreakpoint(File codeFile, int lineNr, int address); + public void removeBreakpoint(Watchpoint watchpoint); + public Watchpoint[] getBreakpoints(); - /** - * @return Mote - */ - public Mote getMote(); + public boolean breakpointExists(int address); + public boolean breakpointExists(File file, int lineNr); + + public Integer getExecutableAddressOf(File file, int lineNr); }