Tesseract  3.02
tesseract::ParagraphTheory Class Reference

#include <paragraphs_internal.h>

List of all members.

Public Member Functions

 ParagraphTheory (GenericVector< ParagraphModel * > *models)
GenericVector< ParagraphModel * > & models ()
const GenericVector
< ParagraphModel * > & 
models () const
const ParagraphModelAddModel (const ParagraphModel &model)
void DiscardUnusedModels (const SetOfModels &used_models)
void NonCenteredModels (SetOfModels *models)
const ParagraphModelFits (const GenericVector< RowScratchRegisters > *rows, int start, int end) const
int IndexOf (const ParagraphModel *model) const

Detailed Description

Definition at line 189 of file paragraphs_internal.h.


Constructor & Destructor Documentation

tesseract::ParagraphTheory::ParagraphTheory ( GenericVector< ParagraphModel * > *  models) [inline, explicit]

Definition at line 193 of file paragraphs_internal.h.

      : models_(models) {}

Member Function Documentation

const ParagraphModel * tesseract::ParagraphTheory::AddModel ( const ParagraphModel model)

Definition at line 1163 of file paragraphs.cpp.

                                                                           {
  for (int i = 0; i < models_->size(); i++) {
    if ((*models_)[i]->Comparable(model))
      return (*models_)[i];
  }
  ParagraphModel *m = new ParagraphModel(model);
  models_->push_back(m);
  models_we_added_.push_back_new(m);
  return m;
}
void tesseract::ParagraphTheory::DiscardUnusedModels ( const SetOfModels used_models)

Definition at line 1174 of file paragraphs.cpp.

                                                                        {
  for (int i = models_->size() - 1; i >= 0; i--) {
    ParagraphModel *m = (*models_)[i];
    if (!used_models.contains(m) && models_we_added_.contains(m)) {
      delete m;
      models_->remove(i);
      models_we_added_.remove(models_we_added_.get_index(m));
    }
  }
}
const ParagraphModel * tesseract::ParagraphTheory::Fits ( const GenericVector< RowScratchRegisters > *  rows,
int  start,
int  end 
) const

Definition at line 1188 of file paragraphs.cpp.

                                                                              {
  for (int m = 0; m < models_->size(); m++) {
    const ParagraphModel *model = (*models_)[m];
    if (model->justification() != JUSTIFICATION_CENTER &&
        RowsFitModel(rows, start, end, model))
      return model;
  }
  return NULL;
}
int tesseract::ParagraphTheory::IndexOf ( const ParagraphModel model) const

Definition at line 1207 of file paragraphs.cpp.

                                                              {
  for (int i = 0; i < models_->size(); i++) {
    if ((*models_)[i] == model)
      return i;
  }
  return -1;
}
GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( ) [inline]

Definition at line 195 of file paragraphs_internal.h.

{ return *models_; }
const GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( ) const [inline]

Definition at line 196 of file paragraphs_internal.h.

{ return *models_; }
void tesseract::ParagraphTheory::NonCenteredModels ( SetOfModels models)

Definition at line 1199 of file paragraphs.cpp.

                                                           {
  for (int m = 0; m < models_->size(); m++) {
    const ParagraphModel *model = (*models_)[m];
    if (model->justification() != JUSTIFICATION_CENTER)
      models->push_back_new(model);
  }
}

The documentation for this class was generated from the following files: