Class FormulaRange

java.lang.Object
com.inet.report.FormulaRange
All Implemented Interfaces:
com.inet.report.formula.Evaluable, Serializable

public class FormulaRange extends Object implements com.inet.report.formula.Evaluable, Serializable
This class is the representation of a range, e.g. defined with a formula like '20 to_ 30'. A range can have one or two limits - a lower and/or a higher limit. Either limit can be set to be "inclusive" or "exclusive", that is, itself included in the range or not.
Note that if a range has only one limit, the range includes all values which are greater than the limit (if the limit is the lower limit), or less than the limit accordingly (if the limit is the higher limit).
Examples:
  • 1 _to 2 will include all values between 1 and 2, including the 2 but NOT including 1. This range would be created by calling: new FormulaRange(new Integer(1),new Integer(2),false,true).
  • upfrom_ DateTime(2006,3,1,0,0,0) will include all DateTime values after March 1st, 2006, 12 a.m., not including this datetime itself. This range would be created by calling: new FormulaRange(myDate,null,false,false)
An object of this class will used for the representation of prompt ranges, too. So, if you want to fill the value of a prompt field as range use an object of this class to do this.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The Object that holds the from value of range.
    The Object that holds the to value of range.

    Fields inherited from interface com.inet.report.formula.Evaluable

    ARRAY, BINARY, BOOLEAN, BOOLEAN_ARRAY, CONSTANT_NULL, CURRENCY, CURRENCY_ARRAY, CURRENCY_RANGE, CURRENCY_RANGE_ARRAY, DATE, DATE_ARRAY, DATE_RANGE, DATE_RANGE_ARRAY, DATETIME, DATETIME_ARRAY, DATETIME_RANGE, DATETIME_RANGE_ARRAY, FIELD, ILLEGAL_VALUE_TYPE, NO_RETURN_VALUE, NUMBER, NUMBER_ARRAY, NUMBER_RANGE, NUMBER_RANGE_ARRAY, OBJECT, RANGE, RANGE_ARRAY, STRING, STRING_ARRAY, STRING_RANGE, STRING_RANGE_ARRAY, TIME, TIME_ARRAY, TIME_RANGE, TIME_RANGE_ARRAY, UNDEFINED_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new FormulaRange object.
    FormulaRange(Object from, Object to, boolean includeFrom, boolean includeTo)
    Create a new FormulaRange object.
    FormulaRange(Object from, Object to, Object intervalType)
    Create a new FormulaRange object.
    FormulaRange(Object from, Object to, String intervalType, boolean includeFrom, boolean includeTo)
    Create a new FormulaRange object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkContext(com.inet.report.formula.IFormulaRunner formula, int formulaType)
    FOR INTERNAL USE ONLY
    boolean
    eval(com.inet.report.formula.IFormulaRunner formula)
    FOR INTERNAL USE ONLY
    int
    getEvaluateTime(com.inet.report.formula.IFormulaRunner formula)
    FOR INTERNAL USE ONLY
    Gets the value the range begins with.
    If the range type is Date or Time, the intervalType specifies the part of the Date or Time, that should be used, e.g.
    Gets the value the range ends with.
    int
    getValueType(com.inet.report.formula.IFormulaRunner formula)
    FOR INTERNAL USE ONLY
    final boolean
    Returns whether or not the high limit of this range is inclusive or exclusive.
    final boolean
    Returns whether or not the low limit of this range is inclusive or exclusive.
    com.inet.report.formula.Evaluable
    optimize(com.inet.report.formula.IFormulaRunner formula)
    FOR INTERNAL USE ONLY
    void
    Sets the value the range should begin with.
    final void
    setHighLimitIncluded(boolean includeTo)
    Sets whether or not the high limit of this range is inclusive or exclusive.
    void
    setIntervalType(String intervalType)
    If the range type is Date or Time, the intervalType specifies the part of the Date or Time that should be used for the range, e.g.
    final void
    setLowLimitIncluded(boolean includeFrom)
    Sets whether or not the low limit of this range is inclusive or exclusive.
    void
    setReferencing(com.inet.report.formula.IFormulaRunner formula)
    FOR INTERNAL USE ONLY
    void
    Sets the value the range should end with.
    toSql(com.inet.report.formula.IFormulaRunner formula, com.inet.report.database.sql.SqlSyntax syntax, boolean isPlaceholder, boolean isTopLevel)
    FOR INTERNAL USE ONLY
    Returns a simple string representation of this FormulaRange, using "_to", "to_", "_to_" and "to" to indicate limit inclusion.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • from

      public Object from
      The Object that holds the from value of range.
    • to

      public Object to
      The Object that holds the to value of range.
  • Constructor Details

    • FormulaRange

      public FormulaRange(Object from, Object to, boolean includeFrom, boolean includeTo)
      Create a new FormulaRange object.
      Parameters:
      from - The Object that holds the "from" value of the range
      to - The Object that holds the "to" value of the range
      includeFrom - Whether or not the low limit of this range is inclusive or exclusive.
      includeTo - Whether or not the high limit of this range is inclusive or exclusive.
      Since:
      7.0
    • FormulaRange

      public FormulaRange(Object from, Object to, String intervalType, boolean includeFrom, boolean includeTo)
      Create a new FormulaRange object.
      Parameters:
      from - The Object that holds the from value of range.
      to - The Object that holds the to value of range.
      intervalType - The Object that specifies which part of a Date or Time should be used for range, i.e. "d" for day.
      includeFrom - Whether or not the low limit of this range is to be included in the range
      includeTo - Whether or not the high limit of this range is to be included in the range
      Since:
      7.0
    • FormulaRange

      public FormulaRange(Object from, Object to)
      Creates a new FormulaRange object.
      Parameters:
      from - The Object that holds the from value of range.
      to - The Object that holds the to value of range.
      Since:
      6.0
    • FormulaRange

      public FormulaRange(Object from, Object to, Object intervalType)
      Create a new FormulaRange object.
      Parameters:
      from - The Object that holds the from value of range.
      to - The Object that holds the to value of range.
      intervalType - The Object that specifies which part of a Date or Time should be used for range, i.e. "d" for day.
      Since:
      6.0
  • Method Details

    • isLowLimitIncluded

      public final boolean isLowLimitIncluded()
      Returns whether or not the low limit of this range is inclusive or exclusive.
      Returns:
      Whether or not the low limit of this range is inclusive or exclusive.
      Since:
      7.0
    • setLowLimitIncluded

      public final void setLowLimitIncluded(boolean includeFrom)
      Sets whether or not the low limit of this range is inclusive or exclusive.
      Parameters:
      includeFrom - Whether or not the low limit of this range is inclusive or exclusive.
      Since:
      7.0
    • isHighLimitIncluded

      public final boolean isHighLimitIncluded()
      Returns whether or not the high limit of this range is inclusive or exclusive.
      Returns:
      Whether or not the high limit of this range is inclusive or exclusive.
      Since:
      7.0
    • setHighLimitIncluded

      public final void setHighLimitIncluded(boolean includeTo)
      Sets whether or not the high limit of this range is inclusive or exclusive.
      Parameters:
      includeTo - Whether or not the high limit of this range is inclusive or exclusive.
      Since:
      7.0
    • setFrom

      public void setFrom(Object from)
      Sets the value the range should begin with.
      Parameters:
      from - The value the range should begin with
      Since:
      6.0
    • getFrom

      public Object getFrom()
      Gets the value the range begins with.
      Returns:
      the value the range begins with.
      Since:
      6.0
    • setTo

      public void setTo(Object to)
      Sets the value the range should end with.
      Parameters:
      to - The value the range should end with
      Since:
      6.0
    • getTo

      public Object getTo()
      Gets the value the range ends with.
      Returns:
      the value the range ends with.
      Since:
      6.0
    • setIntervalType

      public void setIntervalType(String intervalType)
      If the range type is Date or Time, the intervalType specifies the part of the Date or Time that should be used for the range, e.g. "d" for Day in Date.
      Parameters:
      intervalType - Interval type to use for date or time ranges. "d", "w", "m" are allowed values.
      Since:
      6.0
    • getIntervalType

      public String getIntervalType()
      If the range type is Date or Time, the intervalType specifies the part of the Date or Time, that should be used, e.g. "d" for Day in Date, "w" for Week, and "m" for Month
      Returns:
      Interval type used for date or time ranges.
      Since:
      6.0
    • eval

      public Object eval(com.inet.report.formula.IFormulaRunner formula)
      FOR INTERNAL USE ONLY
      Specified by:
      eval in interface com.inet.report.formula.Evaluable
      Since:
      6.0
    • getValueType

      public int getValueType(com.inet.report.formula.IFormulaRunner formula) throws ReportException
      FOR INTERNAL USE ONLY
      Specified by:
      getValueType in interface com.inet.report.formula.Evaluable
      Throws:
      ReportException
      Since:
      6.0
    • checkContext

      public void checkContext(com.inet.report.formula.IFormulaRunner formula, int formulaType)
      FOR INTERNAL USE ONLY
      Specified by:
      checkContext in interface com.inet.report.formula.Evaluable
    • getEvaluateTime

      public int getEvaluateTime(com.inet.report.formula.IFormulaRunner formula)
      FOR INTERNAL USE ONLY
      Specified by:
      getEvaluateTime in interface com.inet.report.formula.Evaluable
    • toString

      public String toString()
      Returns a simple string representation of this FormulaRange, using "_to", "to_", "_to_" and "to" to indicate limit inclusion.
      Overrides:
      toString in class Object
      Returns:
      a simple string representation of this FormulaRange
      Since:
      6.0
    • toSql

      public String toSql(com.inet.report.formula.IFormulaRunner formula, com.inet.report.database.sql.SqlSyntax syntax, boolean isPlaceholder, boolean isTopLevel) throws ReportException
      FOR INTERNAL USE ONLY
      Specified by:
      toSql in interface com.inet.report.formula.Evaluable
      Throws:
      ReportException
    • optimize

      public com.inet.report.formula.Evaluable optimize(com.inet.report.formula.IFormulaRunner formula) throws ReportException
      FOR INTERNAL USE ONLY
      Specified by:
      optimize in interface com.inet.report.formula.Evaluable
      Throws:
      ReportException
    • setReferencing

      public void setReferencing(com.inet.report.formula.IFormulaRunner formula)
      FOR INTERNAL USE ONLY
      Specified by:
      setReferencing in interface com.inet.report.formula.Evaluable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object