edu.upenn.crimson
Class Query

java.lang.Object
  extended by edu.upenn.crimson.Query
All Implemented Interfaces:
java.lang.Cloneable

public class Query
extends java.lang.Object
implements java.lang.Cloneable

Contains query info.

Version:
$Id: Query.java,v 1.44 2009/07/25 03:37:09 fisher Exp $

Field Summary
private  java.lang.String id
          This is a unique name for the Query object.
private  int leafSelection
          LEAF SELECTION: 0 = Select All, 1 = Random Selection, 2 = Select By Temporal Depth (distributed), 3 = Select By Temporal Depth (weighted), 4 = Selection by Level (distributed), 5 = Selection by Level (weighted), 6 = Manual Selection
private  java.util.HashSet leaves
          Set of IDs for the leaves to include.
private  int levelThresh
          Level of the leaves to be selected.
private  java.lang.String notes
          Notes specific to this Query object.
private  int numLeaves
          Number of leaves to include when choosen randomly.
private  int numPositions
          Number of positions (base pairs or codons) to include when choosen randomly.
private  boolean onlyStruct
          When true, no data will be included in the output file (ie the partitions list will be ignored).
private  java.util.HashSet partitions
          This set contains the IDs for the partitions to be queried.
private  java.util.HashSet positions
          Base pair or codon positions to include.
private  boolean saved
          True when the query object has been saved to the database.
private  long seed
          Seed for random number generator.
private  int sequenceSelection
          SEQUENCE SELECTION: 0 = Select All, 1 = Random Codon Selection, 2 = Randon Position Selection, 3 = Manual Codon Selection, 4 = Manual Position Selection, 5 = Select None
private  double tempDepthThresh
          Temporal depth of the leaves to be selected.
private  java.lang.String treeID
          This is the ID for the tree object that this query refers to.
 
Constructor Summary
Query(java.lang.String treeID)
          Create a new Query object.
Query(java.lang.String treeID, java.lang.String id)
          Create a new Query object.
 
Method Summary
 void addLeaf(java.lang.String item)
          Adds a leaf to the leaf list.
 void addPartition(java.lang.String item)
          Adds a partitions to the partitions list.
 void addPosition(java.lang.String item)
          Adds a positions to the positions list.
 void addPositions(java.lang.String items)
          Adds a ':' separated list of positions to the positions list.
 java.lang.Object clone()
          Create a shallow clone (just clone the structure, not the Objects) of the existing object.
 java.lang.Object clone(java.lang.String id)
          Create a shallow clone (just clone the structure, not the Objects) of the existing object.
static java.lang.Object dbLoad(java.util.ArrayList qObj)
          This routine is only meant to be used by Queries when loading Queries from a database without using a proxy (ie CLOBs are not strings).
static void dbLoadProxy(java.lang.StringBuilder queries)
          This routine is only meant to be used by Queries when loading Queries from a database via a proxy.
 java.lang.String getID()
          Set the ID.
 int getLeafSelection()
           
 java.lang.String getLeafSelectionString()
           
 java.util.HashSet getLeaves()
           
 int getLevelThresh()
           
 java.lang.String getNotes()
           
 int getNumLeaves()
           
 int getNumPositions()
           
 java.util.HashSet getPartitions()
           
 java.util.HashSet getPositions()
           
 long getSeed()
           
 int getSequenceSelection()
           
 java.lang.String getSequenceSelectionString()
           
 double getTempDepthThresh()
           
 java.lang.String getTreeID()
           
 boolean isOnlyStruct()
           
 boolean isSaved()
           
 void setLeafSelection(int leafSelection)
           
 void setLeaves(java.util.HashSet leaves)
           
 void setLevelThresh(int levelThresh)
           
 void setNotes(java.lang.String notes)
           
 void setNumLeaves(int numLeaves)
           
 void setNumPositions(int numPositions)
           
 void setOnlyStruct(boolean onlyStruct)
           
 void setPartitions(java.util.HashSet partitions)
           
 void setPositions(java.util.HashSet positions)
           
 void setSaved(boolean saved)
           
 void setSeed(long seed)
           
 void setSequenceSelection(int sequenceSelection)
           
 void setTempDepthThresh(double tempDepthThresh)
           
 boolean setTreeID(java.lang.String treeID)
          Returns true if treeID set, false otherwise.
 java.lang.String toString()
          Returns Query information for debugging purposes.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private java.lang.String id
This is a unique name for the Query object.


notes

private java.lang.String notes
Notes specific to this Query object.


treeID

private java.lang.String treeID
This is the ID for the tree object that this query refers to.


leafSelection

private int leafSelection
LEAF SELECTION: 0 = Select All, 1 = Random Selection, 2 = Select By Temporal Depth (distributed), 3 = Select By Temporal Depth (weighted), 4 = Selection by Level (distributed), 5 = Selection by Level (weighted), 6 = Manual Selection


numLeaves

private int numLeaves
Number of leaves to include when choosen randomly.


tempDepthThresh

private double tempDepthThresh
Temporal depth of the leaves to be selected.


levelThresh

