1 44 45 package org.jfree.data.time; 46 47 import java.io.Serializable ; 48 import java.text.DateFormat ; 49 import java.util.Date ; 50 51 import org.jfree.data.Range; 52 53 57 public class DateRange extends Range implements Serializable { 58 59 60 private static final long serialVersionUID = -4705682568375418157L; 61 62 63 private Date lowerDate; 64 65 66 private Date upperDate; 67 68 71 public DateRange() { 72 this(new Date (0), new Date (1)); 73 } 74 75 81 public DateRange(Date lower, Date upper) { 82 83 super(lower.getTime(), upper.getTime()); 84 this.lowerDate = lower; 85 this.upperDate = upper; 86 87 } 88 89 96 public DateRange(double lower, double upper) { 97 super(lower, upper); 98 this.lowerDate = new Date ((long) lower); 99 this.upperDate = new Date ((long) upper); 100 } 101 102 110 public DateRange(Range other) { 111 this(other.getLowerBound(), other.getUpperBound()); 112 } 113 114 119 public Date getLowerDate() { 120 return this.lowerDate; 121 } 122 123 128 public Date getUpperDate() { 129 return this.upperDate; 130 } 131 132 137 public String toString() { 138 DateFormat df = DateFormat.getDateTimeInstance(); 139 return "[" + df.format(this.lowerDate) + " --> " 140 + df.format(this.upperDate) + "]"; 141 } 142 143 } 144 | Popular Tags |