org.bioquery.query
Class QueryLine

java.lang.Object
  |
  +--org.bioquery.query.QueryLine
All Implemented Interfaces:
java.io.Serializable

public class QueryLine
extends java.lang.Object
implements java.io.Serializable

This class models each individual line within a Query object. Each Query object will contain a number of QueryLine objects stored in the Query's queryLines List.

Author:
James Brundege
See Also:
Serialized Form

Constructor Summary
protected QueryLine(Query myQuery)
          Creates a QueryLine object with the next available line number associated with the given Query.
protected QueryLine(Query myQuery, int lineNumber)
          Creates a QueryLine object associated with the given Query at the given line number.
protected QueryLine(Query myQuery, int lineNumber, java.lang.String text)
          Creates a QueryLine object associated with the given Query at the given line number and containing the given query text.
protected QueryLine(Query myQuery, java.lang.String text)
          Creates a QueryLine object with the next available line number associated with the given Query and containing the given query text.
 
Method Summary
 java.util.List getAllValues()
          Returns an ArrayList of String objects that represent the 4 paramaters that define a QueryLine: Line number Query line text number of results date last submitted The List contains these 4 Strings in the order given above.
 java.util.Date getLastSubmitted()
          Returns the time and date that this QueryLine was last submitted.
 int getLineNumber()
          Returns the line number associated with this QueryLine.
 int getNumReturned()
          Returns the number of items in the result set of this QueryLine.
 Query getQuery()
          Returns the Query that this QueryLine is part of.
 javax.swing.text.Document getQueryLineDocument()
          Returns the underlying Document that holds the query Text.
 java.lang.String getQueryText()
          Returns the actual text of this QueryLine.
 boolean getUpdateNeeded()
          Returns true if this QueryLine has been modified and needs to have it's data updated.
 void setLastSubmitted(java.util.Date lastSubmitted)
          Sets the time and date that this QueryLine was last submitted.
 void setLineNumber(int lineNum)
          Sets the line number associated with this QueryLine.
 void setNumReturned(int numReturned)
          Sets the number of items in the result set of this QueryLine.
 void setQueryText(java.lang.String text)
          Sets the actual text of this QueryLine.
 void setUpdateNeeded(boolean update)
          Sets the updateNeeded status of the QueryLine.
 java.lang.String toString()
          Returns a single string object that consists of a tab-delimited list of the 4 paramaters that define a QueryLine:
 void updateSubmission(int numReturned, java.util.Date lastSubmitted)
          Sets both the time of submission and the number of items in the result set of this QueryLine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryLine

protected QueryLine(Query myQuery)
Creates a QueryLine object with the next available line number associated with the given Query.
Parameters:
myQuery - The Query that instantiates and owns this QueryLine.

QueryLine

protected QueryLine(Query myQuery,
                    int lineNumber)
Creates a QueryLine object associated with the given Query at the given line number.
Parameters:
myQuery - The Query that instantiates and owns this QueryLine.
lineNumber - The line number of this QueryLine.

QueryLine

protected QueryLine(Query myQuery,
                    java.lang.String text)
Creates a QueryLine object with the next available line number associated with the given Query and containing the given query text.
Parameters:
myQuery - The Query that instantiates and owns this QueryLine.
queryLine - The text of this QueryLine.

QueryLine

protected QueryLine(Query myQuery,
                    int lineNumber,
                    java.lang.String text)
Creates a QueryLine object associated with the given Query at the given line number and containing the given query text.
Parameters:
myQuery - The Query that instantiates and owns this QueryLine.
lineNumber - The line number of this QueryLine.
queryLine - The text of this QueryLine.
Method Detail

getQuery

public Query getQuery()
Returns the Query that this QueryLine is part of.

setLineNumber

public void setLineNumber(int lineNum)
Sets the line number associated with this QueryLine. Note: This is the line number that is displayed. It is always one greater than the index number of the QueryLine's position in it's Query's queryLines ArrayList.
Parameters:
lineNum - The line number displayed for this QueryLine.

getLineNumber

public int getLineNumber()
Returns the line number associated with this QueryLine. Note: This is the line number that is displayed. It is always one greater than the index number of the QueryLine's position in it's Query's queryLines ArrayList.

setQueryText

public void setQueryText(java.lang.String text)
Sets the actual text of this QueryLine. The text is assumed to be in the BioQuery standard format: term[field] AND/OR/NOT #line_number optional_parentheses

Conversion from this format to a format suitable for submission to the database is the responsibility of the QuerySubmitter.

This method automatically sets updateNeeded to true for this QueryLine.

Parameters:
queryText - The query text that makes up this QueryLine.

getQueryText

public java.lang.String getQueryText()
Returns the actual text of this QueryLine. The text is assumed to be in the BioQuery standard format: term[field] AND/OR/NOT #line_number optional parentheses Conversion from this format to a format suitable for submission to the database is the responsibility of the QuerySubmitter.

getQueryLineDocument

public javax.swing.text.Document getQueryLineDocument()
Returns the underlying Document that holds the query Text.

setNumReturned

public void setNumReturned(int numReturned)
Sets the number of items in the result set of this QueryLine. This number will vary and is dependent on the date of submission due to periodic updates in most databases. It should always be modified together with the lastSubmitted field. It is the QuerySubmitter's responsibility to actually submit this QueryLine and determine the number of returned items.
Parameters:
numReturned - The number of items returned when this QueryLine is submitted.

getNumReturned

public int getNumReturned()
Returns the number of items in the result set of this QueryLine. This number depends on the date of submission, and is not updated each time the method is called. It is the QuerySubmitter's responsibility to actually submit this QueryLine and determine the number of returned items.

setLastSubmitted

public void setLastSubmitted(java.util.Date lastSubmitted)
Sets the time and date that this QueryLine was last submitted. This date should always be modified together with the lastSubmitted field. The date is determined by the computer running the GUI or that otherwise makes the initial request for submission of the QueryLine (i.e. the QuerySubmitter). It is the QuerySubmitter's responsibility to actually submit the QueryLine.
Parameters:
lastSubmitted - A Date object instantiated at the time of submission.

getLastSubmitted

public java.util.Date getLastSubmitted()
Returns the time and date that this QueryLine was last submitted.

updateSubmission

public void updateSubmission(int numReturned,
                             java.util.Date lastSubmitted)
Sets both the time of submission and the number of items in the result set of this QueryLine. It is the QuerySubmitter's responsibility to actually submit this QueryLine and determine the number of returned items.
Parameters:
numReturned - The number of items returned when this QueryLine is submitted.

getUpdateNeeded

public boolean getUpdateNeeded()
Returns true if this QueryLine has been modified and needs to have it's data updated. This is typically used by a program that submits each QueryLine every time it is changed and displays the number of items returned by the QueryLine's text.

setUpdateNeeded

public void setUpdateNeeded(boolean update)
Sets the updateNeeded status of the QueryLine. Typically the updateNeeded status should be set to 'true' whenever the QueryLine is modified, and 'false' when the QueryLine has been submitted to the database and an accurate count of returned items has been obtained.

getAllValues

public java.util.List getAllValues()
Returns an ArrayList of String objects that represent the 4 paramaters that define a QueryLine: The List contains these 4 Strings in the order given above.

toString

public java.lang.String toString()
Returns a single string object that consists of a tab-delimited list of the 4 paramaters that define a QueryLine:
  Line_number   Query_line_text   number_of_results   date_last_submitted.
  
Overrides:
toString in class java.lang.Object