Class Condition

java.lang.Object
  |
  +--Condition

class Condition
extends java.lang.Object

This class represents an individual Condition list of hybridized sample entries. It holds the static list database of all active Conditions as well as data structures for defining ordered lists of Condition lists. This is useful for creating ordered lists of replicate samples. There are methods for creating, removing, testing, etc. these data structures.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/04/28 18:45:16 $ $Revision: 1.30 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, MaHybridSample

Field Summary
(package private) static int cfNparams
          # of condition parameters
(package private) static java.lang.String[] cfParamNames
          [0:cfNparams-1] list of condition parameter names for CondForm
(package private) static java.lang.String[][] cfParamValues
          [0:nCondLists-1][0:cfNparams-1] list of condition parameter values for CondForm
(package private)  java.lang.String cName
          name of condition list
(package private) static Condition[] condList
          [0:nCondLists-1] list of condLists'
(package private) static java.lang.String[] condNames
          [0:nCondLists-1] list of names of the conditions
(package private) static int curCondIdx
          Current condition which was the last condition selected by the PopupConditionChooser.
(package private) static int curOCLidx
          Current OCL which was the last OCL selected by the PopupOrderedCondChooser.
private static MAExplorer mae
          link to global MAExplorer instance
(package private) static int MAX_COND_LISTS
          maximum number of # of condition lists slots available.
(package private) static int MAX_ORDERED_COND_LISTS
          maximum number of # of ordered condition lists slots available.
(package private) static int maxOrderedCondLists
          max # of ordered condition lists that have been created.
(package private)  MaHybridSample[] msCond
          [0:nMScond-1] elements of the list
(package private) static int nCondLists
          # of condition lists
(package private)  int nMScond
          # of entries in the list
(package private) static int[] nOrderedCondList
          # of conditions in each of the ordered condition lists [0:maxOrderedCondLists-1]
(package private) static int oclNparams
          # of ordered condition list parameters
(package private) static java.lang.String[] oclParamNames
          [0:oclNparams-1] list of OCL parameter names for CondForm
(package private) static java.lang.String[][] oclParamValues
          [0:maxOrderedCondLists-1][0:oclNparams-1] list of OCL parameter values for CondForm
(package private) static Condition[][] orderedCondList
          Database orderedCondList (OCL) list of all order sample condition lists [0:maxOrderedCondLists][1:nConditions] for all active samples.
(package private) static java.lang.String[] orderedCondListName
          Names of ordered condition lists [0:maxOrderedCondLists-1]
 
Constructor Summary
(package private) Condition(MAExplorer maE, java.lang.String condName, boolean intitalParamFlag)
          Condition() - constructor to create a new named sample Condition list.
(package private) Condition(java.lang.String condName)
          Condition() - constructor to create a new empty named Condition list.
(package private) Condition(java.lang.String condName, MaHybridSample[] msList, int msListLength, int offset)
          Condition() - constructor to create a new condition with list of samples.
 
Method Summary
(package private)  boolean addConditionToOrderedCondList(Condition cd, java.lang.String oCondListName)
          addConditionToOrderedCondList() - add condition to named ordered condition list.
(package private)  int addCondList(java.lang.String conditionName, MaHybridSample[] msList, int msListLength, int offset)
          addCondList() - add conditionName Condition list with msList[] data
(package private)  boolean addHPtoCondList(MaHybridSample ms)
          addHPtoCondList() - add Sample to condition list.
(package private)  void cleanup()
          cleanup() - cleanup global static allocated variables in this class.
(package private)  boolean createNewNamedOrderedCondList(java.lang.String oCondListName)
          createNewNamedOrderedCondList() - create new named ordered condition list if it does not already exist - in which case do nothing.
(package private)  Condition difference(Condition cond1, Condition cond2, java.lang.String newName)
          difference() - compute difference of two conditions cond1 and cond2.
(package private) static Condition getConditionByName(java.lang.String condListName)
          getConditionByName() - lookup Condition entry by name
(package private)  int getConditionIdxInOrderedCondList(Condition cd, java.lang.String oCondListName)
          getConditionIdxInOrderedCondList() - get condition index in named ordered condition list.
(package private)  int getCondListLength()
          getCondListLength() - get Condition list length
(package private)  java.lang.String getCondListName()
          getCondListName() - get Condition list name
