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
* 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;
@ -81,7 +81,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
private Box counters;
private final static int HISTORY_SIZE = 8;
private final static int HISTORY_SIZE = 16;
private boolean showHistory = false;
private ArrayDeque<RadioConnection> history = new ArrayDeque<RadioConnection>();
@ -118,11 +118,9 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
interferedCounter.setText("INT: " + + radioMedium.COUNTER_INTERFERED);
if (showHistory) {
RadioConnection[] past = radioMedium.getLastTickConnections();
if (past != null) {
for (RadioConnection con: past) {
history.add(con);
}
RadioConnection last = radioMedium.getLastConnection();
if (last != null) {
history.add(last);
while (history.size() > HISTORY_SIZE) {
history.removeFirst();
}
@ -245,7 +243,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
if (conn == null) {
continue;
}
Radio source = conn.getSource(); // XXX Must not be null!
Radio source = conn.getSource();
Point sourcePoint = visualizer.transformPositionToPixel(source.getPosition());
for (Radio destRadio : conn.getDestinations()) {
if (destRadio == null) {