Class JDFDateTimeRange

java.lang.Object
org.cip4.jdflib.datatypes.JDFRange
org.cip4.jdflib.datatypes.JDFDateTimeRange
All Implemented Interfaces:
JDFBaseDataTypes

public class JDFDateTimeRange extends JDFRange
  • Constructor Details

    • JDFDateTimeRange

      public JDFDateTimeRange()
      Empty range constructor
    • JDFDateTimeRange

      public JDFDateTimeRange(JDFDate x)
      Constructor - creates a DateTime range defined by x ("from x to x")
      Parameters:
      x - boundary of the date/time range
    • JDFDateTimeRange

      public JDFDateTimeRange(JDFDate xmin, JDFDate xmax)
      Constructor - creates a DateTime range defined by xmin and xmax
      Parameters:
      xmin -
      xmax -
    • JDFDateTimeRange

      public JDFDateTimeRange(JDFDateTimeRange r)
      copy constructor
      Parameters:
      r -
    • JDFDateTimeRange

      public JDFDateTimeRange(String s) throws DataFormatException
      Construct a JDFDateTimeRange from a string
      Parameters:
      s -
      Throws:
      DataFormatException - - if the String has not a valid format
  • Method Details

    • init

      protected void init(JDFDate xmin, JDFDate xmax)
      Initialization
      Parameters:
      xmin -
      xmax -
    • createDateTimeRange

      public static JDFDateTimeRange createDateTimeRange(String date)
      factory style constructor that catches all exceptions and returns null if date is invalid
      Parameters:
      date - the formatted date string
      Returns:
      the JDFDate , null if date is not a valid string
    • toString

      public String toString()
      toString
      Overrides:
      toString in class JDFRange
      Returns:
      String
    • getXJDFString

      public String getXJDFString(int precision)
      toString
      Overrides:
      getXJDFString in class JDFRange
      Returns:
      String
    • isValid

      public boolean isValid(String s)
      isValid - validate the given String
      Parameters:
      s - the given string
      Returns:
      boolean - false if the String has not a valid format
    • inRange

      public boolean inRange(JDFDate x)
      inRange - returns true if 'x' is within the range defined by 'this'
      Parameters:
      x - JDFDate that is to be compared with 'this'
      Returns:
      boolean - true if 'x' is within the range defined by 'this'
    • isPartOfRange

      public boolean isPartOfRange(JDFRange ra)
      isPartOfRange - is range 'r' within this range?
      Specified by:
      isPartOfRange in class JDFRange
      Parameters:
      ra - the range to test
      Returns:
      boolean - true if range 'r' is within this range, else false
    • getLeft

      public JDFDate getLeft()
      getLeft - get the left of the two range deliminators xmin ~ xmax
      Returns:
      JDFDate - the left value
    • getRight

      public JDFDate getRight()
      getRight - get the right of the two range deliminators xmin ~ xmax
      Returns:
      JDFDate - the right value
    • setLeft

      public void setLeft(JDFDate x)
      setLeft - sets the left JDFDate object of the range
      Parameters:
      x - the left JDFDate object of the range
    • setRight

      public void setRight(JDFDate x)
      setRight - sets the right JDFDate object of the range
      Parameters:
      x - the right JDFDate object of the range
    • getUpperValue

      public JDFDate getUpperValue()
      getUpperValue - returns the upper value of the bounds
      Returns:
      JDFDate - the upper value of the range
    • getLowerValue

      public JDFDate getLowerValue()
      getLowerValue - returns the lower value of the bounds
      Returns:
      JDFDate - the lower value of the range
    • getRightObject

      protected JDFDate getRightObject()
      Specified by:
      getRightObject in class JDFRange
    • getLeftObject

      protected JDFDate getLeftObject()
      Specified by:
      getLeftObject in class JDFRange
    • inObjectRange

      protected boolean inObjectRange(Object other)
      Overrides:
      inObjectRange in class JDFRange
    • getRightString

      public String getRightString(int precision)
      Overrides:
      getRightString in class JDFRange
    • getLeftString

      public String getLeftString(int precision)
      Overrides:
      getLeftString in class JDFRange