(package private)  MaHybridSample[] getHPlist()
          getHPlist() - get sample list for condition [1:nMScond]
(package private)  java.lang.String getListCondListsStr()
          getListCondListsStr() - get a list of the names of the Condition lists
(package private)  void initCondition(java.lang.String condName)
          initCondition() - initialize Condition list to empty - i.e.
(package private)  Condition intersection(Condition cond1, Condition cond2, java.lang.String newName)
          intersection() - compute intersection of two conditions cond1 and cond2.
(package private)  boolean isConditionInOrderedCondList(Condition cd, java.lang.String oCondListName)
          isConditionInOrderedCondList() - test if condition is in named ordered condition list.
(package private)  boolean isHPinCondList(MaHybridSample ms)
          isHPinCondList() - is Sample in condition list
(package private) static boolean isInCondList(java.lang.String condListName)
          isInCondList() - tests if this is the name of a condition list
(package private)  boolean isOrderedCondList(java.lang.String oCondListName)
          isOrderedCondList() - test if is named ordered condition list.
 boolean listAllOrderedConditions()
          listAllOrderedConditions() - popup a report showing list of all OCLs
(package private)  boolean listCondition(java.lang.String userName)
          listCondition() - popup a window listing of all samples in the named Condition lists
(package private)  void listCondLists()
          listCondLists() - popup a window listing of all Condition lists in database
(package private)  boolean listOrderedCondition(java.lang.String oclName)
          listOrderedCondition() - popup a window listing of all Conditions in the Ordered Condition list
(package private) static int lookupCondListIdxByName(java.lang.String userListName, boolean exactFlag)
          lookupCondListIdxByName() - lookup a Condition by name and return the index.
(package private)  Condition[] lookupNamedOrderedCondList(java.lang.String oCondListName)
          lookupNamedOrderedCondList() - lookup named ordered condition list
(package private)  int lookupNamedOrderedCondListIdx(java.lang.String oCondListName)
          lookupNamedOrderedCondListIdx() - lookup named ordered condition list index
(package private)  boolean removeNamedOrderedCondList(java.lang.String oCondListName)
          removeNamedOrderedCondList() - remove existing named ordered list of conditions if it exists.
(package private)  boolean renameCondList(java.lang.String conditionName, java.lang.String newCondName, boolean useExactMatch)
          renameCondList() - rename conditionName if it exists to newCondName
(package private)  java.lang.String[] returnListOfCondsForOCL(java.lang.String oclName)
          returnListOfCondsForOCL() - return list of conditions
(package private)  boolean rmvConditionFromOrderedCondList(Condition cd, java.lang.String oCondListName)
          rmvConditionFromOrderedCondList() - remove condition from named ordered condition list.
(package private)  boolean rmvCondList(java.lang.String conditionName, boolean useExactMatch, boolean rmvCorrespondingParamFlag)
          rmvCondList() - remove conditionName from the list of Condition lists if it exists.
(package private)  boolean rmvHPfromCondList(MaHybridSample ms)
          rmvHPfromCondList() - remove Sample from condition list
(package private)  Condition union(Condition cond1, Condition cond2, java.lang.String newName)
          union() - compute union of two conditions cond1 and cond2.
(package private)  void updateListCondLists()
          updateListCondLists() - update existing Condition list window, else nop
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private static MAExplorer mae
link to global MAExplorer instance

MAX_COND_LISTS

static final int MAX_COND_LISTS
maximum number of # of condition lists slots available.

MAX_ORDERED_COND_LISTS

static final int MAX_ORDERED_COND_LISTS
maximum number of # of ordered condition lists slots available.

nCondLists

static int nCondLists
# of condition lists

condList

static Condition[] condList
[0:nCondLists-1] list of condLists'

condNames

static java.lang.String[] condNames
[0:nCondLists-1] list of names of the conditions

cfParamNames

static java.lang.String[] cfParamNames
[0:cfNparams-1] list of condition parameter names for CondForm

cfParamValues

static java.lang.String[][] cfParamValues
[0:nCondLists-1][0:cfNparams-1] list of condition parameter values for CondForm

cfNparams

static int cfNparams
# of condition parameters

curCondIdx

static int curCondIdx
Current condition which was the last condition selected by the PopupConditionChooser. If it is undefined, then it is set to -1. Note: this index is into the condList[] and CondNames[] etc DB.

