DODS 5.1 API

org.enhydra.dods.cache
Class QueryCacheItemImpl

java.lang.Object
  |
  +--org.enhydra.dods.cache.QueryCacheItemImpl
All Implemented Interfaces:
QueryCacheItem

public class QueryCacheItemImpl
extends java.lang.Object
implements QueryCacheItem

This class is for storing one query and its necessary data, for query array.


Field Summary
 java.util.ArrayList conds
          Array of conditions declared in WHERE part of the query (array of org.enhydra.dods.cache.Condition objects).
 java.util.LinkedHashSet OIds
          Array of data object IDs which are results of the query.
 java.lang.String originDatabase
          Database of the query.
 java.lang.String queryId
          Query id: query in the form of string.
 int time
          Time needed for query execution.
 
Constructor Summary
QueryCacheItemImpl(java.lang.String origDb)
          Constructor (String).
QueryCacheItemImpl(java.lang.String qId, java.util.LinkedHashSet OIds, int time, java.util.ArrayList conditions, java.lang.String origDb)
          Constructor (String, LinkedHashSet, int, ArrayList, String).
 
Method Summary
 void add(GenericDO obj)
          Adds data object obj to array OIds.
 void addCond(Condition cond)
          Add condition to query.
 boolean checkConditions(GenericDO obj)
          Checks whether data object obj satisfies conditions of this query.
 void delete(GenericDO obj)
          Removes data object obj from array OIds, if present.
 java.util.ArrayList getConds()
          Returns array of conditions conds.
 java.util.HashSet getOIds()
          Returns OIds (array of data objects which are the results of the query).
 java.lang.String getOriginDatabase()
          Returns query database.
 java.lang.String getQueryId()
          Returns query id.
 int getTime()
          Returns time needed for query execution.
 void setConds(java.util.ArrayList conds)
          Sets array of conditions.
 void setOIds(java.util.LinkedHashSet OIds)
          Sets OIds (array of data objects which are the results of the query).
 void setQueryId(java.lang.String queryId)
          Sets unique representation of query object.
 void setTime(int time)
          Sets time needed for query execution.
 java.lang.String toString()
          Shows content of this class.
 void update(GenericDO obj)
          Inserts data object obj (or updates it if already exists) in array OIds, if it satisfies this query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queryId

public java.lang.String queryId
Query id: query in the form of string.


OIds

public java.util.LinkedHashSet OIds
Array of data object IDs which are results of the query.


time

public int time
Time needed for query execution.


conds

public java.util.ArrayList conds
Array of conditions declared in WHERE part of the query (array of org.enhydra.dods.cache.Condition objects).


originDatabase

public java.lang.String originDatabase
Database of the query.

Constructor Detail

QueryCacheItemImpl

public QueryCacheItemImpl(java.lang.String origDb)
Constructor (String).

Parameters:
origDb - query database

QueryCacheItemImpl

public QueryCacheItemImpl(java.lang.String qId,
                          java.util.LinkedHashSet OIds,
                          int time,
                          java.util.ArrayList conditions,
                          java.lang.String origDb)
Constructor (String, LinkedHashSet, int, ArrayList, String).

Parameters:
qId - query id
time - query execution time
conditions - conditions (WHERE part of the query)
origDb - query database
Method Detail

getQueryId

public java.lang.String getQueryId()
Returns query id.

Specified by:
getQueryId in interface QueryCacheItem
Returns:
query id

setQueryId

public void setQueryId(java.lang.String queryId)
Sets unique representation of query object.

Specified by:
setQueryId in interface QueryCacheItem
Parameters:
queryId - String that unique represent query.

getOIds

public java.util.HashSet getOIds()
Returns OIds (array of data objects which are the results of the query).

Specified by:
getOIds in interface QueryCacheItem
Returns:
query array of data objects which are the results of the query

setOIds

public void setOIds(java.util.LinkedHashSet OIds)
Sets OIds (array of data objects which are the results of the query).

Specified by:
setOIds in interface QueryCacheItem

getTime

public int getTime()
Returns time needed for query execution.

Specified by:
getTime in interface QueryCacheItem
Returns:
time needed for query execution

setTime

public void setTime(int time)
Sets time needed for query execution.

Specified by:
setTime in interface QueryCacheItem
Parameters:
time - time needed for query execution

getConds

public java.util.ArrayList getConds()
Returns array of conditions conds.

Specified by:
getConds in interface QueryCacheItem
Returns:
array of conditions

setConds

public void setConds(java.util.ArrayList conds)
Sets array of conditions.

Specified by:
setConds in interface QueryCacheItem
Parameters:
conds - array of conditions

addCond

public void addCond(Condition cond)
Add condition to query.

Specified by:
addCond in interface QueryCacheItem
Parameters:
cond - Condition that will be added to query.

getOriginDatabase

public java.lang.String getOriginDatabase()
Returns query database.

Specified by:
getOriginDatabase in interface QueryCacheItem
Returns:
query database

checkConditions

public boolean checkConditions(GenericDO obj)
Checks whether data object obj satisfies conditions of this query.

Specified by:
checkConditions in interface QueryCacheItem
Parameters:
obj - dataobject for which are checked conditions of this query
Returns:
true if data object obj satisfies conditions of this query, otherwise false.

update

public void update(GenericDO obj)
Inserts data object obj (or updates it if already exists) in array OIds, if it satisfies this query.

Specified by:
update in interface QueryCacheItem
Parameters:
obj - data object which may be inserted (or updated) in array OIds

delete

public void delete(GenericDO obj)
Removes data object obj from array OIds, if present.

Specified by:
delete in interface QueryCacheItem
Parameters:
obj - data object which will be removed from array OIds

add

public void add(GenericDO obj)
Adds data object obj to array OIds.

Specified by:
add in interface QueryCacheItem
Parameters:
obj - data object which will be added to array OIds

toString

public java.lang.String toString()
Shows content of this class. Can be used for debugging.

Overrides:
toString in class java.lang.Object

DODS 5.1 API