private int levelThresh
Level of the leaves to be selected.


leaves

private java.util.HashSet leaves
Set of IDs for the leaves to include.


sequenceSelection

private int sequenceSelection
SEQUENCE SELECTION: 0 = Select All, 1 = Random Codon Selection, 2 = Randon Position Selection, 3 = Manual Codon Selection, 4 = Manual Position Selection, 5 = Select None


numPositions

private int numPositions
Number of positions (base pairs or codons) to include when choosen randomly.


partitions

private java.util.HashSet partitions
This set contains the IDs for the partitions to be queried.


onlyStruct

private boolean onlyStruct
When true, no data will be included in the output file (ie the partitions list will be ignored).


positions

private java.util.HashSet positions
Base pair or codon positions to include. This is only valid when a single partition is selected.


seed

private long seed
Seed for random number generator. If -1, then will be ignored when the query is run.


saved

private boolean saved
True when the query object has been saved to the database.

Constructor Detail

Query

public Query(java.lang.String treeID)
Create a new Query object.


Query

public Query(java.lang.String treeID,
             java.lang.String id)
      throws InvalidIDException
Create a new Query object.

Throws:
InvalidIDException
Method Detail

getID

public java.lang.String getID()
Set the ID. If the new ID is the same as the current ID, then doesn't do anything. If the new ID already exists in the queryPool, then throws an exception.


setNotes

public void setNotes(java.lang.String notes)

getNotes

public java.lang.String getNotes()

setTreeID

public boolean setTreeID(java.lang.String treeID)
Returns true if treeID set, false otherwise.


getTreeID

public java.lang.String getTreeID()

setLeafSelection

public void setLeafSelection(int leafSelection)

getLeafSelection

public int getLeafSelection()

getLeafSelectionString

public java.lang.String getLeafSelectionString()

setNumLeaves

public void setNumLeaves(int numLeaves)

getNumLeaves

public int getNumLeaves()

setTempDepthThresh

public void setTempDepthThresh(double tempDepthThresh)

getTempDepthThresh

public double getTempDepthThresh()

setLevelThresh

public void setLevelThresh(int levelThresh)

getLevelThresh

public int getLevelThresh()

setLeaves

public void setLeaves(java.util.HashSet leaves)

getLeaves

public java.util.HashSet getLeaves()

setSequenceSelection

public void setSequenceSelection(int sequenceSelection)

getSequenceSelection

public int getSequenceSelection()

getSequenceSelectionString

public java.lang.String getSequenceSelectionString()

setNumPositions

public void setNumPositions(int numPositions)

getNumPositions

public int getNumPositions()

setPartitions

public void setPartitions(java.util.HashSet partitions)

getPartitions

public java.util.HashSet getPartitions()

setOnlyStruct

public void setOnlyStruct(boolean onlyStruct)

isOnlyStruct

public boolean isOnlyStruct()

setPositions

public void setPositions(java.util.HashSet positions)

getPositions

public java.util.HashSet getPositions()

setSeed

public void setSeed(long seed)

getSeed

public long getSeed()

setSaved

public void setSaved(boolean saved)

isSaved

public boolean isSaved()

addLeaf

public void addLeaf(java.lang.String item)
Adds a leaf to the leaf list.


addPartition

public void addPartition(java.lang.String item)
Adds a partitions to the partitions list.


addPosition

public void addPosition(java.lang.String item)
Adds a positions to the positions list.


addPositions

public void addPositions(java.lang.String items)
Adds a ':' separated list of positions to the positions list.


clone

public java.lang.Object clone()
Create a shallow clone (just clone the structure, not the Objects) of the existing object. This will randomly assign the clone's ID, based on the ID for the parent object.

Overrides:
clone in class java.lang.Object

clone

public java.lang.Object clone(java.lang.String id)
Create a shallow clone (just clone the structure, not the Objects) of the existing object.

Notes:
Note sure if this is correct, may need to use ".set()" methods to set the values of the clone.

dbLoadProxy

public static void dbLoadProxy(java.lang.StringBuilder queries)
This routine is only meant to be used by Queries when loading Queries from a database via a proxy. It may change, as needed to accommodate database loading. Queries is expected to contain the output from the following select statement: "SELECT id, tree_id, notes, leaf_select, num_leaves, temp_depth_thresh, level_thresh, seq_select, num_pos, seed, leaves, partitions, positions FROM QUERIES"


dbLoad

public static java.lang.Object dbLoad(java.util.ArrayList qObj)
This routine is only meant to be used by Queries when loading Queries from a database without using a proxy (ie CLOBs are not strings). It may change, as needed to accommodate database loading. qObj is expected to contain the output from the following select statement: "SELECT id, tree_id, notes, leaf_select, num_leaves, temp_depth_thresh, level_thresh, seq_select, num_pos, seed, leaves, partitions, positions FROM QUERIES"


toString

public java.lang.String toString()
Returns Query information for debugging purposes.

Overrides:
toString in class java.lang.Object



Copyright 2006 Stephen Fisher, Susan Davidson, and Junhyong Kim, University of Pennsylvania.