curOCLidx

static int curOCLidx
Current OCL which was the last OCL selected by the PopupOrderedCondChooser. If it is undefined, then it is set to -1. Note: this index is into the orderedCondList[] and orderedCondListName[] etc DB.

cName

java.lang.String cName
name of condition list

msCond

MaHybridSample[] msCond
[0:nMScond-1] elements of the list

nMScond

int nMScond
# of entries in the list

orderedCondList

static Condition[][] orderedCondList
Database orderedCondList (OCL) list of all order sample condition lists [0:maxOrderedCondLists][1:nConditions] for all active samples.
   E.g., if ck are Condition instances, then
  OCL[0] = (c1,c2,c3,c4)
  OCL[1] = (c5,c6,c7,c8)
     . . .
  OCL[maxOrderedCondLists-1] = (c9,c10)

 E.g., the jth instance of orderedCondList[j] is an array instance of 
  size nOrderedCondList[j] conditions i.e. 
      OCL[j]= new Condition[ nOrderedCondList[j] ];

 The name of thejth OCL ius  orderedCondListName[j].

 The initial OCL DB is allocated as an empty 2D array in the Constructor   
     orderedCondList= new Condition[MAX_ORDERED_COND_LISTS][];

 Then, OCL instances are added using createNewNamedOrderedCondList().

orderedCondListName

static java.lang.String[] orderedCondListName
Names of ordered condition lists [0:maxOrderedCondLists-1]

nOrderedCondList

static int[] nOrderedCondList
# of conditions in each of the ordered condition lists [0:maxOrderedCondLists-1]

maxOrderedCondLists

static int maxOrderedCondLists
max # of ordered condition lists that have been created.

oclParamNames

static java.lang.String[] oclParamNames
[0:oclNparams-1] list of OCL parameter names for CondForm

oclParamValues

static java.lang.String[][] oclParamValues
[0:maxOrderedCondLists-1][0:oclNparams-1] list of OCL parameter values for CondForm

oclNparams

static int oclNparams
# of ordered condition list parameters
Constructor Detail

Condition

Condition(MAExplorer maE,
          java.lang.String condName,
          boolean intitalParamFlag)
Condition() - constructor to create a new named sample Condition list. Also setup the database the first time it is called.
Parameters:
maE - is the MAExplorer instance
condName - of new condition
See Also:
initCondition(java.lang.String)

Condition

Condition(java.lang.String condName)
Condition() - constructor to create a new empty named Condition list.
Parameters:
condName - of new condition
See Also:
initCondition(java.lang.String)

Condition

Condition(java.lang.String condName,
          MaHybridSample[] msList,
          int msListLength,
          int offset)
Condition() - constructor to create a new condition with list of samples.
Parameters:
condName - of new condition
msList - is list of samples
msListLength - is # of samples
offset - if the msList starts at [0] or [1], so is 0 or 1. It is 0 if cond.msCond[] 1 if mae.hps.msList[].
See Also:
addCondList(java.lang.String, MaHybridSample[], int, int)
Method Detail

initCondition

void initCondition(java.lang.String condName)
initCondition() - initialize Condition list to empty - i.e. no samples.
Parameters:
condName - of new condition
See Also:
MaHybridSample

isInCondList

static boolean isInCondList(java.lang.String condListName)
isInCondList() - tests if this is the name of a condition list
Parameters:
condName - of condition
Returns:
true if it is a condition
See Also:
lookupCondListIdxByName(java.lang.String, boolean)

getConditionByName

static Condition getConditionByName(java.lang.String condListName)
getConditionByName() - lookup Condition entry by name
Parameters:
condListName - of condition
Returns:
condition corresponding to this name, else null if not a condition
See Also:
lookupCondListIdxByName(java.lang.String, boolean)

lookupCondListIdxByName

static int lookupCondListIdxByName(java.lang.String userListName,
                                   boolean exactFlag)
lookupCondListIdxByName() - lookup a Condition by name and return the index. if it is a numeric string, then return the number, else search the condList's cName's for a match. If exactFlag is set, then do matching ignoring case.
Parameters:
userListName - is partial name of condition that is unique else number
exactFlag - do exact match else startsWith()
Returns:
index of Condition in condList[0:nConditions-1] else -1 if fail

listCondition

