Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 5303

Show
Ignore:
Timestamp:
08/18/08 12:29:31 (3 months ago)
Author:
jegg
Message:

in patientmatching module, added checks that if no pairs are analyzed, random sampling does not give an error

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/patientmatching/src/org/regenstrief/linkage/analysis/RandomSampleAnalyzer.java

    r5244 r5303  
    7676         
    7777        public void analyzeRecordPair(Record[] pair){ 
    78                 if(sample1[pair_count]){ 
     78                if(pair_count < sample1.length && sample1[pair_count]){ 
    7979                        List<Integer> indexes = left_pair_entry.get(Integer.valueOf(pair_count)); 
    8080                        for(int i = 0; i < indexes.size(); i++){ 
     
    9292                } 
    9393                 
    94                 if(sample2[pair_count]){ 
     94                if(pair_count < sample2.length && sample2[pair_count]){ 
    9595                        List<Integer> indexes2 = right_pair_entry.get(Integer.valueOf(pair_count)); 
    9696                        for(int i = 0; i < indexes2.size(); i++){ 
     
    236236                 
    237237                // need to get two sets of random numbers, one for each data source 
    238                 for(int i = 0; i < sampleSize; i++){ 
     238                for(int i = 0; i < sampleSize && max_index > 0; i++){ 
    239239                        int left_index = rand.nextInt(max_index); 
    240240                        int right_index = rand.nextInt(max_index);