new radio medium method signature + increased history size

This commit is contained in:
fros4943 2009-11-25 15:40:46 +00:00
parent 0a9e9dea59
commit 45d23c026e

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: TrafficVisualizerSkin.java,v 1.2 2009/10/19 17:37:50 fros4943 Exp $ * $Id: TrafficVisualizerSkin.java,v 1.3 2009/11/25 15:40:46 fros4943 Exp $
*/ */
package se.sics.cooja.plugins.skins; package se.sics.cooja.plugins.skins;
@ -81,7 +81,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
private Box counters; private Box counters;
private final static int HISTORY_SIZE = 8; private final static int HISTORY_SIZE = 16;
private boolean showHistory = false; private boolean showHistory = false;
private ArrayDeque<RadioConnection> history = new ArrayDeque<RadioConnection>(); private ArrayDeque<RadioConnection> history = new ArrayDeque<RadioConnection>();
@ -118,11 +118,9 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
interferedCounter.setText("INT: " + + radioMedium.COUNTER_INTERFERED); interferedCounter.setText("INT: " + + radioMedium.COUNTER_INTERFERED);
if (showHistory) { if (showHistory) {
RadioConnection[] past = radioMedium.getLastTickConnections(); RadioConnection last = radioMedium.getLastConnection();
if (past != null) { if (last != null) {
for (RadioConnection con: past) { history.add(last);
history.add(con);
}
while (history.size() > HISTORY_SIZE) { while (history.size() > HISTORY_SIZE) {
history.removeFirst(); history.removeFirst();
} }
@ -245,7 +243,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
if (conn == null) { if (conn == null) {
continue; continue;
} }
Radio source = conn.getSource(); // XXX Must not be null! Radio source = conn.getSource();
Point sourcePoint = visualizer.transformPositionToPixel(source.getPosition()); Point sourcePoint = visualizer.transformPositionToPixel(source.getPosition());
for (Radio destRadio : conn.getDestinations()) { for (Radio destRadio : conn.getDestinations()) {
if (destRadio == null) { if (destRadio == null) {