boolean listCondition(java.lang.String userName)
listCondition() - popup a window listing of all samples in the named Condition lists
Parameters:
userName - name of condition to access
Returns:
true if succeed
See Also:
ShowStringPopup, getConditionByName(java.lang.String), lookupCondListIdxByName(java.lang.String, boolean)

listCondLists

void listCondLists()
listCondLists() - popup a window listing of all Condition lists in database
See Also:
getListCondListsStr(), ShowStringPopup

updateListCondLists

void updateListCondLists()
updateListCondLists() - update existing Condition list window, else nop
See Also:
PopupRegistry.lookupShowStringPopupInstance(java.lang.String), ShowStringPopup.updateText(java.lang.String), getListCondListsStr()

getListCondListsStr

java.lang.String getListCondListsStr()
getListCondListsStr() - get a list of the names of the Condition lists
Returns:
string report of list of conditions

addCondList

int addCondList(java.lang.String conditionName,
                MaHybridSample[] msList,
                int msListLength,
                int offset)
addCondList() - add conditionName Condition list with msList[] data
Parameters:
conditionName - is condition list to add
msList - is the list of samples specify by a MaHybridSample list
msListLength - is the number of samples in the list
offset - 0 if cond.msCond[] 1 if mae.hps.msList[]
Returns:
idx !=-1 if added the list.
See Also:
lookupCondListIdxByName(java.lang.String, boolean)

rmvCondList

boolean rmvCondList(java.lang.String conditionName,
                    boolean useExactMatch,
                    boolean rmvCorrespondingParamFlag)
rmvCondList() - remove conditionName from the list of Condition lists if it exists. Also update the parameters to keep both synced.
Parameters:
conditionName - is name of Condition to remove
useExactMatch - of user name else use startsWith()
rmvCorrespondingParamFlag - may not want to rmv them here since kept locally in popupchooser
Returns:
true if deleted the list.
See Also:
lookupCondListIdxByName(java.lang.String, boolean)

renameCondList

boolean renameCondList(java.lang.String conditionName,
                       java.lang.String newCondName,
                       boolean useExactMatch)
renameCondList() - rename conditionName if it exists to newCondName
Parameters:
conditionName - is old condition name to rename
newCondName - is the new Condition name to change it to
useExacMatch - of user name else use startsWith()
Returns:
true if successful.
See Also:
lookupCondListIdxByName(java.lang.String, boolean)

addHPtoCondList

boolean addHPtoCondList(MaHybridSample ms)
addHPtoCondList() - add Sample to condition list. Only add it to the list if it is not already present in the list.
Parameters:
ms - is the sample to add to this condition list
Returns:
true if successful.

rmvHPfromCondList

boolean rmvHPfromCondList(MaHybridSample ms)
rmvHPfromCondList() - remove Sample from condition list
Parameters:
ms - is the sample to remove from this condition list
Returns:
true if successful.

isHPinCondList

boolean isHPinCondList(MaHybridSample ms)
isHPinCondList() - is Sample in condition list
Parameters:
ms - is the sample to test to see if it is in this condition list
Returns:
true if successful.

getCondListName

java.lang.String getCondListName()
getCondListName() - get Condition list name
Returns:
name of this condition list

getCondListLength

int getCondListLength()
getCondListLength() - get Condition list length
Returns:
length of this condition list

getHPlist

MaHybridSample[] getHPlist()
getHPlist() - get sample list for condition [1:nMScond]
Returns:
list of MaHybridSample instances in this condition

createNewNamedOrderedCondList

boolean createNewNamedOrderedCondList(java.lang.String oCondListName)
createNewNamedOrderedCondList() - create new named ordered condition list if it does not already exist - in which case do nothing.
Parameters:
oCondListName - is the name of the ordered condition list
Returns:
true if created new ordered condList, false if list already exists.

removeNamedOrderedCondList

boolean removeNamedOrderedCondList(java.lang.String oCondListName)
removeNamedOrderedCondList() - remove existing named ordered list of conditions if it exists.
Parameters:
oCondListName - is the name of the ordered condition list
Returns:
true if removed named condList, false if does not exist.

isConditionInOrderedCondList

boolean isConditionInOrderedCondList(Condition cd,
                                     java.lang.String oCondListName)
