Skip to content

Commit

Permalink
Refs #9371 Refactor out some more magic numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Sep 4, 2014
1 parent fc7edfd commit 9596480
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
Expand Up @@ -63,6 +63,15 @@ namespace MantidQt
//virtual save methods
virtual void save() = 0;
virtual void saveAs() = 0;

static const int COL_RUNS;
static const int COL_ANGLE;
static const int COL_TRANSMISSION;
static const int COL_QMIN;
static const int COL_QMAX;
static const int COL_DQQ;
static const int COL_SCALE;
static const int COL_GROUP;
};
}
}
Expand Down
Expand Up @@ -9,6 +9,15 @@ namespace MantidQt
namespace CustomInterfaces
{

const int ReflMainViewPresenter::COL_RUNS(0);
const int ReflMainViewPresenter::COL_ANGLE(1);
const int ReflMainViewPresenter::COL_TRANSMISSION(2);
const int ReflMainViewPresenter::COL_QMIN(3);
const int ReflMainViewPresenter::COL_QMAX(4);
const int ReflMainViewPresenter::COL_DQQ(5);
const int ReflMainViewPresenter::COL_SCALE(6);
const int ReflMainViewPresenter::COL_GROUP(7);

ReflMainViewPresenter::ReflMainViewPresenter(ReflMainView* view): m_view(view)
{
}
Expand Down Expand Up @@ -92,12 +101,30 @@ namespace MantidQt
*/
std::string ReflMainViewPresenter::processRow(size_t rowNo, std::string lastTrans)
{
std::string run = m_model->String(rowNo,0);
const double theta = boost::lexical_cast<double>(m_model->String(rowNo,1));
std::string trans = m_model->String(rowNo,2);
const double qmin = boost::lexical_cast<double>(m_model->String(rowNo,3));
const double qmax = boost::lexical_cast<double>(m_model->String(rowNo,4));
const double dqq = boost::lexical_cast<double>(m_model->String(rowNo,5));
std::string run = m_model->String(rowNo, COL_RUNS);
std::string trans = m_model->String(rowNo, COL_TRANSMISSION);

double dqq = 0;
double theta = 0;
double qmin = 0;
double qmax = 0;

const bool dqqGiven = !m_model->String(rowNo, COL_DQQ ).empty();
const bool thetaGiven = !m_model->String(rowNo, COL_ANGLE).empty();
const bool qminGiven = !m_model->String(rowNo, COL_QMIN ).empty();
const bool qmaxGiven = !m_model->String(rowNo, COL_QMAX ).empty();

if(dqqGiven)
Mantid::Kernel::Strings::convert<double>(m_model->String(rowNo, COL_DQQ), dqq);

if(thetaGiven)
Mantid::Kernel::Strings::convert<double>(m_model->String(rowNo, COL_ANGLE), theta);

if(qminGiven)
Mantid::Kernel::Strings::convert<double>(m_model->String(rowNo, COL_QMIN), qmax);

if(qmaxGiven)
Mantid::Kernel::Strings::convert<double>(m_model->String(rowNo, COL_QMAX), qmin);

size_t commacheck = run.find_first_of(',');
if (commacheck != std::string::npos)
Expand Down

0 comments on commit 9596480

Please sign in to comment.