hydroScalingAPI.util.database
Class DB_Table

java.lang.Object
  extended by hydroScalingAPI.util.database.DB_Table

public class DB_Table
extends java.lang.Object

A second level building block for the database. The DB_Table groups a number of registers and performs actions on them, such as searchs, retreival, adding and removing, getting value ranges, etc.

Author:
Ricardo Mantilla

Constructor Summary
DB_Table(java.lang.String[] Fields, java.lang.String[] Type)
          Creates a new DB_Table
 
Method Summary
 void addRegister(DB_Register Register)
          Adds a regiter to the table using a pre-defined master index (defined ath the time of the DB_Table construction) or an integer to identyfy the register
 void addRegister(java.lang.String RegisterIndex, DB_Register Register)
          Adds a regiter to the table using a master String unique descriptor
 DB_Register[] compareFieldsTo(java.lang.String[] FieldName, java.lang.Object[] ValueToCompare, int[] ConditionToCheckFor)
          A more general search for registers in the table.
 DB_Register[] findRegister(java.lang.String[] FieldName, java.lang.Object[] ValueToCompare)
          Finds registers in the table that match a set of values criteria in several of its properties (e.g.
 java.lang.String[] getFieldNames()
          Returns a list of the available properties in the registers of the table
 java.lang.Double getMaxValue(java.lang.String FieldName)
          Returns the maximum value for a given "Numeric" Property
 java.lang.Double getMinValue(java.lang.String FieldName)
          Returns the minimum value for a given "Numeric" Property
 DB_Register getRegisterByMainIndex(java.lang.Object ValueToMatch)
          Returns a DB_Register whose main index matches a predetermined keyword
 java.util.Vector getUniqueValues(java.lang.String FieldName)
          Returns a vector of Objects with unique values for a given property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB_Table

public DB_Table(java.lang.String[] Fields,
                java.lang.String[] Type)
Creates a new DB_Table

Parameters:
Fields - The properties that the table will handle
Type - The type associated to each of the properties. Available types are:

Index

Alpha

Numeric

The type determines how search condition are aplied to this object and how to determine the unique values for a given property
Method Detail

addRegister

public void addRegister(java.lang.String RegisterIndex,
                        DB_Register Register)
Adds a regiter to the table using a master String unique descriptor

Parameters:
RegisterIndex - The unique descriptor for the Register to be added
Register - The register to be added

addRegister

public void addRegister(DB_Register Register)
Adds a regiter to the table using a pre-defined master index (defined ath the time of the DB_Table construction) or an integer to identyfy the register

Parameters:
Register - The register to be added

getRegisterByMainIndex

public DB_Register getRegisterByMainIndex(java.lang.Object ValueToMatch)
Returns a DB_Register whose main index matches a predetermined keyword

Parameters:
ValueToMatch - The keyword to be matched
Returns:
The DB_Register found or null value

findRegister

public DB_Register[] findRegister(java.lang.String[] FieldName,
                                  java.lang.Object[] ValueToCompare)
Finds registers in the table that match a set of values criteria in several of its properties (e.g. in a gazetteer find all the "cities" that are in "colorado")

Parameters:
FieldName - The properties to match
ValueToCompare - The values to match
Returns:
The gruop of registers that match the imposed criteria

compareFieldsTo

public DB_Register[] compareFieldsTo(java.lang.String[] FieldName,
                                     java.lang.Object[] ValueToCompare,
                                     int[] ConditionToCheckFor)
A more general search for registers in the table. It compares registers with a a set of criteria in several of its properties. The criteria are:

0: equal to

-1: smaller than

1: greater than

Parameters:
FieldName - The properties to match
ValueToCompare - The values to match
ConditionToCheckFor - The conditions to apply to the reference value
Returns:
The gruop of registers that match the imposed criteria

getMaxValue

public java.lang.Double getMaxValue(java.lang.String FieldName)
Returns the maximum value for a given "Numeric" Property

Parameters:
FieldName - The property to query
Returns:
The maximum value

getMinValue

public java.lang.Double getMinValue(java.lang.String FieldName)
Returns the minimum value for a given "Numeric" Property

Parameters:
FieldName - The property to query
Returns:
The minimum value

getFieldNames

public java.lang.String[] getFieldNames()
Returns a list of the available properties in the registers of the table

Returns:
A String[] with the field names

getUniqueValues

public java.util.Vector getUniqueValues(java.lang.String FieldName)
Returns a vector of Objects with unique values for a given property

Parameters:
FieldName - The property to query
Returns:
The vector of unique values. For "Numeric" type properties a int[] is returned where int[0] is the minimum value and int[1] is the maximum value


CUENCAS was initially developed by Ricardo Mantilla at the University of Colorado under the supervision of Dr. Vijay K. Gupta. We wish to recognize the support from the National Science Fundation.