isConditionInOrderedCondList() - test if condition is in named ordered condition list.
Parameters:
cd - is condition to test
oCondListName - is the name of the ordered condition list
Returns:
true if the condition is in the ordered condition list

isOrderedCondList

boolean isOrderedCondList(java.lang.String oCondListName)
isOrderedCondList() - test if is named ordered condition list.
Parameters:
cd - is condition to test
oCondListName - is the name of the ordered condition list
Returns:
true if the condition is in the ordered condition list

getConditionIdxInOrderedCondList

int getConditionIdxInOrderedCondList(Condition cd,
                                     java.lang.String oCondListName)
getConditionIdxInOrderedCondList() - get condition index in named ordered condition list.
Parameters:
cd - is condition to test
oCondListName - is the name of the ordered condition list
Returns:
index if found, else -1

addConditionToOrderedCondList

boolean addConditionToOrderedCondList(Condition cd,
                                      java.lang.String oCondListName)
addConditionToOrderedCondList() - add condition to named ordered condition list. The ordered condition list is a list of unique conditions. If the ordered condition list or condition does not exist, then fail. The list must be created (or removed) separately.
Parameters:
cd - is condition to add
oCondListName - is the name of the ordered condition list
Returns:
true if successful
See Also:
createNewNamedOrderedCondList(java.lang.String)

rmvConditionFromOrderedCondList

boolean rmvConditionFromOrderedCondList(Condition cd,
                                        java.lang.String oCondListName)
rmvConditionFromOrderedCondList() - remove condition from named ordered condition list. The ordered condition list is a list of conditions. If the ordered condition list or condition does not exist, then fail. The list must be created (or removed) separately.
Parameters:
cd - is condition list to remove
oCondListName - is the name of the ordered condition list
Returns:
true if condition list removed from the ordered condition list.

lookupNamedOrderedCondList

Condition[] lookupNamedOrderedCondList(java.lang.String oCondListName)
lookupNamedOrderedCondList() - lookup named ordered condition list
Parameters:
oCondListName - is the name of the ordered condition list
Returns:
Condition list else null

lookupNamedOrderedCondListIdx

int lookupNamedOrderedCondListIdx(java.lang.String oCondListName)
lookupNamedOrderedCondListIdx() - lookup named ordered condition list index
Parameters:
oCondListName - is the name of the ordered condition list
Returns:
index if found, else -1

returnListOfCondsForOCL

java.lang.String[] returnListOfCondsForOCL(java.lang.String oclName)
returnListOfCondsForOCL() - return list of conditions
Parameters:
oclName - Ordered Condition List name
Returns:
list of conditions
See Also:
#lookupNamedOrderedCondListIdxByName

listOrderedCondition

boolean listOrderedCondition(java.lang.String oclName)
listOrderedCondition() - popup a window listing of all Conditions in the Ordered Condition list
Parameters:
userName - name of condition to access
Returns:
true if succeed
See Also:
ShowStringPopup, getConditionByName(java.lang.String), lookupCondListIdxByName(java.lang.String, boolean)

listAllOrderedConditions

public final boolean listAllOrderedConditions()
listAllOrderedConditions() - popup a report showing list of all OCLs
Returns:
true if succeed

union

Condition union(Condition cond1,
                Condition cond2,
                java.lang.String newName)
union() - compute union of two conditions cond1 and cond2.
Parameters:
cond1 - is the name of the first condition list
cond2 - is the name of the second condition list
Returns:
computed condition with newName
See Also:
addCondList(java.lang.String, MaHybridSample[], int, int)

intersection

Condition intersection(Condition cond1,
                       Condition cond2,
                       java.lang.String newName)
intersection() - compute intersection of two conditions cond1 and cond2.
Parameters:
cond1 - is the name of the first condition list
cond2 - is the name of the second condition list
Returns:
computed condition with newName
See Also:
addCondList(java.lang.String, MaHybridSample[], int, int)

difference

Condition difference(Condition cond1,
                     Condition cond2,
                     java.lang.String newName)
difference() - compute difference of two conditions cond1 and cond2.
Parameters:
cond1 - is the name of the first condition list
cond2 - is the name of the second condition list
Returns:
computed condition with newName
See Also:
addCondList(java.lang.String, MaHybridSample[], int, int)

cleanup

void cleanup()
cleanup() - cleanup global static allocated variables in this class. If statics are added later to this class, then set them to null here.