changeset 1139:85cd7afdf70f

Convert LongRange into the more generic Range<T> Reviewed-by: neugens, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-June/007055.html
author Omair Majid <omajid@redhat.com>
date Fri, 07 Jun 2013 11:38:33 -0400
parents f747a057d7a1
children bf720980510c
files client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineRulerHeader.java client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineUtils.java common/core/src/main/java/com/redhat/thermostat/common/model/LongRange.java common/core/src/main/java/com/redhat/thermostat/common/model/LongRangeNormalizer.java common/core/src/main/java/com/redhat/thermostat/common/model/Range.java common/core/src/test/java/com/redhat/thermostat/common/model/LongRangeNormalizerTest.java thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/model/timeline/Page.java thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/view/ThreadTimelineView.java thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineController.java thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineControllerTest.java thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadTimelineView.java thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/ThreadTimelineHeader.java thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/TimelineComponent.java vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/stats/HeapChartPanelLayout.java
diffstat 14 files changed, 139 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineRulerHeader.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineRulerHeader.java	Fri Jun 07 11:38:33 2013 -0400
@@ -51,7 +51,7 @@
 import com.redhat.thermostat.client.swing.GraphicsUtils;
 import com.redhat.thermostat.client.swing.components.GradientPanel;
 import com.redhat.thermostat.client.ui.Palette;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 
 @SuppressWarnings("serial")
 public abstract class TimelineRulerHeader extends GradientPanel {
@@ -75,9 +75,9 @@
      */
     public static final long DEFAULT_INCREMENT_IN_MILLIS = 1_000;
     
-    private LongRange range;
+    private Range<Long> range;
     
-    public TimelineRulerHeader(LongRange range) {
+    public TimelineRulerHeader(Range<Long> range) {
         
         super(Palette.LIGHT_GRAY.getColor(), Palette.WHITE.getColor());
         setFont(TimelineUtils.FONT);
@@ -85,7 +85,7 @@
         this.range = range;
     }
     
-    public LongRange getRange() {
+    public Range<Long> getRange() {
         return range;
     }
     
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineUtils.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/timeline/TimelineUtils.java	Fri Jun 07 11:38:33 2013 -0400
@@ -41,12 +41,12 @@
 import java.awt.Rectangle;
 
 import com.redhat.thermostat.client.ui.Palette;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 
 public class TimelineUtils {
     public static final Font FONT = new Font("SansSerif", Font.PLAIN, 10);
  
-    public static void drawMarks(LongRange range, Graphics2D graphics, Rectangle bounds,
+    public static void drawMarks(Range<Long> range, Graphics2D graphics, Rectangle bounds,
                                  int currentValue, boolean darkerTop, int increment)
     {
         int inc = currentValue % increment;
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/LongRange.java	Fri Jun 07 11:29:06 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright 2012, 2013 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.model;
-
-
-/**
- * A class representing a span of units from min to max. <br /><br />
- * 
- * The units and the meaning of the range are left to the user, including the
- * fact that the range are inclusive or exclusive of the extremes.
- */
-public class LongRange {
-
-    long min;
-    long max;
-    
-    /**
-     * Creates a new LongRange with a span of 0 units.
-     */
-    public LongRange() {
-    }
-    
-    /**
-     * Creates a new Range that span from min to max.
-     */
-    public LongRange(long min, long max) {
-        this.min = min;
-        this.max = max;
-    }
-    
-    public void setMax(long max) {
-        this.max = max;
-    }
-    
-    public long getMax() {
-        return max;
-    }
-    
-    public void setMin(long min) {
-        this.min = min;
-    }
-    
-    public long getMin() {
-        return min;
-    }
-    
-    @Override
-    public String toString() {
-        return "[" + min + " ->" + max +  "("+ (max - min) + ")]";
-    }
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/LongRangeNormalizer.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/LongRangeNormalizer.java	Fri Jun 07 11:38:33 2013 -0400
@@ -51,19 +51,19 @@
  
     private long value;
 
-    private LongRange range;
+    private Range<Long> range;
     
-    public LongRangeNormalizer(LongRange range) {
+    public LongRangeNormalizer(Range<Long> range) {
         this.range = range;
     }
 
-    public LongRangeNormalizer(LongRange range, long minNormalized, long maxNormalized) {
+    public LongRangeNormalizer(Range<Long> range, long minNormalized, long maxNormalized) {
         this.range = range;
         this.maxNormalized = maxNormalized;
         this.minNormalized = minNormalized;
     }
     
-    public LongRangeNormalizer(LongRange range, LongRange normilizedRange) {
+    public LongRangeNormalizer(Range<Long> range, Range<Long> normilizedRange) {
         this.range = range;
         maxNormalized = normilizedRange.max;
         minNormalized = normilizedRange.min;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/Range.java	Fri Jun 07 11:38:33 2013 -0400
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2012, 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.model;
+
+import java.util.Objects;
+
+/**
+ * A class representing a span of units from min to max. <br /><br />
+ * 
+ * The units and the meaning of the range are left to the user, including the
+ * fact that the range are inclusive or exclusive of the extremes.
+ */
+public class Range<T extends Number> {
+
+    T min;
+    T max;
+    
+    /**
+     * Creates a new Range that span from min to max.
+     */
+    public Range(T min, T max) {
+        this.min = min;
+        this.max = max;
+    }
+    
+    public void setMax(T max) {
+        this.max = max;
+    }
+    
+    public T getMax() {
+        return max;
+    }
+    
+    public void setMin(T min) {
+        this.min = min;
+    }
+    
+    public T getMin() {
+        return min;
+    }
+    
+    @Override
+    public String toString() {
+        return "[" + min + " -> " + max + "]";
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!obj.getClass().equals(getClass())) {
+            return false;
+        }
+        Range<?> other = (Range<?>) obj;
+        return Objects.equals(this.min, other.min) && Objects.equals(this.max, other.max);
+    }
+
+    /** Note: It's not a good idea to use mutable values (like {@code Range}) as a hash */
+    @Override
+    public int hashCode() {
+        return Objects.hash(min, max);
+    }
+}
+
--- a/common/core/src/test/java/com/redhat/thermostat/common/model/LongRangeNormalizerTest.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/common/core/src/test/java/com/redhat/thermostat/common/model/LongRangeNormalizerTest.java	Fri Jun 07 11:38:33 2013 -0400
@@ -36,12 +36,11 @@
 
 package com.redhat.thermostat.common.model;
 
-import static org.junit.Assert.*;
 import junit.framework.Assert;
 
 import org.junit.Test;
 
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.common.model.LongRangeNormalizer;
 
 public class LongRangeNormalizerTest {
@@ -49,9 +48,7 @@
     @Test
     public void testSameRange() {
         
-        LongRange range = new LongRange();
-        range.setMax(10);
-        range.setMin(0);
+        Range<Long> range = new Range<>(0l, 10l);
         
         LongRangeNormalizer model = new LongRangeNormalizer(range);
         
@@ -67,9 +64,7 @@
     @Test
     public void testDoubleRange() {
         
-        LongRange range = new LongRange();
-        range.setMax(10);
-        range.setMin(0);
+        Range<Long> range = new Range<>(0l, 10l);
         
         LongRangeNormalizer model = new LongRangeNormalizer(range);
         
@@ -85,9 +80,7 @@
     @Test
     public void testRanges() {
         
-        LongRange range = new LongRange();
-        range.setMax(10);
-        range.setMin(0);
+        Range<Long> range = new Range<>(0l, 10l);
         
         LongRangeNormalizer model = new LongRangeNormalizer(range);
         
@@ -108,8 +101,8 @@
                 
         Assert.assertEquals(150, model.getValueNormalized());
         
-        range.setMax(100);
-        range.setMin(0);
+        range.setMax(100l);
+        range.setMin(0l);
         model.setValue(50);
         
         model.setMaxNormalized(1);
--- a/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/model/timeline/Page.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/model/timeline/Page.java	Fri Jun 07 11:38:33 2013 -0400
@@ -36,16 +36,16 @@
 
 package com.redhat.thermostat.thread.client.common.model.timeline;
 
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 
 public class Page {
 
-    private LongRange range;
-    public Page(LongRange range) {
+    private Range<Long> range;
+    public Page(Range<Long> range) {
         this.range = range;
     }
     
-    public LongRange getSpan() {
+    public Range<Long> getSpan() {
         return range;
     }
 }
--- a/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/view/ThreadTimelineView.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/view/ThreadTimelineView.java	Fri Jun 07 11:38:33 2013 -0400
@@ -41,7 +41,7 @@
 import com.redhat.thermostat.client.core.views.BasicView;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionNotifier;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.thread.client.common.Timeline;
 
 public abstract class ThreadTimelineView extends BasicView {
@@ -63,6 +63,6 @@
         threadTimelineNotifier.removeActionListener(listener);
     }
     
-    public abstract void displayStats(List<Timeline> timelines, LongRange range);
+    public abstract void displayStats(List<Timeline> timelines, Range<Long> range);
 }
 
--- a/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineController.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineController.java	Fri Jun 07 11:38:33 2013 -0400
@@ -37,17 +37,14 @@
 package com.redhat.thermostat.thread.client.controller.impl;
 
 import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Stack;
 
 import com.redhat.thermostat.client.ui.Palette;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.Timer;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.thread.client.common.Timeline;
 import com.redhat.thermostat.thread.client.common.TimelineInfo;
 import com.redhat.thermostat.thread.client.common.chart.ChartColors;
@@ -85,7 +82,7 @@
             
             synchronized (lock) {
                 // FIXME: only load latest, not all the info all the time
-                LongRange range = new LongRange(Long.MAX_VALUE, Long.MIN_VALUE);
+                Range<Long> range = new Range<Long>(Long.MAX_VALUE, Long.MIN_VALUE);
                 List<ThreadInfoData> infos = collector.getThreadInfo();
                 if(infos.size() > 0) {
                     Map<ThreadInfoData, List<ThreadInfoData>> stats = ThreadInfoHelper.getThreadInfoDataMap(infos);
--- a/thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineControllerTest.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTimelineControllerTest.java	Fri Jun 07 11:38:33 2013 -0400
@@ -55,11 +55,10 @@
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.Timer;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.thread.client.common.Timeline;
 import com.redhat.thermostat.thread.client.common.TimelineInfo;
 import com.redhat.thermostat.thread.client.common.chart.ChartColors;
-//import com.redhat.thermostat.thread.client.common.ThreadTimelineBean;
 import com.redhat.thermostat.thread.client.common.collector.ThreadCollector;
 import com.redhat.thermostat.thread.client.common.view.ThreadTableView;
 import com.redhat.thermostat.thread.client.common.view.ThreadTimelineView;
@@ -145,15 +144,15 @@
         action.run();
         
         ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class);
-        ArgumentCaptor<LongRange> rangeCaptor = ArgumentCaptor.forClass(LongRange.class);
+        ArgumentCaptor<Range> rangeCaptor = ArgumentCaptor.forClass(Range.class);
 
         verify(view).displayStats(listCaptor.capture(), rangeCaptor.capture());
         
         List viewResult = listCaptor.getValue();
-        LongRange rangeResult = rangeCaptor.getValue();
+        Range<Long> rangeResult = rangeCaptor.getValue();
         assertEquals(2, viewResult.size());
-        assertEquals(100, rangeResult.getMin());
-        assertEquals(3000, rangeResult.getMax());
+        assertEquals(100l, (long) rangeResult.getMin());
+        assertEquals(3000l, (long) rangeResult.getMax());
 
         Timeline timeline = (Timeline) viewResult.get(0);
         assertEquals(2, timeline.getId());
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadTimelineView.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadTimelineView.java	Fri Jun 07 11:38:33 2013 -0400
@@ -38,7 +38,6 @@
 
 import java.awt.BorderLayout;
 import java.awt.Component;
-
 import java.util.List;
 
 import javax.swing.DefaultListModel;
@@ -52,14 +51,10 @@
 
 import com.redhat.thermostat.client.swing.ComponentVisibleListener;
 import com.redhat.thermostat.client.swing.SwingComponent;
-
 import com.redhat.thermostat.client.swing.components.timeline.TimelineRulerHeader;
-
-import com.redhat.thermostat.common.model.LongRange;
-
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.thread.client.common.Timeline;
 import com.redhat.thermostat.thread.client.common.view.ThreadTimelineView;
-
 import com.redhat.thermostat.thread.client.swing.impl.timeline.ThreadTimelineHeader;
 import com.redhat.thermostat.thread.client.swing.impl.timeline.TimelineCellRenderer;
 import com.redhat.thermostat.thread.client.swing.impl.timeline.TimelineComponent;
@@ -115,7 +110,7 @@
         scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
 
         long now = System.currentTimeMillis();
-        header = new ThreadTimelineHeader(new LongRange(now, now + TimelineRulerHeader.DEFAULT_INCREMENT_IN_MILLIS),
+        header = new ThreadTimelineHeader(new Range<Long>(now, now + TimelineRulerHeader.DEFAULT_INCREMENT_IN_MILLIS),
                                           scrollPane);
         scrollPane.setColumnHeaderView(header);
 
@@ -146,7 +141,7 @@
     }
     
     @Override
-    public void displayStats(final List<Timeline> timelines, final LongRange range) {
+    public void displayStats(final List<Timeline> timelines, final Range<Long> range) {
                 
         SwingUtilities.invokeLater(new Runnable() {
             @Override
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/ThreadTimelineHeader.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/ThreadTimelineHeader.java	Fri Jun 07 11:38:33 2013 -0400
@@ -39,7 +39,7 @@
 import javax.swing.JScrollPane;
 
 import com.redhat.thermostat.client.swing.components.timeline.TimelineRulerHeader;
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 
 /**
  *
@@ -49,7 +49,7 @@
 
     private JScrollPane scrollpane;
     
-    public ThreadTimelineHeader(LongRange range, JScrollPane scrollpane) {
+    public ThreadTimelineHeader(Range<Long> range, JScrollPane scrollpane) {
         super(range);
         this.scrollpane = scrollpane;
     }
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/TimelineComponent.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/timeline/TimelineComponent.java	Fri Jun 07 11:38:33 2013 -0400
@@ -46,24 +46,14 @@
 import java.awt.Rectangle;
 import java.beans.Transient;
 
-import javax.swing.DefaultListModel;
-import javax.swing.JFrame;
-import javax.swing.JList;
 import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 
 import com.redhat.thermostat.client.swing.GraphicsUtils;
 import com.redhat.thermostat.client.swing.components.GradientPanel;
-
 import com.redhat.thermostat.client.swing.components.timeline.TimelineUtils;
-
 import com.redhat.thermostat.client.ui.Palette;
-
-import com.redhat.thermostat.common.model.LongRange;
 import com.redhat.thermostat.common.model.LongRangeNormalizer;
-
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.thread.client.common.Timeline;
 import com.redhat.thermostat.thread.client.common.TimelineInfo;
 
@@ -74,12 +64,12 @@
     
     private Timeline timeline;
     private JScrollPane scrollPane;
-    private LongRange range;
+    private Range<Long> range;
     
     private long millsUnitIncrement;
     private int pixelUnitIncrement;
     
-    public TimelineComponent(LongRange range, Timeline timeline, JScrollPane scrollPane)
+    public TimelineComponent(Range<Long> range, Timeline timeline, JScrollPane scrollPane)
     {
         super(Palette.LIGHT_GRAY.getColor(), Palette.WHITE.getColor());
         this.range = range;
@@ -210,7 +200,7 @@
         }
     }
     
-    public LongRange getRange() {
+    public Range<Long> getRange() {
         return range;
     }
     
--- a/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/stats/HeapChartPanelLayout.java	Fri Jun 07 11:29:06 2013 -0400
+++ b/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/stats/HeapChartPanelLayout.java	Fri Jun 07 11:38:33 2013 -0400
@@ -46,7 +46,7 @@
 import org.jfree.chart.axis.DateAxis;
 import org.jfree.chart.plot.XYPlot;
 
-import com.redhat.thermostat.common.model.LongRange;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.common.model.LongRangeNormalizer;
 
 /**
@@ -88,7 +88,7 @@
             long max = domainAxis.getMaximumDate().getTime();
             long min = domainAxis.getMinimumDate().getTime();
 
-            LongRange offset = new LongRange(min, max); 
+            Range<Long> offset = new Range<Long>(min, max);
             
             LongRangeNormalizer normaliser = new LongRangeNormalizer(offset);
             chartPanel.getScreenDataArea();