ca.uhn.cache.impl
Class DateRangeParam

java.lang.Object
  extended byca.uhn.cache.impl.CommonsLangObject
      extended byca.uhn.cache.impl.AbstractQueryParam
          extended byca.uhn.cache.impl.DateRangeParam
All Implemented Interfaces:
java.lang.Comparable, IGroupQueryParam, IQueryParam, java.io.Serializable

public class DateRangeParam
extends AbstractQueryParam
implements IGroupQueryParam

A IQueryParam encompassing a range of dates.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:37 $ by $Author: bryan_tripp $
Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
DateRangeParam(IDimension theDimension, java.util.Date theStart, java.util.Date theEnd)
          Creates a new DateRangeParam.
 
Method Summary
 float getDistance(IQueryParam theParam, IQueryParam theSaturationPoint)
           
 java.util.Date getEnd()
           
static DateRangeParam getInstance(IDimension theDim, java.lang.String theStart, java.lang.String theEnd)
          Factory method for DateRangeParam.
 java.lang.Class getPointParamClass()
           
 java.util.Date getStart()
           
 boolean intersects(IQueryParam theParam)
          
 IQueryParam merge(IQueryParam theParam)
           
 
Methods inherited from class ca.uhn.cache.impl.AbstractQueryParam
compareTo, compatibleWith, getDimension
 
Methods inherited from class ca.uhn.cache.impl.CommonsLangObject
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.uhn.cache.IQueryParam
getDimension
 

Constructor Detail

DateRangeParam

public DateRangeParam(IDimension theDimension,
                      java.util.Date theStart,
                      java.util.Date theEnd)
Creates a new DateRangeParam.

Parameters:
theDimension - The dimension where this parameter is difined.
theStart - The start of the date range, in UTC.
theEnd - The end of the date range, in UTC.
Method Detail

getInstance

public static final DateRangeParam getInstance(IDimension theDim,
                                               java.lang.String theStart,
                                               java.lang.String theEnd)
                                        throws java.text.ParseException
Factory method for DateRangeParam.

Parameters:
theDim - The dimension where this parameter is difined.
theStart - Start date/time represented as a string, where the date will be represented in DateFormat.MEDIUM (MMM dd, yyyy) format and the time in DateFormat.SHORT ("M/d/yy h:mm a") format.
theEnd - End date/time represented as a string, where the date will be represented in DateFormat.MEDIUM (MMM dd, yyyy) format and the time in DateFormat.SHORT ("M/d/yy h:mm a") format.
Returns:
The created DateRangeParam.
Throws:
java.text.ParseException - If either theStart or theEnd date/time could not be parsed. Example:
  DateRangeParam.getInstance( dim, "Jan 21, 2001 12:20 am", "Feb 21, 2004 1:20 am" );
 

getEnd

public java.util.Date getEnd()
Returns:
Returns the end of the range.

getStart

public java.util.Date getStart()
Returns:
Returns the start of the range.

intersects

public boolean intersects(IQueryParam theParam)
Description copied from class: AbstractQueryParam

Specified by:
intersects in interface IQueryParam
Overrides:
intersects in class AbstractQueryParam
See Also:
IQueryParam.intersects(ca.uhn.cache.IQueryParam)

getPointParamClass

public java.lang.Class getPointParamClass()
Specified by:
getPointParamClass in interface IGroupQueryParam
Overrides:
getPointParamClass in class AbstractQueryParam
Returns:
DateParam.class

getDistance

public float getDistance(IQueryParam theParam,
                         IQueryParam theSaturationPoint)
Specified by:
getDistance in interface IQueryParam
Parameters:
theParam - another IQueryParam
theSaturationPoint - distances are normalized (see below) to between zero and 1. This arg is an IQueryParam that indicates what corresponds to a distance of 1 from the origin. For example consider a date-related dimension in which dates over the last week are relevant. The origin would be now, and the saturation point would be one week ago. This parameter can be ignored, and is allowed to be null, for dimensions that are not ordered.
Returns:
the distance between this IQueryParam and the other. The distance is a number between 0 and 1. It is zero if the two IQueryParam intersect, and 1 if they are at opposite ends of an ordered dimension. For dimensions that correspond to some natural ordering, the distance should increase monotonically with the difference in the ordering property (e.g. with an alphabetical dimension, there should be a greater distance between the A chunk and the C chunk than between A and B chunks). For non-ordered dimensions, the distance between any two non-intersecting IQueryParam may be the same. X.getDistance(Y) == Y.getDistance(X).
See Also:
IQueryParam.getDistance(ca.uhn.cache.IQueryParam, ca.uhn.cache.IQueryParam)

merge

public IQueryParam merge(IQueryParam theParam)
Specified by:
merge in interface IQueryParam
Parameters:
theParam - another IQueryParam
Returns:
the result of merging this IQueryParam with the other. This is not necessarily a union. If the dimension has an ordering then the result must encompass all points in both IQueryParam as well as points in between.
See Also:
IQueryParam.merge(ca.uhn.cache.IQueryParam)


Copyright © 2004-2005 University Health Network. All Rights Reserved.