diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index db39e91f5563a33f165fe249335aaefc4e6b03dc..a83e789c1e62ba113a508fe51b535fdb64a47d9f 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -324,7 +324,7 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const { // hidden categories std::set<std::string> hiddenCategories; - if (includeHidden == false) { + if (!includeHidden) { fillHiddenCategories(&hiddenCategories); } diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index 1dc8f247bf26d2e1ddab0502bdaa5116dfcc32f8..59cbeea0695038395a01683e9baf37a5c3bc4115 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -59,7 +59,7 @@ std::string CompositeFunction::asString() const { } if (name() != "CompositeFunction" || nAttributes() > 1 || - getAttribute("NumDeriv").asBool() == true) { + getAttribute("NumDeriv").asBool()) { ostr << "composite=" << name(); std::vector<std::string> attr = this->getAttributeNames(); for (const auto &attName : attr) { diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index e0e73ef28e29a5536ad716d47ca06a5fdc096f72..3df7069a731c67124a0b5c19c3ff2d84107aabdf 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -742,7 +742,7 @@ void IFunction::setMatrixWorkspace( IFunctionWithLocation *testWithLocation = dynamic_cast<IFunctionWithLocation *>(this); if (testWithLocation == nullptr || - (fitParam.getLookUpTable().containData() == false && + (!fitParam.getLookUpTable().containData() && fitParam.getFormula().compare("") == 0)) { setParameter(i, fitParam.getValue()); } else { diff --git a/Framework/Algorithms/src/MaxMin.cpp b/Framework/Algorithms/src/MaxMin.cpp index 8e34ff2942dded48681fce7a141bf866704c4b86..5f4a18000cd28fefb534b6e0447e227b70b0ffd2 100644 --- a/Framework/Algorithms/src/MaxMin.cpp +++ b/Framework/Algorithms/src/MaxMin.cpp @@ -126,7 +126,7 @@ void MaxMin::exec() { MantidVec::const_iterator maxY; // Find the max/min element - if (showMin == true) { + if (showMin) { maxY = std::min_element(Y.begin() + distmin, Y.begin() + distmax); } else { maxY = std::max_element(Y.begin() + distmin, Y.begin() + distmax); diff --git a/Framework/Algorithms/src/NormaliseByDetector.cpp b/Framework/Algorithms/src/NormaliseByDetector.cpp index 5affe89fb9ba8bd57459341443d9a1b65def9f0c..cc3e65a01783c6f5b5fefb2b04eba571590399c1 100644 --- a/Framework/Algorithms/src/NormaliseByDetector.cpp +++ b/Framework/Algorithms/src/NormaliseByDetector.cpp @@ -182,7 +182,7 @@ NormaliseByDetector::processHistograms(MatrixWorkspace_sptr inWS) { // Choose between parallel execution and sequential execution then, process // histograms accordingly. - if (m_parallelExecution == true) { + if (m_parallelExecution) { PARALLEL_FOR2(inWS, denominatorWS) for (int wsIndex = 0; wsIndex < static_cast<int>(nHistograms); ++wsIndex) { PARALLEL_START_INTERUPT_REGION diff --git a/Framework/Crystal/src/CalculateUMatrix.cpp b/Framework/Crystal/src/CalculateUMatrix.cpp index f18dc26bb55bab055af823cf74944293a4c6b9d0..316346478b27566c115b0eeb66b3c0fba520c30f 100644 --- a/Framework/Crystal/src/CalculateUMatrix.cpp +++ b/Framework/Crystal/src/CalculateUMatrix.cpp @@ -129,7 +129,7 @@ void CalculateUMatrix::exec() { } } // check if enough peaks are indexed or if HS is 0 - if ((nIndexedpeaks < 2) || (found2nc == false)) + if ((nIndexedpeaks < 2) || !found2nc) throw std::invalid_argument("Less then two non-colinear peaks indexed"); if (HS == zero) throw std::invalid_argument("Something really bad happened"); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h index 15c873463b62e86a8487d495da699a538a7e3a01..27f95fc1978ca82df855db03f4dc7dcf6a302794 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/BivariateNormal.h @@ -140,10 +140,7 @@ public: } bool hasAttribute(const std::string &attName) const override { - if (attName == std::string("CalcVariances")) - return true; - - return false; + return (attName == std::string("CalcVariances")); } bool CalcVxx, CalcVyy, CalcVxy; diff --git a/Framework/DataHandling/src/LoadCanSAS1D.cpp b/Framework/DataHandling/src/LoadCanSAS1D.cpp index 43b1bc6cc337bb03db6f37a1178b0f5de1b3099d..2ef930270d0253967ea5412eeaefdc0ba8f591bf 100644 --- a/Framework/DataHandling/src/LoadCanSAS1D.cpp +++ b/Framework/DataHandling/src/LoadCanSAS1D.cpp @@ -246,7 +246,7 @@ LoadCanSAS1D::loadEntry(Poco::XML::Node *const workspaceData, runLoadInstrument(instname, dataWS); dataWS->getAxis(0)->setUnit("MomentumTransfer"); - if (isCommon == true) + if (isCommon) dataWS->setYUnitLabel(yUnit); return dataWS; } diff --git a/Framework/DataHandling/src/LoadDaveGrp.cpp b/Framework/DataHandling/src/LoadDaveGrp.cpp index 9a042d0eaec687cb393bce7b4474e4b8f4a3bd2e..cec049c02602e979a0b6c6aad6be823196ca04d3 100644 --- a/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -51,9 +51,7 @@ int LoadDaveGrp::confidence(Kernel::FileDescriptor &descriptor) const { // Third line is a comment: # std::getline(descriptor.data(), curline); - if (curline.substr(0, 1) == "#") { - daveGrp = daveGrp && true; - } else + if (curline.substr(0, 1) != "#") return 0; // Fourth line is an integer diff --git a/Framework/DataHandling/src/LoadInstrument.cpp b/Framework/DataHandling/src/LoadInstrument.cpp index 63f58ff96c804c2a1c5c37314ed6ab74845f657d..5f151d96debbe02590ca7458a7fd5a4bc5581d49 100644 --- a/Framework/DataHandling/src/LoadInstrument.cpp +++ b/Framework/DataHandling/src/LoadInstrument.cpp @@ -289,15 +289,13 @@ std::string LoadInstrument::getFullPathParamIDF(std::string directoryName) { // Assemble parameter file name std::string fullPathParamIDF = directoryPath.setFileName(prefix + "_Parameters" + suffix).toString(); - if (Poco::File(fullPathParamIDF).exists() == - false) { // No such file exists, so look for file based on instrument ID + if (!Poco::File(fullPathParamIDF).exists()) { // No such file exists, so look for file based on instrument ID // given by the prefix fullPathParamIDF = directoryPath.setFileName(prefix + "_Parameters.xml").toString(); } - if (Poco::File(fullPathParamIDF).exists() == - false) { // No such file exists, indicate none found in this directory. + if (!Poco::File(fullPathParamIDF).exists()) { // No such file exists, indicate none found in this directory. fullPathParamIDF = ""; } diff --git a/Framework/DataHandling/src/LoadMcStas.cpp b/Framework/DataHandling/src/LoadMcStas.cpp index 438bc6f610f9f95b373de6083f779f3239138f55..5ba03c06231c1cb0c97cf0b20d36f4eb62f72fd5 100644 --- a/Framework/DataHandling/src/LoadMcStas.cpp +++ b/Framework/DataHandling/src/LoadMcStas.cpp @@ -283,7 +283,7 @@ void LoadMcStas::readEventData( << std::endl; return; } - if (isAnyNeutrons == false && nNeutrons > 0) + if (!isAnyNeutrons && nNeutrons > 0) isAnyNeutrons = true; std::vector<int64_t> start(2); diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index 4a6be41cc8323b291a2350ca6d3d71aee9da3f7d..e1af61220c1a094b3f18e8e6c11556a9aa0f4224 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -207,7 +207,7 @@ void PeakColumn::read(size_t index, const std::string &text) { /** @return true if the column is read-only */ bool PeakColumn::getReadOnly() const { return !((m_name == "h") || (m_name == "k") || (m_name == "l") || - (m_name == "RunNumber")); + (m_name == "RunNumber")); } //------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/test/PeakColumnTest.h b/Framework/DataObjects/test/PeakColumnTest.h index 7aca9b490ff8a20448e21fcdaeeb6197f04065aa..3ca0e7870f7f36c04c3492afa2dd5a2431f3f60d 100644 --- a/Framework/DataObjects/test/PeakColumnTest.h +++ b/Framework/DataObjects/test/PeakColumnTest.h @@ -107,13 +107,13 @@ public: } void test_get_read_only_returns_correct_value() { - PeakColumn pc1(m_peaks, "h"); - auto readOnly = pc1.getReadOnly(); - TS_ASSERT(!readOnly); + PeakColumn pc1(m_peaks, "h"); + auto readOnly = pc1.getReadOnly(); + TS_ASSERT(!readOnly); - PeakColumn pc2(m_peaks, "DetID"); - readOnly = pc2.getReadOnly(); - TS_ASSERT(readOnly); + PeakColumn pc2(m_peaks, "DetID"); + readOnly = pc2.getReadOnly(); + TS_ASSERT(readOnly); } private: diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp index 5c2929c3a1a5dccb101107e7a24954fb2f0ec76b..036968a097705ebf82c2ecda830f7f9b7d6b1d2c 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp @@ -195,7 +195,7 @@ Builder creational method. Processes added dimensions. creates xml string. template <typename CheckDimensionPolicy> const std::string &MDGeometryBuilderXML<CheckDimensionPolicy>::create() const { using namespace Poco::XML; - if (true == m_changed) { + if (m_changed) { // Create the root element for this fragment. AutoPtr<Document> pDoc = new Document; AutoPtr<Element> dimensionSetElement = pDoc->createElement("DimensionSet"); diff --git a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp index 52fbc651ed6f74a94c46fba23d9012bed8fa4815..dcdb018e5e2c36487eac583452c7cfb959260016 100644 --- a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp @@ -68,7 +68,7 @@ void CacheGeometryHandler::Triangulate() { void CacheGeometryHandler::Render() { if (Obj != nullptr) { - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); Renderer->Render( Triangulator->getNumberOfPoints(), Triangulator->getNumberOfTriangles(), @@ -81,7 +81,7 @@ void CacheGeometryHandler::Render() { void CacheGeometryHandler::Initialize() { if (Obj != nullptr) { Obj->updateGeometryHandler(); - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); Renderer->Initialize( Triangulator->getNumberOfPoints(), Triangulator->getNumberOfTriangles(), @@ -94,7 +94,7 @@ void CacheGeometryHandler::Initialize() { int CacheGeometryHandler::NumberOfTriangles() { if (Obj != nullptr) { Obj->updateGeometryHandler(); - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); return Triangulator->getNumberOfTriangles(); } else { @@ -105,7 +105,7 @@ int CacheGeometryHandler::NumberOfTriangles() { int CacheGeometryHandler::NumberOfPoints() { if (Obj != nullptr) { Obj->updateGeometryHandler(); - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); return Triangulator->getNumberOfPoints(); } else { @@ -116,7 +116,7 @@ int CacheGeometryHandler::NumberOfPoints() { double *CacheGeometryHandler::getTriangleVertices() { if (Obj != nullptr) { Obj->updateGeometryHandler(); - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); return Triangulator->getTriangleVertices(); } else { @@ -127,7 +127,7 @@ double *CacheGeometryHandler::getTriangleVertices() { int *CacheGeometryHandler::getTriangleFaces() { if (Obj != nullptr) { Obj->updateGeometryHandler(); - if (boolTriangulated == false) + if (!boolTriangulated) Triangulate(); return Triangulator->getTriangleFaces(); } else { diff --git a/Framework/Kernel/inc/MantidKernel/Cache.h b/Framework/Kernel/inc/MantidKernel/Cache.h index 5a46f8c818f237db587e2552cfa3d01f60202678..a22c29077dba3c19a3baa63c994d80a7f9a08ba2 100644 --- a/Framework/Kernel/inc/MantidKernel/Cache.h +++ b/Framework/Kernel/inc/MantidKernel/Cache.h @@ -146,11 +146,13 @@ private: bool getCacheNoStats(const KEYTYPE key, VALUETYPE &value) const { MutexLocker lock(m_mutex); CacheMapConstIterator it_found = m_cacheMap.find(key); - if (it_found == m_cacheMap.end()) { - return false; // did not find the component + bool isValid = it_found != m_cacheMap.end(); + + if (isValid) { + value = it_found->second; } - value = it_found->second; - return true; + + return isValid; } /// total number of times the cache has contained the requested information diff --git a/Framework/Kernel/inc/MantidKernel/DataService.h b/Framework/Kernel/inc/MantidKernel/DataService.h index 9d508c5e578046098afc2d649f93f13209d8c0f5..882d1d936b1b7214823f11e8e41012995a887505 100644 --- a/Framework/Kernel/inc/MantidKernel/DataService.h +++ b/Framework/Kernel/inc/MantidKernel/DataService.h @@ -380,9 +380,8 @@ public: std::string foundName; svc_it it = findNameWithCaseSearch(name, foundName); - if (it != datamap.end()) - return true; - return false; + + return it != datamap.end(); } /// Return the number of objects stored by the data service diff --git a/Framework/Kernel/inc/MantidKernel/PropertyHistory.h b/Framework/Kernel/inc/MantidKernel/PropertyHistory.h index 9fa183d329b3988d8b97dba8a635fbf9e565a14a..1408811282943a5de4e3530a51b43a1bd0d58e50 100644 --- a/Framework/Kernel/inc/MantidKernel/PropertyHistory.h +++ b/Framework/Kernel/inc/MantidKernel/PropertyHistory.h @@ -77,11 +77,8 @@ public: /// this is required for boost.python bool operator==(const PropertyHistory &other) const { - if (name() == other.name() && value() == other.value() && - type() == other.type() && isDefault() == other.isDefault()) { - return true; - } - return false; + return (name() == other.name() && value() == other.value() && + type() == other.type() && isDefault() == other.isDefault()); } private: diff --git a/Framework/LiveData/src/ISISLiveEventDataListener.cpp b/Framework/LiveData/src/ISISLiveEventDataListener.cpp index e0a9e184ee1d675bbfe377f6d50161891a5cfc1d..3ac001a0652dafb11ecbaa96d1d5d8ea370acc05 100644 --- a/Framework/LiveData/src/ISISLiveEventDataListener.cpp +++ b/Framework/LiveData/src/ISISLiveEventDataListener.cpp @@ -225,13 +225,13 @@ int ISISLiveEventDataListener::runNumber() const { return m_runNumber; } void ISISLiveEventDataListener::run() { try { - if (m_isConnected == false) // sanity check + if (!m_isConnected) // sanity check { throw std::runtime_error(std::string("No connection to the DAE.")); } TCPStreamEventDataNeutron events; - while (m_stopThread == false) { + while (!m_stopThread) { // get the header with the type of the packet Receive(events.head, "Events header", "Corrupt stream - you should reconnect."); diff --git a/Framework/LiveData/src/LoadLiveData.cpp b/Framework/LiveData/src/LoadLiveData.cpp index 384d156e25e9686e815b17f2808d6f370663c240..d182499aac724bc1ac9df4420a5e7a4779193429 100644 --- a/Framework/LiveData/src/LoadLiveData.cpp +++ b/Framework/LiveData/src/LoadLiveData.cpp @@ -110,7 +110,7 @@ LoadLiveData::runProcessing(Mantid::API::Workspace_sptr inputWS, bool inputPropertyWorkspaceFound = false; for (auto prop : proplist) { if ((prop->direction() == 0) && - (inputPropertyWorkspaceFound == false)) { + (!inputPropertyWorkspaceFound)) { if (boost::ends_with(prop->type(), "Workspace")) { g_log.information() << "Using " << prop->name() << " as the input property." << std::endl; diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index 2e6f4b2e03554e07680fb7e3a0bf11c07cad7d02..7527845434c7de7c27d226c06df745457362b280 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -204,7 +204,7 @@ void SNSLiveEventDataListener::start(Kernel::DateAndTime startTime) { /// a temporary workspace. void SNSLiveEventDataListener::run() { try { - if (m_isConnected == false) // sanity check + if (!m_isConnected) // sanity check { throw std::runtime_error(std::string( "SNSLiveEventDataListener::run(): No connection to SMS server.")); @@ -237,8 +237,7 @@ void SNSLiveEventDataListener::run() { m_stopThread = true; } - while (m_stopThread == - false) // loop until the foreground thread tells us to stop + while (!m_stopThread) // loop until the foreground thread tells us to stop { while (m_pauseNetRead && m_stopThread == false) { @@ -389,7 +388,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::BankedEventPkt &pkt) { // First, check to see if the run has been paused. We don't process // the events if we're paused unless the user has specifically overridden // this behavior with the livelistener.keeppausedevents property. - if (m_runPaused && m_keepPausedEvents == false) { + if (m_runPaused && !static_cast<bool>(m_keepPausedEvents)) { return false; } @@ -540,7 +539,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::GeometryPkt &pkt) { // TODO: For now, I'm assuming that we only need to process one of these // packets the first time it comes in and we can ignore any others. - if (m_workspaceInitialized == false) { + if (!m_workspaceInitialized) { m_instrumentXML = pkt.info(); // save the xml so we can pass it to the // LoadInstrument algorithm @@ -607,7 +606,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::BeamlineInfoPkt &pkt) { // these packets // We only need to process a beamlineinfo packet once - if (m_workspaceInitialized == false) { + if (!m_workspaceInitialized) { // We need the instrument name m_instrumentName = pkt.longName(); } diff --git a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp index 0ff61d6aced33f2ff78b281cf32dc5ba80f63b72..a6466a58045a7bf41b282de19fa39793ce97ada0 100644 --- a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp +++ b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp @@ -300,7 +300,7 @@ void TOPAZLiveEventDataListener::start(Kernel::DateAndTime startTime) { void TOPAZLiveEventDataListener::run() { try { - if (m_isConnected == false) // sanity check + if (!m_isConnected) // sanity check { throw std::runtime_error(std::string("TOPAZLiveEventDataListener::run(): " "No connection to event_catcher.")); @@ -312,7 +312,7 @@ void TOPAZLiveEventDataListener::run() { Poco::Net::SocketAddress sendAddr; // address of the sender // loop until the foreground thread tells us to stop - while (m_stopThread == false) { + while (!m_stopThread) { // it's possible that a stop request came in while we were sleeping... if (m_stopThread) { break; @@ -322,7 +322,7 @@ void TOPAZLiveEventDataListener::run() { try { bytesRead = m_dataSocket.receiveFrom(m_udpBuf, m_udpBufSize, sendAddr); } catch (Poco::TimeoutException &) { - if (m_stopThread == false) { + if (!m_stopThread) { // Don't need to stop processing or anything - just log a warning g_log.warning("Timeout reading from the network. " "Is event_catcher still sending?"); diff --git a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp index 46cf58941a03fdd449eeab81f8f491b294c7d55a..d78b63033894b148e89e12aa9a06e350bd4d92df 100644 --- a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp +++ b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp @@ -387,7 +387,7 @@ ConvolutionFitSequential::findValuesFromFunction(const std::string &function) { if (fitType.compare("Lorentzian") == 0) { std::string newSub = function.substr(0, startPos); bool isTwoL = checkForTwoLorentz(newSub); - if (isTwoL == true) { + if (isTwoL) { fitType = "2"; } else { fitType = "1"; diff --git a/MantidQt/API/src/AlgorithmDialog.cpp b/MantidQt/API/src/AlgorithmDialog.cpp index 82ac2f990d2e3ab0c1dcda3619fb265fe6086cdb..10e2f3c613fda3b1efb4a6ad277cc118fe3aab72 100644 --- a/MantidQt/API/src/AlgorithmDialog.cpp +++ b/MantidQt/API/src/AlgorithmDialog.cpp @@ -523,14 +523,8 @@ bool AlgorithmDialog::isWidgetEnabled(const QString & propName) const * (1) It is contained in the disabled list or * (2) A user passed a value into the dialog */ - if( m_disabled.contains(propName) || m_python_arguments.contains(propName) ) - { - return false; - } - else - { - return true; - } + + return !(m_disabled.contains(propName) || m_python_arguments.contains(propName)); } } diff --git a/MantidQt/API/src/ScaleEngine.cpp b/MantidQt/API/src/ScaleEngine.cpp index 62defc1d9fd830eb0de3a06a26d9ed5709e78e38..c19fc07eed2bd05aa5d48e46ec3c0121f947dec7 100644 --- a/MantidQt/API/src/ScaleEngine.cpp +++ b/MantidQt/API/src/ScaleEngine.cpp @@ -224,7 +224,7 @@ ScaleEngine::~ScaleEngine() {} bool ScaleEngine::hasBreak() const { -return (d_break_left == d_break_right || (d_break_left == -DBL_MAX && d_break_right == DBL_MAX))?false:true; +return !(d_break_left == d_break_right || (d_break_left == -DBL_MAX && d_break_right == DBL_MAX)); } double ScaleEngine::axisBreakLeft() const diff --git a/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp b/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp index 6c9c7dfa8ba9336a785fa49d96c97da4211359b6..775b4cf340ad8da4f8d18ee64744f98663bb98a9 100644 --- a/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp +++ b/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp @@ -604,11 +604,11 @@ BinaryTreeWidgetItem::BinaryTreeWidgetItem(const QStringList & strings, int type */ bool BinaryTreeWidgetItem::addChildItem(BinaryTreeWidgetItem* child) { - if( childCount() >= 2 ) return false; + bool tooManyChildren = childCount() >= 2; + if( !tooManyChildren ) this->addChild(child); // Call sub-class function - this->addChild(child); - return true; + return !tooManyChildren; } /** diff --git a/MantidQt/CustomDialogs/src/FitDialog.cpp b/MantidQt/CustomDialogs/src/FitDialog.cpp index d39863b1b7767173d76e1c7b7024b48fab709f25..ebf8f9bedd80f541c8e47e3fb228a8c25adaf3df 100644 --- a/MantidQt/CustomDialogs/src/FitDialog.cpp +++ b/MantidQt/CustomDialogs/src/FitDialog.cpp @@ -84,8 +84,7 @@ bool InputWorkspaceWidget::isMatrixWorkspace() const try { auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName.toStdString()); - if ( dynamic_cast<Mantid::API::MatrixWorkspace*>(ws.get()) ) return true; - return false; + return dynamic_cast<Mantid::API::MatrixWorkspace*>(ws.get()) != nullptr; } catch(...) { @@ -103,8 +102,7 @@ bool InputWorkspaceWidget::isMDWorkspace() const try { auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(wsName.toStdString()); - if ( dynamic_cast<Mantid::API::IMDWorkspace*>(ws.get()) ) return true; - return false; + return dynamic_cast<Mantid::API::IMDWorkspace*>(ws.get()) != nullptr; } catch(...) { diff --git a/MantidQt/CustomInterfaces/src/Homer.cpp b/MantidQt/CustomInterfaces/src/Homer.cpp index 3ea9e700826e46c25898399e3116787d57e6d084..10301a19794bd911d09f66ac061b2db8b3dea7d1 100644 --- a/MantidQt/CustomInterfaces/src/Homer.cpp +++ b/MantidQt/CustomInterfaces/src/Homer.cpp @@ -290,16 +290,17 @@ bool Homer::isRebinStringValid() const rbParams[2] = m_uiForm.leEHigh->text().toDouble(); // Create a validator and pass it the vector. Empty string from isValid() signals success. Mantid::Kernel::RebinParamsValidator validator; - if ( validator.isValid(rbParams).empty() ) + bool isEmpty = validator.isValid(rbParams).empty(); + if ( isEmpty ) { m_uiForm.gbRebin->setStyleSheet("QLineEdit {background-color: white}"); - return true; } else { m_uiForm.gbRebin->setStyleSheet("QLineEdit {background-color: red}"); - return false; } + + return isEmpty; } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 1117dafc4527219c2d5c6702aa92798bec2c747a..7266498fbc06490fcfd4b6692fcae45c11722a29 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -1390,7 +1390,7 @@ void ConvFit::checkBoxUpdate(QtProperty *prop, bool checked) { if (prop == m_properties["UseDeltaFunc"]) { updatePlotOptions(); - if (checked == true) { + if (checked) { m_properties["DeltaFunction"]->addSubProperty( m_properties["DeltaHeight"]); m_dblManager->setValue(m_properties["DeltaHeight"], 1.0000); diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp index 8c870096ed9d8263e5a3200a5060e42458b257f3..9bc5e75b12e58eb5402198eeedbb514e126ef830 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectDiffractionReduction.cpp @@ -594,13 +594,13 @@ bool IndirectDiffractionReduction::validateRebin() { m_uiForm.valRebinStart->setText(""); m_uiForm.valRebinWidth->setText(""); m_uiForm.valRebinEnd->setText(""); - } else { + } + else { #define CHECK_VALID(text, validator) \ + rebinValid = !text.isEmpty(); \ if (text.isEmpty()) { \ - rebinValid = false; \ validator->setText("*"); \ } else { \ - rebinValid = true; \ validator->setText(""); \ } diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp index f28fec043b147d0d8a9d044f24a2ff9e2c3defdb..0f9b98f554526ced8c3b2c8a7c2799013fcb9ffb 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectLoadILL.cpp @@ -39,13 +39,13 @@ namespace MantidQt QFileInfo finfo(filename); QString ext = finfo.extension().toLower(); - if(ext != "asc" && ext != "inx" && ext != "nxs") - { + bool invalidExt = (ext != "asc" && ext != "inx" && ext != "nxs"); + + if(invalidExt){ emit showMessageBox("File is not of expected type:\n File type must be .asc, .inx or .nxs"); - return false; } - return true; + return !invalidExt; } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp index 099643b56eecc94576c53a1fbe97293a49321b53..bba16f64dc7d581005872d35d607c23c582427ad 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectMoments.cpp @@ -101,10 +101,9 @@ namespace CustomInterfaces if (!msg.isEmpty()) { emit showMessageBox(msg); - return false; } - return true; + return msg.isEmpty(); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp index 87c4ef457cae9f03dc587dd84d0569fe772ace3b..9c6d18ac938f211ec7dee78ae46385e8640f49ec 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/JumpFit.cpp @@ -87,10 +87,9 @@ bool JumpFit::validate() { QString errors = uiv.generateErrorMessage(); if (!errors.isEmpty()) { emit showMessageBox(errors); - return false; } - return true; + return errors.isEmpty(); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp b/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp index 644c206d71e7a1440a19213230e09263810e9876..7b49a8d561830986cd4417606de09660f62431f4 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ResNorm.cpp @@ -99,10 +99,9 @@ bool ResNorm::validate() { errors.append(uiv.generateErrorMessage()); if (!errors.isEmpty()) { emit showMessageBox(errors); - return false; } - return true; + return errors.isEmpty(); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp b/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp index dd90a8a463148ce2ce4185b6051b125570a55d0a..45cdbe0a818fbac87191b1908618c23b4e2ad009 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/Stretch.cpp @@ -70,10 +70,9 @@ bool Stretch::validate() { QString errors = uiv.generateErrorMessage(); if (!errors.isEmpty()) { emit showMessageBox(errors); - return false; } - return true; + return errors.isEmpty(); } /** diff --git a/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp b/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp index cade5b48a2350318806474499ac2e5468e7eea44..48ebb92c70b97a6a22908ede178446867b3098c4 100644 --- a/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp +++ b/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp @@ -422,10 +422,7 @@ bool MantidEVWorker::loadIsawPeaks( const std::string & peaks_ws_name, alg->setProperty("OutputWorkspace", peaks_ws_name ); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } /** @@ -445,10 +442,7 @@ bool MantidEVWorker::loadNexusPeaks( const std::string & peaks_ws_name, alg->setProperty("OutputWorkspace", peaks_ws_name ); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } /** @@ -472,10 +466,7 @@ bool MantidEVWorker::saveIsawPeaks( const std::string & peaks_ws_name, alg->setProperty("AppendFile", append ); alg->setProperty("Filename",file_name ); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } /** @@ -510,10 +501,7 @@ bool MantidEVWorker::saveNexusPeaks( const std::string & peaks_ws_name, alg->setProperty("InputWorkspace", peaks_ws_name ); alg->setProperty("Filename",file_name ); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -543,12 +531,7 @@ bool MantidEVWorker::findUBUsingFFT( const std::string & peaks_ws_name, alg->setProperty("MaxD",max_abc); alg->setProperty("Tolerance",tolerance); - if ( alg->execute() ) - { - return true; - } - - return false; + return alg->execute(); } @@ -570,10 +553,7 @@ bool MantidEVWorker::findUBUsingIndexedPeaks(const std::string & peaks_ws_name, alg->setProperty("PeaksWorkspace",peaks_ws_name); alg->setProperty("Tolerance",tolerance); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -597,10 +577,7 @@ bool MantidEVWorker::loadIsawUB( const std::string & peaks_ws_name, alg->setProperty("Filename",file_name); alg->setProperty("CheckUMatrix",true); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -623,10 +600,7 @@ bool MantidEVWorker::saveIsawUB( const std::string & peaks_ws_name, alg->setProperty("InputWorkspace",peaks_ws_name); alg->setProperty("Filename",file_name); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -658,10 +632,8 @@ bool MantidEVWorker::optimizePhiChiOmega( const std::string & peaks_ws_name, alg->setProperty("MaxIndexingError",0.20); alg->setProperty("MaxHKLPeaks2Use",-1.0); alg->setProperty("MaxSamplePositionChange_meters",0.05); - if ( alg->execute() ) - return true; - return false; + return alg->execute(); } @@ -688,10 +660,7 @@ bool MantidEVWorker::indexPeaksWithUB( const std::string & peaks_ws_name, alg->setProperty("Tolerance",tolerance); alg->setProperty("RoundHKLs",round_hkls); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -725,10 +694,7 @@ bool MantidEVWorker::showCells( const std::string & peaks_ws_name, alg->setProperty("BestOnly",best_only); alg->setProperty("AllowPermutations",allow_perm); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -763,10 +729,7 @@ bool MantidEVWorker::selectCellOfType( const std::string & peaks_ws_name, alg->setProperty("tolerance",0.12); alg->setProperty("AllowPermutations",allow_perm); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -798,10 +761,7 @@ bool MantidEVWorker::selectCellWithForm( const std::string & peaks_ws_name, alg->setProperty("tolerance",0.12); alg->setProperty("AllowPermutations",allow_perm); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } @@ -833,10 +793,7 @@ bool MantidEVWorker::changeHKL( const std::string & peaks_ws_name, alg->setProperty("PeaksWorkspace",peaks_ws_name); alg->setProperty("HKLTransform",transf_string); - if ( alg->execute() ) - return true; - - return false; + return alg->execute(); } diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp index 4e1398681490fb9efaa9c970b5656a865416c506..a601402021ab81dd7300d902afca210be88e025a 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp @@ -113,7 +113,7 @@ namespace CustomInterfaces Q_UNUSED(timeup); // We only have one timer, so not necessary to use this // Check flag for changes - if (m_directoryChanged.load() == true) { + if (m_directoryChanged.load()) { // Most recent file in directory Poco::Path filePath(m_view->firstRun()); std::string lastFile = getMostRecentFile(filePath.parent().toString()); diff --git a/MantidQt/MantidWidgets/src/CatalogSearch.cpp b/MantidQt/MantidWidgets/src/CatalogSearch.cpp index e167dd5e63439a387315eeffe40e0a9ebc5ab271..adefaa2c7616fa6d454f622d05c5f2a968c3ac5b 100644 --- a/MantidQt/MantidWidgets/src/CatalogSearch.cpp +++ b/MantidQt/MantidWidgets/src/CatalogSearch.cpp @@ -545,18 +545,19 @@ namespace MantidQt // Return false if the user has not input any dates. This prevents any null errors occurring. if (startDateInput.size() <= 2 || endDateInput.size() <= 2) return false; + bool ret = m_icatHelper->getTimevalue(startDateInput) > m_icatHelper->getTimevalue(endDateInput); // If startDate > endDate we want to throw an error and inform the user (red star(*)). - if (m_icatHelper->getTimevalue(startDateInput) > m_icatHelper->getTimevalue(endDateInput)) + if (ret) { m_icatUiForm.StartDate_err->setToolTip(QString::fromStdString("<span style=\"color: white;\">Start date cannot be greater than end date.</span>")); m_icatUiForm.StartDate_err->show(); - return true; } else { m_icatUiForm.StartDate_err->hide(); - return false; } + + return ret; } /** diff --git a/MantidQt/MantidWidgets/src/ColorBarWidget.cpp b/MantidQt/MantidWidgets/src/ColorBarWidget.cpp index 3372ee6471859762ce383c641fd796130405eb6c..df88cd675b2a43b32e605d4868f40f6d0a329436 100644 --- a/MantidQt/MantidWidgets/src/ColorBarWidget.cpp +++ b/MantidQt/MantidWidgets/src/ColorBarWidget.cpp @@ -114,11 +114,7 @@ void ColorBarWidget::setScale(int type) bool ColorBarWidget::getLog() { - if (getScale() == 1) - { - return true; - } - else return false; + return (getScale() == 1); } // Set exponent value for power scale diff --git a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp index 15bed28f07e341420080682b1ce558c60a49593a..c378d2f8a7edeea6bbae2717ae2eacb110364f1f 100644 --- a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp +++ b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp @@ -1806,15 +1806,8 @@ void FitPropertyBrowser::postDeleteHandle(const std::string& wsName) */ bool FitPropertyBrowser::isWorkspaceValid(Mantid::API::Workspace_sptr ws)const { - if (dynamic_cast<Mantid::API::MatrixWorkspace*>(ws.get()) != 0 || - dynamic_cast<Mantid::API::ITableWorkspace*>(ws.get()) != 0) - { - return true; - } - else - { - return false; - } + return (dynamic_cast<Mantid::API::MatrixWorkspace *>(ws.get()) != 0 || + dynamic_cast<Mantid::API::ITableWorkspace *>(ws.get()) != 0); } bool FitPropertyBrowser::isWorkspaceAGroup()const diff --git a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp index 5762e751f8a24b7c91b9a3a25a2656cb24429065..9dd19c1f0a8dfa2be58e508649fb03ac84d8aa2e 100644 --- a/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp +++ b/MantidQt/MantidWidgets/src/InstrumentView/InstrumentActor.cpp @@ -967,7 +967,7 @@ namespace MantidQt */ bool InstrumentActor::hasMaskWorkspace() const { - return m_maskWorkspace ? true : false; + return static_cast<bool>(m_maskWorkspace); } /** diff --git a/MantidQt/MantidWidgets/src/InstrumentView/RectF.cpp b/MantidQt/MantidWidgets/src/InstrumentView/RectF.cpp index 29493d16f1471ecd2df98aa33c7eccaddde58597..e0d72aac104e070d214ab797a696f2508450080d 100644 --- a/MantidQt/MantidWidgets/src/InstrumentView/RectF.cpp +++ b/MantidQt/MantidWidgets/src/InstrumentView/RectF.cpp @@ -44,8 +44,7 @@ namespace MantidQt double dx = m_x0 < m_x1 ? x - m_x0 : x - m_x1; if (dx < 0 || dx > width()) return false; double dy = m_y0 < m_y1 ? y - m_y0 : y - m_y1; - if (dy < 0 || dy > height()) return false; - return true; + return !(dy < 0 || dy > height()); } bool RectF::contains(const RectF &rect) diff --git a/MantidQt/MantidWidgets/src/MWRunFiles.cpp b/MantidQt/MantidWidgets/src/MWRunFiles.cpp index 67ba2baba104cb2640de294dcba0099a62de9222..d5fd4177f016c626e3325ce0c5fba5344eba0bb6 100644 --- a/MantidQt/MantidWidgets/src/MWRunFiles.cpp +++ b/MantidQt/MantidWidgets/src/MWRunFiles.cpp @@ -486,11 +486,7 @@ bool MWRunFiles::liveButtonIsChecked() const { * @returns True of the file names within the widget are valid, false otherwise */ bool MWRunFiles::isValid() const { - if (m_uiForm.valid->isHidden()) { - return true; - } else { - return false; - } + return m_uiForm.valid->isHidden(); } /** diff --git a/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp b/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp index c7773703a9b32de6614c9dc6208f64dee62a0014..10160c328f4fc502b0836ec8b274192fa4627f36 100644 --- a/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp +++ b/MantidQt/MantidWidgets/src/MuonFitPropertyBrowser.cpp @@ -228,7 +228,7 @@ void MuonFitPropertyBrowser::populateFunctionNames() if ((categories[j] == "Muon") || (categories[j] == "General") || (categories[j] == "Background")) muon = true; } - if (muon == true) + if (muon) { m_registeredFunctions << qfnName; } @@ -354,10 +354,7 @@ bool MuonFitPropertyBrowser::isWorkspaceValid(Workspace_sptr ws)const if ( workspaceName.endsWith("_Workspace") ) return false; - if (dynamic_cast<MatrixWorkspace*>(ws.get()) != 0) - return true; - else - return false; + return dynamic_cast<MatrixWorkspace*>(ws.get()) != 0; } void MuonFitPropertyBrowser::finishHandle(const IAlgorithm* alg) diff --git a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp index 6e9e714e3b31eee46f981b6976e20d29bdfdc869..b4d5542cfa44776e83e83eed0f40b492759e19f9 100644 --- a/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp +++ b/MantidQt/MantidWidgets/src/MuonSequentialFitDialog.cpp @@ -207,10 +207,8 @@ namespace MantidWidgets return false; std::string label = m_ui.labelInput->text().toStdString(); - if ( ! isValidLabel(label).empty() ) - return false; - return true; + return isValidLabel(label).empty(); } /** diff --git a/MantidQt/MantidWidgets/src/RangeSelector.cpp b/MantidQt/MantidWidgets/src/RangeSelector.cpp index ad084ec45389bb207c207f52120a9241493d3287..67b9c4765b3a8067255d9b3a231dde8ab10fb5a9 100644 --- a/MantidQt/MantidWidgets/src/RangeSelector.cpp +++ b/MantidQt/MantidWidgets/src/RangeSelector.cpp @@ -416,12 +416,5 @@ void RangeSelector::verify() bool RangeSelector::inRange(double x) { - if ( x < m_lower || x > m_higher ) - { - return false; - } - else - { - return true; - } + return (x < m_lower || x > m_higher); } diff --git a/MantidQt/MantidWidgets/src/ScriptEditor.cpp b/MantidQt/MantidWidgets/src/ScriptEditor.cpp index c43f2cfbb1a1d9c4097ab94b1005affc319fd729..d0e38385e6d0b2e0678d54cdc91b517be96a321b 100644 --- a/MantidQt/MantidWidgets/src/ScriptEditor.cpp +++ b/MantidQt/MantidWidgets/src/ScriptEditor.cpp @@ -92,8 +92,7 @@ void CommandHistory::add(QString cmd) */ bool CommandHistory::hasPrevious() const { - if( !m_commands.isEmpty() && m_current > 0 ) return true; - else return false; + return !m_commands.isEmpty() && m_current > 0; } /** @@ -109,8 +108,7 @@ QString CommandHistory::getPrevious() const */ bool CommandHistory::hasNext() const { - if( !m_commands.isEmpty() && m_current < m_commands.count() - 1 ) return true; - else return false; + return !m_commands.isEmpty() && m_current < m_commands.count() - 1; } /**