Ignore:
Timestamp:
2003-05-27T15:40:47+12:00 (21 years ago)
Author:
mdewsnip
Message:

Fixed tabbing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/shell/GBuildProgressMonitor.java

    r4293 r4364  
    4646 */
    4747public class GBuildProgressMonitor
    48     implements GShellProgressMonitor {
    49     /** Indicates if the GUI has asked the process this object monitors to stop. */
    50     private boolean stop = false;
    51 
    52     private GImportProgressMonitor import_progress = null;
    53 
    54     private int num_docs = -1;
    55 
    56     private int num_indexes = -1;
    57 
    58     private int state = 0;
     48    implements GShellProgressMonitor {
     49    /** Indicates if the GUI has asked the process this object monitors to stop. */
     50    private boolean stop = false;
     51
     52    private GImportProgressMonitor import_progress = null;
     53
     54    private int num_docs = -1;
     55
     56    private int num_indexes = -1;
     57
     58    private int state = 0;
    5959
    6060     /** The progress bar this monitor updates. */
    61     private JProgressBar progress_bar;
    62 
    63     static final private int MIN = 0;
    64     static final private int MAX = 1000000;
    65 
    66     static final int BASE        =  0;
    67     static final int CTCT        =  1; // Creating the compressed text
    68     static final int CTCT_CTS    =  2; // Creating the compressed text - collecting text statistics
    69     static final int CTCT_CTS_PS =  3; // Creating the compressed text - collecting text statistics - parsed successfully
    70     static final int CTCT_CTCD   =  4; // Creating the compressed text - creating the compression dictionary
    71     static final int CTCT_CTT    =  5; // Creating the compressed text - compressing the text
    72     static final int CTCT_CTT_PS =  6; // Creating the compressed text - compressing the text - parsed successfully
    73     static final int BI          =  7; // Building index
    74     static final int BI_CID      =  8; // Building index - creating index dictionary
    75     static final int BI_CID_PS   =  9; // Building index - creating index dictionary - parsed successfully
    76     static final int BI_ITT      = 10; // Building index - inverting the text
    77     static final int BI_ITT_PS   = 11; // Building index - inverting the text - parsed successfully
    78     static final int BI_CTWF     = 12; // Building index - create the weights file
    79     static final int BI_CODSD    = 13; // Building index - creating 'on-disk' stemmed dictionary
    80     static final int BI_CSI      = 14; // Building index - creating stem indexes
    81     static final int CTID        = 15; // Creating the info database
    82     static final int CTID_PS     = 16; // Creating the info database - parsed successfully
    83     static final int CAF         = 17; // Creating auxiliary files
    84 
    85     static final String BI_STR   = "*** building index";
    86     static final String CTS_STR  = "collecting text statistics";
    87     static final String CTT_STR  = "compressing the text";
    88     static final String CTWF_STR = "create the weights file";
    89     static final String CAF_STR = "creating auxiliary files";
    90     static final String CID_STR  = "creating index dictionary";
    91     static final String CSI_STR  = "creating stem indexes";
    92     static final String CTCT_STR = "*** creating the compressed text";
    93     static final String CTCD_STR = "creating the compression dictionary";
    94     static final String CTID_STR = "*** creating the info database and processing associated files";
    95     static final String CODSD_STR = "creating 'on-disk' stemmed dictionary";
    96     static final String ITT_STR  = "inverting the text";
    97     static final String PS_STR   = "hash";
    98 
    99     public GBuildProgressMonitor(GImportProgressMonitor import_progress) {
    100           this.import_progress = import_progress;
    101           progress_bar = new JProgressBar();
    102           progress_bar.setMaximum(MAX);
    103           progress_bar.setMinimum(MIN);
    104           progress_bar.setValue(MIN);
    105     }
    106 
    107     /** Method to register a new progress bar with this monitor.
     61    private JProgressBar progress_bar;
     62
     63    static final private int MIN = 0;
     64    static final private int MAX = 1000000;
     65
     66    static final int BASE        =  0;
     67    static final int CTCT        =  1; // Creating the compressed text
     68    static final int CTCT_CTS    =  2; // Creating the compressed text - collecting text statistics
     69    static final int CTCT_CTS_PS =  3; // Creating the compressed text - collecting text statistics - parsed successfully
     70    static final int CTCT_CTCD   =  4; // Creating the compressed text - creating the compression dictionary
     71    static final int CTCT_CTT    =  5; // Creating the compressed text - compressing the text
     72    static final int CTCT_CTT_PS =  6; // Creating the compressed text - compressing the text - parsed successfully
     73    static final int BI          =  7; // Building index
     74    static final int BI_CID      =  8; // Building index - creating index dictionary
     75    static final int BI_CID_PS   =  9; // Building index - creating index dictionary - parsed successfully
     76    static final int BI_ITT      = 10; // Building index - inverting the text
     77    static final int BI_ITT_PS   = 11; // Building index - inverting the text - parsed successfully
     78    static final int BI_CTWF     = 12; // Building index - create the weights file
     79    static final int BI_CODSD    = 13; // Building index - creating 'on-disk' stemmed dictionary
     80    static final int BI_CSI      = 14; // Building index - creating stem indexes
     81    static final int CTID        = 15; // Creating the info database
     82    static final int CTID_PS     = 16; // Creating the info database - parsed successfully
     83    static final int CAF         = 17; // Creating auxiliary files
     84
     85    static final String BI_STR   = "*** building index";
     86    static final String CTS_STR  = "collecting text statistics";
     87    static final String CTT_STR  = "compressing the text";
     88    static final String CTWF_STR = "create the weights file";
     89    static final String CAF_STR = "creating auxiliary files";
     90    static final String CID_STR  = "creating index dictionary";
     91    static final String CSI_STR  = "creating stem indexes";
     92    static final String CTCT_STR = "*** creating the compressed text";
     93    static final String CTCD_STR = "creating the compression dictionary";
     94    static final String CTID_STR = "*** creating the info database and processing associated files";
     95    static final String CODSD_STR = "creating 'on-disk' stemmed dictionary";
     96    static final String ITT_STR  = "inverting the text";
     97    static final String PS_STR   = "hash";
     98
     99    public GBuildProgressMonitor(GImportProgressMonitor import_progress) {
     100    this.import_progress = import_progress;
     101    progress_bar = new JProgressBar();
     102    progress_bar.setMaximum(MAX);
     103    progress_bar.setMinimum(MIN);
     104    progress_bar.setValue(MIN);
     105    }
     106
     107    /** Method to register a new progress bar with this monitor.
    108108      * @param progress_bar The new <strong>JProgressBar</strong>.
    109109      */     
    110     public void addProgressBar(JProgressBar progress_bar) {
    111           this.progress_bar = progress_bar;
    112           progress_bar.setMaximum(MAX);
    113           progress_bar.setMinimum(MIN);
    114           progress_bar.setValue(MIN);
    115     }
    116     /** Determine the script exit value according to the progress monitor. This gets around a problem where several script failures actually result with a successful exit value.
     110    public void addProgressBar(JProgressBar progress_bar) {
     111    this.progress_bar = progress_bar;
     112    progress_bar.setMaximum(MAX);
     113    progress_bar.setMinimum(MIN);
     114    progress_bar.setValue(MIN);
     115    }
     116    /** Determine the script exit value according to the progress monitor. This gets around a problem where several script failures actually result with a successful exit value.
    117117      * @return A <i>int</i> with a value of zero if and only if the script was successful.
    118118      */
    119     public int exitValue() {
    120           if(state == BASE) {
    121                 return 0;
    122           }
    123           return 1;
    124     }
    125     /** Method to retrieve whatever control is being used as the progress indicator. Usually a <strong>JProgressBar</strong> but there may be others implemented later.
     119    public int exitValue() {
     120    if(state == BASE) {
     121        return 0;
     122    }
     123    return 1;
     124    }
     125    /** Method to retrieve whatever control is being used as the progress indicator. Usually a <strong>JProgressBar</strong> but there may be others implemented later.
    126126      * @return A <strong>Component</strong> on which the progress of the process is being displayed.
    127127      */
    128     public Component getProgress() {
    129           return progress_bar;
    130     }
    131     /** Method to determine the state of the stop flag, which may be set by the visual component that created this monitor.
     128    public Component getProgress() {
     129    return progress_bar;
     130    }
     131    /** Method to determine the state of the stop flag, which may be set by the visual component that created this monitor.
    132132      * @return A <strong>boolean</strong> indicating if the process has been asked to stop.
    133133      */
    134     public boolean hasSignalledStop() {
    135           return stop;
    136     }
    137     /** Inform the progress bar that it should programatically increment progress by one step. */
    138     public void increment() {
    139           // There is no reason this should be called for a build.
    140     }
    141 
    142     /** This method is used to 'feed in' a line of text captured from the process.
     134    public boolean hasSignalledStop() {
     135    return stop;
     136    }
     137    /** Inform the progress bar that it should programatically increment progress by one step. */
     138    public void increment() {
     139    // There is no reason this should be called for a build.
     140    }
     141
     142    /** This method is used to 'feed in' a line of text captured from the process.
    143143      * @param line A <strong>String</strong> of text captured from either standard out or standard error.
    144144      */
    145     public void parse(String raw_line) {
    146           String line = raw_line.toLowerCase();
    147           // We first check if we can parse, which depends on num_docs > 0 and num_indexes > 0.
    148           if(num_docs > 0 && num_indexes > 0) {
    149                 switch(state) {
    150                 case BASE:
    151                      // We are watching for the beginning of a phase
    152                      if(line.indexOf(CTCT_STR) != -1) {
    153                           // No progress really.
    154                           state = CTCT;
    155                           ///ystem.err.println("CTCT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    156                      }
    157                      else if(line.indexOf(BI_STR) != -1) {
    158                           // Skip the progress up to this point.
    159                           progress_bar.setValue(progress_bar.getValue() + (MAX / (3 + num_indexes)));
    160                           state = BI;
    161                           ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    162                      }
    163                      else if(line.indexOf(CTID_STR) != -1) {
    164                           // Skip the progress up to this point
    165                           progress_bar.setValue(progress_bar.getValue() + (((1 + num_indexes ) * MAX) / (3 + num_indexes)));
    166                           state = CTID;
    167                           ///ystem.err.println("CTID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    168                      }
    169                      else if(line.indexOf(CAF_STR) != -1) {
    170                           // Skip the progres up to this point
    171                           progress_bar.setValue(progress_bar.getValue() + (((2 + num_indexes ) * MAX) / (3 + num_indexes)));
    172                           state = CAF;
    173                           ///ystem.err.println("CAF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    174                      }
    175                      break;
    176                 case CTCT:
    177                      if(line.indexOf(CTS_STR) != -1) {
    178                           // No progress really.
    179                           state = CTCT_CTS;
    180                           ///ystem.err.println("CTS [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    181                      }
    182                      break;
    183                 case CTCT_CTS:
    184                      if(line.indexOf(PS_STR) != -1) {
    185                           // We have finally found something we can increment because of.
    186                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3 * num_docs)));
    187                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3 * num_docs)));
    188                      }
    189                      else if(line.indexOf(CTCD_STR) != -1) {
    190                           state = CTCT_CTCD;
    191                           ///ystem.err.println("CTCD [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    192                      }
    193                      break;
    194                 case CTCT_CTCD:
    195                      if(line.indexOf(CTT_STR) != -1) {
    196                           // Finished creating the compression dictionary.
    197                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3)));
    198                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3)));
    199                           state = CTCT_CTT;
    200                           ///ystem.err.println("CTT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    201                      }
    202                      break;
    203                 case CTCT_CTT:
    204                      if(line.indexOf(PS_STR) != -1) {
    205                           // We have finally found something we can increment because of.
    206                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3 * num_docs)));
    207                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3 * num_docs)));
    208                      }
    209                      else if(line.indexOf(BI_STR) != -1) {
    210                           state = BI;
    211                           ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    212                      }
    213                      break;
    214                 case BI:
    215                      if(line.indexOf(CID_STR) != -1) {
    216                           state = BI_CID;
    217                           ///ystem.err.println("CID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    218                      }
    219                      break;
    220                 case BI_CID:
    221                      if(line.indexOf(PS_STR) != -1) {
    222                           // We have finally found something we can increment because of.
    223                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5 * num_docs)));
    224                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5 * num_docs)));
    225                      }
    226                      else if(line.indexOf(ITT_STR) != -1) {
    227                           state = BI_ITT;
    228                           ///ystem.err.println("ITT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    229                      }
    230                      break;
    231                 case BI_ITT:
    232                      if(line.indexOf(PS_STR) != -1) {
    233                           // We have finally found something we can increment because of.
    234                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5 * num_docs)));
    235                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5 * num_docs)));
    236                      }
    237                      else if(line.indexOf(CTWF_STR) != -1) {
    238                           state = BI_CTWF;
    239                           ///ystem.err.println("CTWF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    240                      }
    241                      break;
    242                 case BI_CTWF:
    243                      if(line.indexOf(CODSD_STR) != -1) {
    244                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
    245                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
    246                           state = BI_CODSD;
    247                           ///ystem.err.println("CODSD [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    248                      }
    249                      break;
    250                 case BI_CODSD:
    251                      if(line.indexOf(CSI_STR) != -1) {
    252                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
    253                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
    254                           state = BI_CSI;
    255                           ///ystem.err.println("CSI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    256                      }
    257                      break;
    258                 case BI_CSI:
    259                      if(line.indexOf(BI_STR) != -1) {
    260                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
    261                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
    262                           state = BI;
    263                           ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    264                      }
    265                      else if(line.indexOf(CTID_STR) != -1) {
    266                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
    267                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
    268                           state = CTID;
    269                           ///ystem.err.println("CTID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    270                      }
    271                      break;
    272                 case CTID:
    273                      if(line.indexOf(PS_STR) != -1) {
    274                           // We have finally found something we can increment because of.
    275                           progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * num_docs)));
    276                           ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * num_docs)));
    277                      }
    278                      else if(line.indexOf(CAF_STR) != -1) {
    279                           state = CAF;
    280                           ///ystem.err.println("CAF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
    281                      }
    282                      break;
    283                 case CAF:
    284                      progress_bar.setValue(MAX);
    285                      state = BASE;
    286                      ///ystem.err.println("Done! 100%");
    287                      break;
    288                 }
    289           }
    290           else {
     145    public void parse(String raw_line) {
     146    String line = raw_line.toLowerCase();
     147    // We first check if we can parse, which depends on num_docs > 0 and num_indexes > 0.
     148    if(num_docs > 0 && num_indexes > 0) {
     149        switch(state) {
     150        case BASE:
     151        // We are watching for the beginning of a phase
     152        if(line.indexOf(CTCT_STR) != -1) {
     153            // No progress really.
     154            state = CTCT;
     155            ///ystem.err.println("CTCT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     156        }
     157        else if(line.indexOf(BI_STR) != -1) {
     158            // Skip the progress up to this point.
     159            progress_bar.setValue(progress_bar.getValue() + (MAX / (3 + num_indexes)));
     160            state = BI;
     161            ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     162        }
     163        else if(line.indexOf(CTID_STR) != -1) {
     164            // Skip the progress up to this point
     165            progress_bar.setValue(progress_bar.getValue() + (((1 + num_indexes ) * MAX) / (3 + num_indexes)));
     166            state = CTID;
     167            ///ystem.err.println("CTID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     168        }
     169        else if(line.indexOf(CAF_STR) != -1) {
     170            // Skip the progres up to this point
     171            progress_bar.setValue(progress_bar.getValue() + (((2 + num_indexes ) * MAX) / (3 + num_indexes)));
     172            state = CAF;
     173            ///ystem.err.println("CAF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     174        }
     175        break;
     176        case CTCT:
     177        if(line.indexOf(CTS_STR) != -1) {
     178            // No progress really.
     179            state = CTCT_CTS;
     180            ///ystem.err.println("CTS [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     181        }
     182        break;
     183        case CTCT_CTS:
     184        if(line.indexOf(PS_STR) != -1) {
     185            // We have finally found something we can increment because of.
     186            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3 * num_docs)));
     187            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3 * num_docs)));
     188        }
     189        else if(line.indexOf(CTCD_STR) != -1) {
     190            state = CTCT_CTCD;
     191            ///ystem.err.println("CTCD [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     192        }
     193        break;
     194        case CTCT_CTCD:
     195        if(line.indexOf(CTT_STR) != -1) {
     196            // Finished creating the compression dictionary.
     197            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3)));
     198            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3)));
     199            state = CTCT_CTT;
     200            ///ystem.err.println("CTT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     201        }
     202        break;
     203        case CTCT_CTT:
     204        if(line.indexOf(PS_STR) != -1) {
     205            // We have finally found something we can increment because of.
     206            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 3 * num_docs)));
     207            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 3 * num_docs)));
     208        }
     209        else if(line.indexOf(BI_STR) != -1) {
     210            state = BI;
     211            ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     212        }
     213        break;
     214        case BI:
     215        if(line.indexOf(CID_STR) != -1) {
     216            state = BI_CID;
     217            ///ystem.err.println("CID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     218        }
     219        break;
     220        case BI_CID:
     221        if(line.indexOf(PS_STR) != -1) {
     222            // We have finally found something we can increment because of.
     223            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5 * num_docs)));
     224            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5 * num_docs)));
     225        }
     226        else if(line.indexOf(ITT_STR) != -1) {
     227            state = BI_ITT;
     228            ///ystem.err.println("ITT [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     229        }
     230        break;
     231        case BI_ITT:
     232        if(line.indexOf(PS_STR) != -1) {
     233            // We have finally found something we can increment because of.
     234            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5 * num_docs)));
     235            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5 * num_docs)));
     236        }
     237        else if(line.indexOf(CTWF_STR) != -1) {
     238            state = BI_CTWF;
     239            ///ystem.err.println("CTWF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     240        }
     241        break;
     242        case BI_CTWF:
     243        if(line.indexOf(CODSD_STR) != -1) {
     244            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
     245            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
     246            state = BI_CODSD;
     247            ///ystem.err.println("CODSD [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     248        }
     249        break;
     250        case BI_CODSD:
     251        if(line.indexOf(CSI_STR) != -1) {
     252            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
     253            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
     254            state = BI_CSI;
     255            ///ystem.err.println("CSI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     256        }
     257        break;
     258        case BI_CSI:
     259        if(line.indexOf(BI_STR) != -1) {
     260            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
     261            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
     262            state = BI;
     263            ///ystem.err.println("BI [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     264        }
     265        else if(line.indexOf(CTID_STR) != -1) {
     266            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * 5)));
     267            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * 5)));
     268            state = CTID;
     269            ///ystem.err.println("CTID [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     270        }
     271        break;
     272        case CTID:
     273        if(line.indexOf(PS_STR) != -1) {
     274            // We have finally found something we can increment because of.
     275            progress_bar.setValue(progress_bar.getValue() + (MAX / ((3 + num_indexes) * num_docs)));
     276            ///ystem.err.println("Increase " + (MAX / ((3 + num_indexes) * num_docs)));
     277        }
     278        else if(line.indexOf(CAF_STR) != -1) {
     279            state = CAF;
     280            ///ystem.err.println("CAF [" + state + "] - " + ((progress_bar.getValue() * 100) / MAX) + "%");
     281        }
     282        break;
     283        case CAF:
     284        progress_bar.setValue(MAX);
     285        state = BASE;
     286        ///ystem.err.println("Done! 100%");
     287        break;
     288        }
     289    }
     290    else {
    291291                ///ystem.err.println("Number of documents = " + num_docs);
    292292                ///ystem.err.println("Number of indexes = " + num_indexes);
    293                 progress_bar.setIndeterminate(true);
    294           }
    295     }
    296 
    297     public void reset() {
    298           state = BASE;
    299           progress_bar.setValue(MIN);
    300           num_docs = -1;
    301           num_indexes = -1;
    302           stop = false;
    303           progress_bar.setIndeterminate(false);
    304     }
    305 
    306     /** Since the creator of this process monitor is actually in the GUI, this class provides the simpliest way to send a cancel process message between the two.
     293        progress_bar.setIndeterminate(true);
     294    }
     295    }
     296
     297    public void reset() {
     298    state = BASE;
     299    progress_bar.setValue(MIN);
     300    num_docs = -1;
     301    num_indexes = -1;
     302    stop = false;
     303    progress_bar.setIndeterminate(false);
     304    }
     305
     306    /** Since the creator of this process monitor is actually in the GUI, this class provides the simpliest way to send a cancel process message between the two.
    307307      * @param state The desired state of the stop flag as a <strong>boolean</strong>.
    308308      */
    309     public void setStop(boolean state) {
    310           stop = state;
    311           progress_bar.setIndeterminate(false);
    312     }
    313     /** This method resets this monitor to the start, reseting the process parsing and progress bar.
     309    public void setStop(boolean state) {
     310    stop = state;
     311    progress_bar.setIndeterminate(false);
     312    }
     313    /** This method resets this monitor to the start, reseting the process parsing and progress bar.
    314314      * TODO Everthing.
    315315      */
    316     public void start() {
    317           progress_bar.setValue(MIN);
    318           num_indexes = Gatherer.g_man.config_pane.getIndexes().size();
    319           num_docs = import_progress.getNumberOfDocuments();
    320     }
    321     /** This method indicates the process is complete.
     316    public void start() {
     317    progress_bar.setValue(MIN);
     318    num_indexes = Gatherer.g_man.config_pane.getIndexes().size();
     319    num_docs = import_progress.getNumberOfDocuments();
     320    }
     321    /** This method indicates the process is complete.
    322322      * TODO Everthing.
    323323      */
    324     public void stop() {
    325           progress_bar.setIndeterminate(false);
    326           progress_bar.setValue(MAX); // Not max, or else it won't blank properly for the next build.
    327     }
     324    public void stop() {
     325    progress_bar.setIndeterminate(false);
     326    progress_bar.setValue(MAX); // Not max, or else it won't blank properly for the next build.
     327    }
    328328}
    329 
    330 
Note: See TracChangeset for help on using the changeset viewer.