Class DateRangeDomain

java.lang.Object
org.openl.domain.DateRangeDomain
All Implemented Interfaces:
Iterable<Date>, IDomain<Date>

public class DateRangeDomain extends Object implements IDomain<Date>
Domain for range of dates.
Author:
PUdalau
  • Constructor Details

    • DateRangeDomain

      public DateRangeDomain(Date min, Date max)
      Creates date range inside the specified bounds(including bounds).
      Parameters:
      min - left bound.
      max - right bound.
  • Method Details

    • getMin

      public Date getMin()
      Returns:
      The left bound of range.
    • getMax

      public Date getMax()
      Returns:
      The right bound of range.
    • setMin

      public void setMin(Date min)
      Sets left bound of range.
    • setMax

      public void setMax(Date max)
      Sets right bound of range.
    • iterator

      public Iterator<Date> iterator()
      Specified by:
      iterator in interface Iterable<Date>
    • daysBetween

      public static long daysBetween(Calendar d1, Calendar d2)
    • size

      public int size()
    • getElementType

      public IType getElementType()
      Specified by:
      getElementType in interface IDomain<Date>
      Returns:
      type that can be used with this domain
    • selectObject

      public boolean selectObject(Date obj)
      Specified by:
      selectObject in interface IDomain<Date>
      Parameters:
      obj -
      Returns:
      true if object belongs to this domain
    • getIndex

      public int getIndex(Date value)
      Parameters:
      value - Date to get index.
      Returns:
      The index of specified date or negative number if specified date does not belong to the range.
    • getValue

      public Date getValue(int index)
      Parameters:
      index - Index of the date.
      Returns:
      Returns The date within the range or null if date with specified index does not belong to the range.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object