jsky.catalog
Class SearchCondition

java.lang.Object
  extended by jsky.catalog.SearchCondition
All Implemented Interfaces:
Serializable

public class SearchCondition
extends Object
implements Serializable

Represents a search condition for values in a given table column, or parameters to a query or request. A searchCondition consists of a name (column or parameter name), a min and a max value. If there can be only one value, the min and max values will be equal.

See Also:
Serialized Form

Constructor Summary
SearchCondition(FieldDesc fieldDesc, Comparable val)
          Create a new SearchCondition where x == val for the given column or parameter description.
SearchCondition(FieldDesc fieldDesc, Comparable minVal, boolean minInclusive, Comparable maxVal, boolean maxInclusive)
          Create a new SearchCondition for the given column or parameter description, where the "inclusive" parameters specify whether the min and/or max values are included in the range.
SearchCondition(FieldDesc fieldDesc, Comparable minVal, Comparable maxVal)
          Create a new SearchCondition where minVal <= x <= maxVal for the given column or parameter description.
SearchCondition(FieldDesc fieldDesc, double val)
          Create a new numerical SearchCondition where (x == val) for the given column or parameter description.
SearchCondition(FieldDesc fieldDesc, double minVal, double maxVal)
          Create a new numerical SearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.
SearchCondition(FieldDesc fieldDesc, String val)
          Create a new String SearchCondition where (x == val) for the given column or parameter description.
SearchCondition(FieldDesc fieldDesc, String minVal, String maxVal)
          Create a new String SearchCondition where (minVal <= x <= maxVal) for the given column or parameter description.
 
Method Summary
 FieldDesc getFieldDesc()
          Return the column or parameter description.
 String getId()
          Return the column or parameter id.
 Comparable getMaxVal()
          Return the maximum value (actually a Double or String)
 Comparable getMinVal()
          Return the minimum value (actually a Double or String)
 String getName()
          Return the column or parameter name.
 Comparable getVal()
          Return the value (actually a Double or String)
 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(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(String[] args)
          Test cases
 String toString()
          Return a string representation of this class in the form "name=minVal[,maxVal]"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SearchCondition

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


SearchCondition

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


SearchCondition

public SearchCondition(FieldDesc fieldDesc,
                       Comparable val)
Create a new SearchCondition where x == val for the given column or parameter description.


SearchCondition

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


SearchCondition

public SearchCondition(FieldDesc fieldDesc,
                       double val)
Create a new numerical SearchCondition where (x == val) for the given column or parameter description.


SearchCondition

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


SearchCondition

public SearchCondition(FieldDesc fieldDesc,
                       String val)
Create a new String SearchCondition where (x == val) for the given column or parameter description.

Method Detail

getVal

public Comparable getVal()
Return the value (actually a Double or String)


getMinVal

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


getMaxVal

public 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(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.

getFieldDesc

public FieldDesc getFieldDesc()
Return the column or parameter description.


getName

public String getName()
Return the column or parameter name.


getId

public String getId()
Return the column or parameter id.


isRange

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


toString

public String toString()
Return a string representation of this class in the form "name=minVal[,maxVal]"

Overrides:
toString in class Object

main

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



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.