1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////////////
18 // class AliCDBRunRange //
19 // defines the run validity range of the object: //
20 // [fFirstRun, fLastRun] //
22 /////////////////////////////////////////////////////////////////////
24 #include "AliCDBRunRange.h"
28 ClassImp(AliCDBRunRange)
30 //___________________________________________________________________________
31 AliCDBRunRange::AliCDBRunRange():
39 //___________________________________________________________________________
40 AliCDBRunRange::AliCDBRunRange(Int_t firstRun, Int_t lastRun):
48 //___________________________________________________________________________
49 AliCDBRunRange::~AliCDBRunRange() {
54 //___________________________________________________________________________
55 Bool_t AliCDBRunRange::Overlaps(const AliCDBRunRange& other) const {
56 // check if this runRange overlaps other runRange
58 if (!(IsValid() && other.IsValid())) {
59 AliError("Comparing invalid run ranges!");
63 if (IsAnyRange() || other.IsAnyRange()) {
64 AliError("Comparing unspecified ranges!");
68 return ((fFirstRun <= other.fFirstRun && other.fFirstRun <= fLastRun)
69 || (fFirstRun <= other.fLastRun && other.fLastRun <= fLastRun))
70 || ((other.fFirstRun <= fFirstRun && fFirstRun <= other.fLastRun)
71 || (other.fFirstRun <= fLastRun && fLastRun <= other.fLastRun));
74 //___________________________________________________________________________
75 Bool_t AliCDBRunRange::Comprises(const AliCDBRunRange& other) const {
76 // check if this runRange contains other runRange
78 if (!(IsValid() && other.IsValid())) {
79 AliError("Comparing invalid run ranges!");
87 return fFirstRun <= other.fFirstRun && other.fFirstRun <= fLastRun
88 && fFirstRun <= other.fLastRun && other.fLastRun <= fLastRun;
91 //___________________________________________________________________________
92 Bool_t AliCDBRunRange::IsEqual(const TObject* obj) const {
93 // check if this runRange is equal to other runRange
99 if (AliCDBRunRange::Class() != obj->IsA()) {
102 AliCDBRunRange* other = (AliCDBRunRange*) obj;
103 return fFirstRun == other->fFirstRun && fLastRun == other->fLastRun;
106 //___________________________________________________________________________
107 Bool_t AliCDBRunRange::IsValid() const {
110 if (fFirstRun < 0 && fLastRun < 0) {
114 if (fFirstRun >= 0 && fLastRun >= fFirstRun) {