Author: sebb
Date: Sat May  9 15:39:37 2009
New Revision: 773240

URL: http://svn.apache.org/viewvc?rev=773240&view=rev
Log:
General tidy up - private local-only items; rename variables to be clearer

Modified:
    
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorAccumModel.java
    
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthPanel.java
    
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthVisualizer.java

Modified: 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorAccumModel.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorAccumModel.java?rev=773240&r1=773239&r2=773240&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorAccumModel.java
 (original)
+++ 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorAccumModel.java
 Sat May  9 15:39:37 2009
@@ -34,20 +34,20 @@
 
 public class MonitorAccumModel implements Clearable, Serializable {
 
-    private HashMap MAP;
+    private final HashMap/*<String, List>*/ serverListMap;
 
     /**
      * we use this to set the current monitorModel so that we can save the 
stats
      * to the resultcolllector.
      */
-    private MonitorModel CURRENT;
+    private MonitorModel current;
 
-    private List listeners;
+    private final List/*<MonitorListener>*/ listeners;
 
     /**
      * By default, we set the default to 800
      */
-    private int DEFAULT_BUFFER = 800;
+    private int defaultBufferSize = 800;
 
     // optional connector name prefix
     private String connectorPrefix = null;
@@ -56,16 +56,16 @@
      *
      */
     public MonitorAccumModel() {
-        MAP = new HashMap();
-        listeners = new LinkedList();
+        serverListMap = new HashMap/*<String, List>*/();
+        listeners = new LinkedList/*<MonitorListener>*/();
     }
 
     public int getBufferSize() {
-        return DEFAULT_BUFFER;
+        return defaultBufferSize;
     }
 
     public void setBufferSize(int buffer) {
-        DEFAULT_BUFFER = buffer;
+        defaultBufferSize = buffer;
     }
 
     public void setPrefix(String prefix) {
@@ -78,7 +78,7 @@
      * @return current sample
      */
     public MonitorModel getLastSample() {
-        return this.CURRENT;
+        return this.current;
     }
 
     /**
@@ -88,14 +88,14 @@
      * @param model
      */
     public void addSample(MonitorModel model) {
-        this.CURRENT = model;
-        if (MAP.containsKey(model.getURL())) {
-            List newlist = updateArray(model, (List) MAP.get(model.getURL()));
-            MAP.put(model.getURL(), newlist);
+        this.current = model;
+        if (serverListMap.containsKey(model.getURL())) {
+            List newlist = updateArray(model, (List) 
serverListMap.get(model.getURL()));
+            serverListMap.put(model.getURL(), newlist);
         } else {
             List samples = Collections.synchronizedList(new LinkedList());
             samples.add(model);
-            MAP.put(model.getURL(), samples);
+            serverListMap.put(model.getURL(), samples);
         }
     }
 
@@ -106,7 +106,7 @@
      * @param model
      */
     private List updateArray(MonitorModel model, List list) {
-        if (list.size() < DEFAULT_BUFFER) {
+        if (list.size() < defaultBufferSize) {
             list.add(model);
         } else {
             list.add(model);
@@ -122,10 +122,10 @@
      * @return list
      */
     public List getAllSamples(String url) {
-        if (!MAP.containsKey(url)) {
+        if (!serverListMap.containsKey(url)) {
             return Collections.synchronizedList(new LinkedList());
         } else {
-            return (List) MAP.get(url);
+            return (List) serverListMap.get(url);
         }
     }
 
@@ -136,8 +136,8 @@
      * @return list
      */
     public MonitorModel getSample(String url) {
-        if (MAP.containsKey(url)) {
-            ArrayList list = (ArrayList) MAP.get(url);
+        if (serverListMap.containsKey(url)) {
+            ArrayList list = (ArrayList) serverListMap.get(url);
             return (MonitorModel) list.get(0);
         } else {
             return null;
@@ -207,12 +207,12 @@
      * changes.
      */
     public void clearData() {
-        Iterator itr = this.MAP.keySet().iterator();
+        Iterator itr = this.serverListMap.keySet().iterator();
         while (itr.hasNext()) {
-            List lt = (List) this.MAP.get(itr.next());
+            List lt = (List) this.serverListMap.get(itr.next());
             lt.clear();
         }
-        this.MAP.clear();
+        this.serverListMap.clear();
     }
 
     /**

Modified: 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthPanel.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthPanel.java?rev=773240&r1=773239&r2=773240&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthPanel.java
 (original)
+++ 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthPanel.java
 Sat May  9 15:39:37 2009
@@ -36,25 +36,25 @@
  * only uses the most current information to show the status.
  */
 public class MonitorHealthPanel extends JPanel implements MonitorListener, 
Clearable {
-    private HashMap SERVERMAP = new HashMap();
+    private final HashMap/*<String, ServerPanel>*/ serverPanelMap = new 
HashMap/*<String, ServerPanel>*/();
 
-    private JPanel SERVERS = null;
+    private JPanel servers = null;
 
-    private MonitorAccumModel MODEL;
+    private final MonitorAccumModel model;
 
-    private JScrollPane SCROLL = null;
+    private JScrollPane serverScrollPane = null;
 
     // NOTUSED Font plainText = new Font("plain", Font.PLAIN, 9);
     // These must not be static, otherwise Language change does not work
-    public final String INFO_H = 
JMeterUtils.getResString("monitor_equation_healthy"); //$NON-NLS-1$
+    private final String INFO_H = 
JMeterUtils.getResString("monitor_equation_healthy"); //$NON-NLS-1$
 
-    public final String INFO_A = 
JMeterUtils.getResString("monitor_equation_active"); //$NON-NLS-1$
+    private final String INFO_A = 
JMeterUtils.getResString("monitor_equation_active"); //$NON-NLS-1$
 
-    public final String INFO_W = 
JMeterUtils.getResString("monitor_equation_warning"); //$NON-NLS-1$
+    private final String INFO_W = 
JMeterUtils.getResString("monitor_equation_warning"); //$NON-NLS-1$
 
-    public final String INFO_D = 
JMeterUtils.getResString("monitor_equation_dead"); //$NON-NLS-1$
+    private final String INFO_D = 
JMeterUtils.getResString("monitor_equation_dead"); //$NON-NLS-1$
 
-    public final String INFO_LOAD = 
JMeterUtils.getResString("monitor_equation_load"); //$NON-NLS-1$
+    private final String INFO_LOAD = 
JMeterUtils.getResString("monitor_equation_load"); //$NON-NLS-1$
 
     /**
      *
@@ -62,14 +62,15 @@
      */
     public MonitorHealthPanel() {
         // log.warn("Only for use in unit testing");
+        model = null;
     }
 
     /**
      *
      */
     public MonitorHealthPanel(MonitorAccumModel model) {
-        this.MODEL = model;
-        this.MODEL.addListener(this);
+        this.model = model;
+        this.model.addListener(this);
         init();
     }
 
@@ -84,13 +85,13 @@
         label.setPreferredSize(new Dimension(550, 25));
         this.add(label, BorderLayout.NORTH);
 
-        this.SERVERS = new JPanel();
-        this.SERVERS.setLayout(new BoxLayout(SERVERS, BoxLayout.Y_AXIS));
-        this.SERVERS.setAlignmentX(Component.LEFT_ALIGNMENT);
-
-        SCROLL = new JScrollPane(this.SERVERS);
-        SCROLL.setPreferredSize(new Dimension(300, 300));
-        this.add(SCROLL, BorderLayout.CENTER);
+        this.servers = new JPanel();
+        this.servers.setLayout(new BoxLayout(servers, BoxLayout.Y_AXIS));
+        this.servers.setAlignmentX(Component.LEFT_ALIGNMENT);
+
+        serverScrollPane = new JScrollPane(this.servers);
+        serverScrollPane.setPreferredSize(new Dimension(300, 300));
+        this.add(serverScrollPane, BorderLayout.CENTER);
 
         // the equations
         String eqstring1 = " " + INFO_H + "   |   " + INFO_A;
@@ -110,22 +111,22 @@
      * @param model
      */
     public void addSample(MonitorModel model) {
-        if (SERVERMAP.containsKey(model.getURL())) {
+        if (serverPanelMap.containsKey(model.getURL())) {
             ServerPanel pane = null;
-            if (SERVERMAP.get(model.getURL()) != null) {
-                pane = (ServerPanel) SERVERMAP.get((model.getURL()));
+            if (serverPanelMap.get(model.getURL()) != null) {
+                pane = (ServerPanel) serverPanelMap.get((model.getURL()));
             } else {
                 pane = new ServerPanel(model);
-                SERVERMAP.put(model.getURL(), pane);
+                serverPanelMap.put(model.getURL(), pane);
             }
             pane.updateGui(model);
         } else {
             ServerPanel newpane = new ServerPanel(model);
-            SERVERMAP.put(model.getURL(), newpane);
-            this.SERVERS.add(newpane);
+            serverPanelMap.put(model.getURL(), newpane);
+            this.servers.add(newpane);
             newpane.updateGui(model);
         }
-        this.SERVERS.updateUI();
+        this.servers.updateUI();
     }
 
     /**
@@ -133,8 +134,8 @@
      * pane, and update the ui.
      */
     public void clearData() {
-        this.SERVERMAP.clear();
-        this.SERVERS.removeAll();
-        this.SERVERS.updateUI();
+        this.serverPanelMap.clear();
+        this.servers.removeAll();
+        this.servers.updateUI();
     }
 }

Modified: 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthVisualizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthVisualizer.java?rev=773240&r1=773239&r2=773240&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthVisualizer.java
 (original)
+++ 
jakarta/jmeter/trunk/src/monitor/components/org/apache/jmeter/visualizers/MonitorHealthVisualizer.java
 Sat May  9 15:39:37 2009
@@ -45,24 +45,24 @@
 public class MonitorHealthVisualizer extends AbstractVisualizer implements 
ImageVisualizer, ItemListener,
         GraphListener, Clearable {
 
+    private static final Logger log = LoggingManager.getLoggerForClass();
+
     private static final String CONNECTOR_PREFIX = "connector.prefix"; // 
$NON-NLS-1$
     private static final String CONNECTOR_PREFIX_DEFAULT = ""; // $NON-NLS-1$
 
-    private MonitorTabPane TABPANE;
-
-    private MonitorHealthPanel HEALTHPANE;
+    private static final String BUFFER = "monitor.buffer.size"; // $NON-NLS-1$
 
-    private MonitorPerformancePanel PERFPANE;
+    private MonitorTabPane tabPane;
 
-    private MonitorAccumModel MODEL;
+    private MonitorHealthPanel healthPane;
 
-    private MonitorGraph GRAPH;
+    private MonitorPerformancePanel perfPane;
 
-    private JLabeledTextField prefixField;
+    private MonitorAccumModel model;
 
-    public static final String BUFFER = "monitor.buffer.size"; // $NON-NLS-1$
+    private MonitorGraph graph;
 
-    private static final Logger log = LoggingManager.getLoggerForClass();
+    private JLabeledTextField prefixField;
 
     /**
      * Constructor for the GraphVisualizer object.
@@ -76,19 +76,19 @@
     public void configure(TestElement el) {
         super.configure(el);
         prefixField.setText(el.getPropertyAsString(CONNECTOR_PREFIX, 
CONNECTOR_PREFIX_DEFAULT));
-        MODEL.setPrefix(prefixField.getText());
+        model.setPrefix(prefixField.getText());
     }
 
     public void modifyTestElement(TestElement c) {
         super.modifyTestElement(c);
         
c.setProperty(CONNECTOR_PREFIX,prefixField.getText(),CONNECTOR_PREFIX_DEFAULT);
-        MODEL.setPrefix(prefixField.getText());
+        model.setPrefix(prefixField.getText());
     }
     
     private void initModel() {
-        MODEL = new MonitorAccumModel();
-        GRAPH = new MonitorGraph(MODEL);
-        MODEL.setBufferSize(JMeterUtils.getPropDefault(BUFFER, 800));
+        model = new MonitorAccumModel();
+        graph = new MonitorGraph(model);
+        model.setBufferSize(JMeterUtils.getPropDefault(BUFFER, 800));
     }
 
     public String getLabelResource() {
@@ -101,9 +101,9 @@
      * to run for a very long time without eating up all the memory.
      */
     public void add(SampleResult res) {
-        MODEL.addSample(res);
+        model.addSample(res);
         try {
-            
collector.recordStats(this.MODEL.getLastSample().cloneMonitorStats());
+            
collector.recordStats(this.model.getLastSample().cloneMonitorStats());
         } catch (Exception e) {
             // for now just swallow the exception
             log.debug("StatsModel was null", e);
@@ -111,9 +111,9 @@
     }
 
     public Image getImage() {
-        Image result = GRAPH.createImage(this.getWidth(), this.getHeight());
+        Image result = graph.createImage(this.getWidth(), this.getHeight());
         Graphics image = result.getGraphics();
-        GRAPH.paintComponent(image);
+        graph.paintComponent(image);
         return result;
     }
 
@@ -146,10 +146,10 @@
     }
 
     private void createTabs() {
-        TABPANE = new MonitorTabPane();
-        createHealthPane(TABPANE);
-        createPerformancePane(TABPANE);
-        this.add(TABPANE, BorderLayout.CENTER);
+        tabPane = new MonitorTabPane();
+        createHealthPane(tabPane);
+        createPerformancePane(tabPane);
+        this.add(tabPane, BorderLayout.CENTER);
     }
 
     /**
@@ -158,8 +158,8 @@
      * @param pane
      */
     private void createHealthPane(MonitorTabPane pane) {
-        HEALTHPANE = new MonitorHealthPanel(MODEL);
-        pane.addTab(JMeterUtils.getResString("monitor_health_tab_title"), 
HEALTHPANE); // $NON-NLS-1$
+        healthPane = new MonitorHealthPanel(model);
+        pane.addTab(JMeterUtils.getResString("monitor_health_tab_title"), 
healthPane); // $NON-NLS-1$
     }
 
     /**
@@ -168,17 +168,17 @@
      * @param pane
      */
     private void createPerformancePane(MonitorTabPane pane) {
-        PERFPANE = new MonitorPerformancePanel(MODEL, GRAPH);
-        pane.addTab(JMeterUtils.getResString("monitor_performance_tab_title"), 
PERFPANE); // $NON-NLS-1$
+        perfPane = new MonitorPerformancePanel(model, graph);
+        pane.addTab(JMeterUtils.getResString("monitor_performance_tab_title"), 
perfPane); // $NON-NLS-1$
     }
 
     /**
      * Clears the MonitorAccumModel.
      */
     public void clearData() {
-        this.MODEL.clearData();
-        this.HEALTHPANE.clearData();
-        this.PERFPANE.clearData();
+        this.model.clearData();
+        this.healthPane.clearData();
+        this.perfPane.clearData();
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to