Skip to content

Commit

Permalink
remove aged components from RSSI_IN_TIME and DISTANCE_IN_TIME graphs.…
Browse files Browse the repository at this point in the history
… Only 5 minutes old records are left
  • Loading branch information
ph4r05 committed Sep 23, 2011
1 parent 404a2a3 commit 83345cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/rssi_graph/localization/JPanelDistanceInTime.java
Expand Up @@ -157,6 +157,8 @@ protected void updateValues(){
ts = this.timeSeries.get(curTimeSerieKey);
}

// age items in time series
ts.removeAgedItems(300000, false);
ts.add(now, distanceFunction.getDistanceFromRSSI(floatingMean.get(curAnchor)));
this.timeSeries.put(curTimeSerieKey, ts);
}
Expand Down
8 changes: 6 additions & 2 deletions src/rssi_graph/localization/JPanelRSSIInTime.java
Expand Up @@ -51,6 +51,8 @@
*/
public class JPanelRSSIInTime extends javax.swing.JPanel implements ActionListener {

public static final int MAX_MEMORY_ELEMENTS=10000;

private Timer grabTimer = null;
private WorkerLocalization worker = null;
private Map<String, TimeSeries> timeSeries = null;
Expand Down Expand Up @@ -147,7 +149,7 @@ protected synchronized void updateValues(){
// generate key for time serie
String curTimeSerieKey = "T"+mn.getMobile_nodeID()+";R"+curAnchor;
TimeSeries ts = null;

// does time serie exist?
if (!this.timeSeries.containsKey(curTimeSerieKey)){
redrawGraphNeeded=true;
Expand All @@ -161,6 +163,8 @@ protected synchronized void updateValues(){
ts = this.timeSeries.get(curTimeSerieKey);
}

// age items in time series
ts.removeAgedItems(300000, false);
ts.add(now, floatingMean.get(curAnchor));
this.timeSeries.put(curTimeSerieKey, ts);
}
Expand Down Expand Up @@ -287,7 +291,7 @@ protected void drawGraph(){
this.revalidate();
}

public void actionPerformed(ActionEvent e) {
public synchronized void actionPerformed(ActionEvent e) {
if ("grabTimer".equals(e.getActionCommand())){
this.updateValues();
}
Expand Down

0 comments on commit 83345cf

Please sign in to comment.