jsky.catalog
Class RangeSearchCondition

java.lang.Object
  extended by jsky.catalog.AbstractSearchCondition
      extended by jsky.catalog.RangeSearchCondition
All Implemented Interfaces:
java.io.Serializable, SearchCondition

public class RangeSearchCondition
extends AbstractSearchCondition

Represents a search condition for a range of values.

See Also:
Serialized Form

Constructor Summary
RangeSearchCondition(FieldDesc fieldDesc, java.lang.Comparable minVal, boolean minInclusive, java.lang.Comparable maxVal, boolean maxInclusive)
          Create a new RangeSearchCondition for the given column or parameter description, where the "inclusive" parameters specify whether the min and/or max values are included in the range.
RangeSearchCondition(FieldDesc fieldDesc, java.lang.Comparable minVal, java.lang.Comparable maxVal)
          Create a new RangeSearchCondition where minVal <= x <= maxVal for the given column or parameter description.
RangeSearchCondition(FieldDesc fieldDesc, double minVal, double maxVal)
          Create a new numerical RangeSearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.
RangeSearchCondition(FieldDesc fieldDesc, java.lang.String minVal, java.lang.String maxVal)
          Create a new String RangeSearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.
 
Method Summary
 java.lang.Comparable getMaxVal()
          Return the maximum value (actually a Double or String)
 java.lang.Comparable getMinVal()
          Return the minimum value (actually a Double or String)
 java.lang.String getValueAsString()
          Return the value as a String in the format "minVal,maxVal" or just "minVal", if minVal=maxVal.
 boolean isMaxInclusive()
          Return True if the condition includes the max value.
 boolean isMinInclusive()
          Return True if the condition includes the min value.
 boolean isRange()
          Return true if this object represents a range.
 boolean isTrueFor(java.lang.Comparable val)
          Return true if the condition is true for the given value.
 boolean isTrueFor(double val)
          Return true if the condition is true for the given numeric value.
static void main(java.lang.String[] args)
          Test cases
 
Methods inherited from class jsky.catalog.AbstractSearchCondition
getFieldDesc, getId, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeSearchCondition

public RangeSearchCondition(FieldDesc fieldDesc,
                            java.lang.Comparable minVal,
                            java.lang.Comparable maxVal)
Create a new RangeSearchCondition where minVal <= x <= maxVal for the given column or parameter description.


RangeSearchCondition

public RangeSearchCondition(FieldDesc fieldDesc,
                            java.lang.Comparable minVal,
                            boolean minInclusive,
                            java.lang.Comparable maxVal,
                            boolean maxInclusive)
Create a new RangeSearchCondition for the given column or parameter description, where the "inclusive" parameters specify whether the min and/or max values are included in the range.


RangeSearchCondition

public RangeSearchCondition(FieldDesc fieldDesc,
                            double minVal,
                            double maxVal)
Create a new numerical RangeSearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.


RangeSearchCondition

public RangeSearchCondition(FieldDesc fieldDesc,
                            java.lang.String minVal,
                            java.lang.String maxVal)
Create a new String RangeSearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.

Method Detail

getMinVal

public java.lang.Comparable getMinVal()
Return the minimum value (actually a Double or String)


getMaxVal

public java.lang.Comparable getMaxVal()
Return the maximum value (actually a Double or String)


isMinInclusive

public boolean isMinInclusive()
Return True if the condition includes the min value.


isMaxInclusive

public boolean isMaxInclusive()
Return True if the condition includes the max value.


isTrueFor

public boolean isTrueFor(java.lang.Comparable val)
Return true if the condition is true for the given value.

Parameters:
val - The value to be checked against the condition.
Returns:
true if the value satisfies the condition.

isTrueFor

public boolean isTrueFor(double val)
Return true if the condition is true for the given numeric value. If the condition was specified as a String, the return value is false.

Parameters:
val - The value to be checked against the condition.
Returns:
true if the value satisfies the condition.

isRange

public boolean isRange()
Return true if this object represents a range.


getValueAsString

public java.lang.String getValueAsString()
Return the value as a String in the format "minVal,maxVal" or just "minVal", if minVal=maxVal.


main

public static void main(java.lang.String[] args)
Test cases