コード例 #1
0
ファイル: DataError.cpp プロジェクト: CUEBoxer/OpenStudio
bool DataError::operator==(const DataError& otherError) const {
  return ( (scope() == otherError.scope()) &&
           (type() == otherError.type()) &&
           (m_fieldIndex == otherError.m_fieldIndex) &&
           (objectIdentifier() == otherError.objectIdentifier()) &&
           (objectName() == otherError.objectName()) &&
           (objectType() == otherError.objectType()) );
}
コード例 #2
0
TEST_F(ModelFixture, Schedule_FinalStrictness) {
  Model model;
  ScheduleConstant schedule(model);
  schedule.setValue(-0.1);
  EXPECT_TRUE(checkOrAssignScheduleTypeLimits("Lights","Lighting",schedule));
  ValidityReport report = schedule.validityReport(StrictnessLevel(StrictnessLevel::Final));
  ASSERT_EQ(1u,report.numErrors());
  DataError error = report.nextError().get();
  EXPECT_EQ(DataErrorType(DataErrorType::NumericBound),error.type());
  schedule.setValue(0.5);
  report = schedule.validityReport(StrictnessLevel(StrictnessLevel::Final));
  EXPECT_EQ(0u,report.numErrors());
}
コード例 #3
0
ファイル: DataError.cpp プロジェクト: CUEBoxer/OpenStudio
bool DataErrorLess::operator()(const DataError& left, const DataError& right) const {
  // order first by error type, since listed in order of severity
  if (left.type() != right.type()) { 
    return left.type() < right.type();
  }
  // within type order by collection, then object, then field-level, since 
  // collection-level is generally the most severe (IddFile missing, for instance)
  if (left.scope() != right.scope()) {
    return left.scope() > right.scope();
  }
  // if object-level name conflict, order by name, then type
  if ((left.scope() == Scope::Object) && (left.type() == DataErrorType::NameConflict)) {
    if (!istringEqual(left.objectName(),right.objectName())) {
      return istringLess(left.objectName(),right.objectName());
    }
  }
  // if objectType exists, order by that next, since Idd Files are in a 
  // semi-logical order
  if ((left.objectType() != boost::none) && (right.objectType() != boost::none)) {
    return left.objectType().get() < right.objectType().get();
  }
  // now order by objectName in remaining cases
  if (!istringEqual(left.objectName(),right.objectName())) {
    return istringLess(left.objectName(),right.objectName());
  }
  // now by objectHandle (for non-named objects)
  if (left.objectIdentifier() != right.objectIdentifier()) {
    return left.objectIdentifier() < right.objectIdentifier();
  }
  // now by fieldIndex, if applicable
  if (left.scope() == Scope::Field) {
    return left.fieldIdentifier() < right.fieldIdentifier();
  }

  // exactly equal
  return false;
}