From 404fd8239998d046e44dcb4c5a66850a1f59728b Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Sat, 12 Apr 2014 01:04:18 +0200 Subject: [PATCH] [cooja/serialsocket] Added @Override annotations --- .../contikios/cooja/serialsocket/SerialSocketClient.java | 7 +++++++ .../contikios/cooja/serialsocket/SerialSocketServer.java | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketClient.java b/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketClient.java index d29d8a2a6..133af33d0 100644 --- a/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketClient.java +++ b/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketClient.java @@ -128,6 +128,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { /* Observe serial port for outgoing data */ serialPort.addSerialDataObserver(serialDataObserver = new Observer() { + @Override public void update(Observable obs, Object obj) { try { if (out == null) { @@ -149,6 +150,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { private void startSocketReadThread(final DataInputStream in) { /* Forward data: virtual port -> mote */ Thread incomingDataThread = new Thread(new Runnable() { + @Override public void run() { int numRead = 0; byte[] data = new byte[1024]; @@ -193,10 +195,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { return label; } + @Override public boolean setConfigXML(Collection configXML, boolean visAvailable) { return true; } + @Override public Collection getConfigXML() { return null; } @@ -227,6 +231,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { } SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { SerialSocketClient.this.setTitle(SerialSocketClient.this.getTitle() + " *DISCONNECTED*"); statusLabel.setText("Disconnected from server"); @@ -234,10 +239,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { }); } + @Override public void closePlugin() { cleanup(); } + @Override public Mote getMote() { return mote; } diff --git a/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketServer.java b/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketServer.java index 2c99dd7a9..f79d8b360 100644 --- a/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketServer.java +++ b/tools/cooja/apps/serial_socket/java/org/contikios/cooja/serialsocket/SerialSocketServer.java @@ -129,6 +129,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { } server = new ServerSocket(LISTEN_PORT); new Thread() { + @Override public void run() { while (server != null) { try { @@ -157,6 +158,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { /* Observe serial port for outgoing data */ serialPort.addSerialDataObserver(serialDataObserver = new Observer() { + @Override public void update(Observable obs, Object obj) { try { if (out == null) { @@ -178,6 +180,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { private void startSocketReadThread(final DataInputStream in) { /* Forward data: virtual port -> mote */ Thread incomingDataThread = new Thread(new Runnable() { + @Override public void run() { int numRead = 0; byte[] data = new byte[1024]; @@ -218,10 +221,12 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { return label; } + @Override public boolean setConfigXML(Collection configXML, boolean visAvailable) { return true; } + @Override public Collection getConfigXML() { return null; } @@ -251,6 +256,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { if (Cooja.isVisualized()) { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { statusLabel.setText("Listening on port: " + LISTEN_PORT); } @@ -259,6 +265,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { } private boolean closed = false; + @Override public void closePlugin() { closed = true; cleanupClient(); @@ -269,12 +276,14 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { } } + @Override public Mote getMote() { return mote; } private static final int UPDATE_INTERVAL = 150; private Timer updateTimer = new Timer(UPDATE_INTERVAL, new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (closed) { updateTimer.stop();