LCOV - code coverage report
Current view: top level - STEER/CDB - AliCDBRunRange.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 43 62.8 %
Date: 2016-06-14 17:26:59 Functions: 10 12 83.3 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /////////////////////////////////////////////////////////////////////
      17             : //                                                                 //
      18             : //  class AliCDBRunRange                                           //
      19             : //  defines the run validity range of the object:                  //
      20             : //  [fFirstRun, fLastRun]                                          //
      21             : //                                                                 //
      22             : /////////////////////////////////////////////////////////////////////
      23             : 
      24             : #include "AliCDBRunRange.h"
      25             : 
      26             : #include "AliLog.h"
      27             : 
      28         128 : ClassImp(AliCDBRunRange)
      29             : 
      30             : //___________________________________________________________________________
      31        4554 : AliCDBRunRange::AliCDBRunRange():
      32        4554 :   fFirstRun(-1), 
      33        4554 :   fLastRun(-1)
      34       22770 : {
      35             :   // constructor
      36             : 
      37        9108 : }
      38             : 
      39             : //___________________________________________________________________________
      40        5089 : AliCDBRunRange::AliCDBRunRange(Int_t firstRun, Int_t lastRun):
      41        5089 :   fFirstRun(firstRun), 
      42        5089 :   fLastRun(lastRun)
      43       25445 : {
      44             :   // constructor
      45             : 
      46       10178 : }
      47             : 
      48             : //___________________________________________________________________________
      49       19694 : AliCDBRunRange::~AliCDBRunRange() {
      50             :   // destructor
      51             : 
      52       29541 : }
      53             : 
      54             : //___________________________________________________________________________
      55             : Bool_t AliCDBRunRange::Overlaps(const AliCDBRunRange& other) const {
      56             :   // check if this runRange overlaps other runRange
      57             : 
      58           0 :   if (!(IsValid() && other.IsValid())) {
      59           0 :     AliError("Comparing invalid run ranges!");
      60           0 :     return kFALSE;
      61             :   }     
      62             : 
      63           0 :   if (IsAnyRange() || other.IsAnyRange()) {
      64           0 :     AliError("Comparing unspecified ranges!");
      65           0 :     return kFALSE;
      66             :   }
      67             : 
      68           0 :   return ((fFirstRun < other.fFirstRun && other.fFirstRun <= fLastRun)
      69           0 :       || (other.fFirstRun <= fFirstRun && fFirstRun <= other.fLastRun));
      70           0 : }
      71             : 
      72             : //___________________________________________________________________________
      73             : Bool_t AliCDBRunRange::Comprises(const AliCDBRunRange& other) const {
      74             :   // check if this runRange contains other runRange
      75             : 
      76        8760 :   if (!(IsValid() && other.IsValid())) {
      77           0 :     AliError("Comparing invalid run ranges!");
      78           0 :     return kFALSE;
      79             :   }     
      80             : 
      81        2920 :   if (IsAnyRange()) {
      82           0 :     return kTRUE;
      83             :   }
      84             : 
      85        8754 :   return fFirstRun <= other.fFirstRun && other.fFirstRun <= fLastRun
      86        8742 :     && fFirstRun <= other.fLastRun && other.fLastRun <= fLastRun;
      87        2920 : }
      88             : 
      89             : //___________________________________________________________________________
      90             : Bool_t AliCDBRunRange::IsEqual(const TObject* obj) const {
      91             :   // check if this runRange is equal to other runRange
      92             : 
      93        1516 :   if (this == obj) {
      94           0 :     return kTRUE;
      95             :   }
      96             : 
      97         758 :   if (AliCDBRunRange::Class() != obj->IsA()) {
      98           0 :     return kFALSE;
      99             :   }
     100         758 :   AliCDBRunRange* other = (AliCDBRunRange*) obj;
     101        1516 :   return fFirstRun == other->fFirstRun && fLastRun == other->fLastRun;
     102         758 : }
     103             : 
     104             : //___________________________________________________________________________
     105             : Bool_t AliCDBRunRange::IsValid() const {
     106             :   // validity check
     107             : 
     108       15126 :   if (fFirstRun < 0 && fLastRun < 0) {
     109           0 :     return kTRUE;
     110             :   }
     111             : 
     112       15126 :   if (fFirstRun >= 0 && fLastRun >= fFirstRun) {
     113        7563 :     return kTRUE;
     114             :   }
     115             : 
     116           0 :   return kFALSE;
     117        7563 : }
     118             : 
     119             : 

Generated by: LCOV version 1.11