CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Vispa.Share.FindAlgorithm.FindAlgorithm Class Reference
Inheritance diagram for Vispa.Share.FindAlgorithm.FindAlgorithm:
Vispa.Share.ObjectHolder.ObjectHolder

Public Member Functions

def __init__
 
def clear
 
def currentNumber
 
def findUsingFindDialog
 
def message
 
def next
 
def numberOfResults
 
def previous
 
def results
 
def setDataAccessor
 
- Public Member Functions inherited from Vispa.Share.ObjectHolder.ObjectHolder
def __init__
 
def allDataObjectChildren
 
def appendObject
 
def applyFilter
 
def clearObjects
 
def dataAccessor
 
def dataObject
 
def dataObjects
 
def dataObjectsCount
 
def numberDataObjectChildren
 
def removeObject
 
def setDataAccessor
 
def setDataObject
 
def setDataObjects
 
def setExclusiveMode
 
def setFilter
 

Private Member Functions

def _findIn
 

Private Attributes

 _index
 
 _message
 
 _results
 

Detailed Description

Searches for label and properties in a list of objects using a BasicDataAccessor.

One can search using findUsingFindDialog where a FindDialog is used as input for the search label and properties.
Navigation through the results in supported by next(), previous(),numberOfResult(),currentNumber()

Definition at line 7 of file FindAlgorithm.py.

Constructor & Destructor Documentation

def Vispa.Share.FindAlgorithm.FindAlgorithm.__init__ (   self)

Member Function Documentation

def Vispa.Share.FindAlgorithm.FindAlgorithm._findIn (   self,
  object,
  dialog 
)
private

Definition at line 41 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), Vispa.Share.FindAlgorithm.FindAlgorithm._message, RooGKCounter._message, Vispa.Share.ObjectHolder.ObjectHolder.applyFilter(), Vispa.Share.ObjectHolder.ObjectHolder.dataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.dataAccessor(), Vispa.Main.Exceptions.exception_traceback(), and diffTwoXMLs.label.

Referenced by Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), and Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog().

41 
42  def _findIn(self, object,dialog):
43  # find Label
44  foundLabel=True
45  findLabel=dialog.label()
46  if findLabel!="":
47  label=self.dataAccessor().label(object)
48  #logging.debug(__name__ +': _findIn: ' + label)
49  if not dialog.caseSensitive():
50  label=label.lower()
51  findLabel=findLabel.lower()
52  if dialog.exactMatch():
53  foundLabel=findLabel=="" or findLabel==label
54  else:
55  foundLabel=findLabel in label
56 
57  # find property
58  foundProperties=True
59  findProperties=dialog.properties()
60  if len(findProperties)>0 and (findProperties[0][0]!="" or findProperties[0][1]!=""):
61  properties=[(p[1],p[2]) for p in self.dataAccessor().properties(object)]
62  if not dialog.caseSensitive():
63  properties=[(str(property[0]).lower(),str(property[1]).lower()) for property in properties]
64  findProperties=[(str(property[0]).lower(),str(property[1]).lower()) for property in findProperties]
65  if dialog.exactMatch():
66  for findProperty in findProperties:
67  foundProperties=(foundProperties and\
68  True in [(findProperty[0]=="" or findProperty[0]==p[0]) and\
69  (findProperty[1]=="" or findProperty[1]==p[1]) for p in properties])
70  else:
71  for findProperty in findProperties:
72  foundProperties=(foundProperties and\
73  True in [findProperty[0] in p[0] and\
74  findProperty[1] in p[1] for p in properties])
75 
76  # find property
77  findScripts=dialog.scripts()
78  foundScripts=True
79  if len(findScripts)>0 and findScripts[0]!="":
80  dataAccessorObject=BasicDataAccessorInterface(object,self.dataAccessor())
81  for findScript in findScripts:
82  try:
83  foundScripts=(foundScripts and\
84  (findScript=="" or dataAccessorObject.runScript(findScript)))
85  except Exception,e:
86  foundScripts=False
87  logging.info("Error in script: "+ exception_traceback())
88  self._message="Error in script: "+ str(e)
89 
90  # combine the searches
91  found=foundLabel and foundProperties and foundScripts
92  if found:
93  results=[object]
94  else:
95  results=[]
96  for daughter in self.applyFilter(self.dataAccessor().children(object)):
97  for object in self._findIn(daughter,dialog):
98  if not object in results:
99  results+=[object]
100  return results
def Vispa.Share.FindAlgorithm.FindAlgorithm.clear (   self)

Definition at line 25 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._message, RooGKCounter._message, and Vispa.Share.FindAlgorithm.FindAlgorithm._results.

Referenced by Vispa.Views.WidgetView.WidgetView.closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView.closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView.setDataObjects(), Vispa.Views.WidgetView.WidgetView.setDataObjects(), Vispa.Views.TreeView.TreeView.updateContent(), Vispa.Views.TableView.TableView.updateContent(), Vispa.Views.BoxDecayView.BoxDecayView.updateContent(), and Vispa.Views.PropertyView.PropertyView.updateContent().

25 
26  def clear(self):
27  self._message=None
28  self._results=[]
def Vispa.Share.FindAlgorithm.FindAlgorithm.currentNumber (   self)

Definition at line 107 of file FindAlgorithm.py.

References SeedingNode< DATA >._index, and Vispa.Share.FindAlgorithm.FindAlgorithm._index.

108  def currentNumber(self):
109  return self._index+1
def Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog (   self,
  dialog 
)

Definition at line 29 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, Vispa.Share.FindAlgorithm.FindAlgorithm._results, EopVariables.clear(), TrackerTreeVariables.clear(), CastorCalibrationsSet.clear(), TkOffTreeVariables.clear(), ReducedTrackerTreeVariables.clear(), StringMap.clear(), AlignmentErrors.clear(), AlignmentErrorsExtended.clear(), Alignments.clear(), ora::MultiRecordSelectOperation.clear(), CastorCalibrationWidthsSet.clear(), HcalCalibrationsSet.clear(), HcalCalibrationWidthsSet.clear(), HLTTauDQMOfflineObjects.clear(), OOTPileupCorrectionColl.clear(), NumberOfDevices.clear(), edm::reftobase::RefVectorHolderBase.clear(), Overlayer.clear(), cond::PayloadRef< DataT >.clear(), ora::DataElement.clear(), Vispa.Plugins.EdmBrowser.EventContentView.EventContentView.clear(), StorableDoubleMap< T >.clear(), ora::TransactionCache.clear(), edm::BranchChildren.clear(), ora::MultiIndexDataTrie.clear(), ora::Sequences.clear(), ora::RelationalDeleter.clear(), Vispa.Share.FindAlgorithm.FindAlgorithm.clear(), CSCALCTDigi.clear(), CSCCLCTDigi.clear(), ecaldqm::MESetMulti.clear(), edm::reftobase::BaseVectorHolder< T >.clear(), edm::reftobase::RefVectorHolder< REFV >.clear(), CSCCorrelatedLCTDigi.clear(), helper::ClusterStorer.clear(), reco::PattRecoTree< ScaleType, Cluster >.clear(), edm::reftobase::IndirectVectorHolder< T >.clear(), ClusterCollectionFP420.clear(), RecoCollectionFP420.clear(), TrackCollectionFP420.clear(), ClhepEvaluator.clear(), python.seqvaluedict.seqdict.clear(), OpticalAlignMeasurementInfo.clear(), ora::NamedSequence.clear(), DigiCollectionFP420.clear(), ora::PoolDbCache.clear(), SegmentToTrackAssociator.clear(), ora::ContainerUpdateTable.clear(), FWFromSliceSelector.clear(), pos::PixelROCStatus.clear(), AlignmentParameterSelector.clear(), edm::reftobase::VectorHolder< T, REFVECTOR >.clear(), cond::SequenceManager.clear(), edm::OrphanHandleBase.clear(), DataFormats_MuonReco::dictionary::edm::OrphanHandleBase.clear(), edm::ParentageRegistry.clear(), CondIter< DataT >.clear(), ora::RelationalBuffer.clear(), ecaldqm::MESet.clear(), HLTPerformanceInfo::Module.clear(), SiPixelPerformanceSummary.clear(), ora::IArrayHandler.clear(), CSCTriggerContainer< T >.clear(), edm::RefToBaseVector< T >.clear(), edm::StreamedProduct.clear(), MuonResidualsFromTrack.clear(), ora::Handle< T >.clear(), ora::SequenceManager.clear(), DTBufferTree< Key, Content >.clear(), DrawIteration.clear(), edm::ThinnedAssociationsHelper.clear(), OpticalAlignParam.clear(), ora::PVectorReader.clear(), cond::Iov_t.clear(), edm::WorkerRegistry.clear(), egHLT::OffEvt.clear(), edm::ScheduleItems.clear(), SiStripDelay.clear(), edm::HandleBase.clear(), DataFormats_MuonReco::dictionary::edm::HandleBase.clear(), ora::CArrayHandler.clear(), SiStripQuality.clear(), edm::TrieFactory< T >.clear(), DDI::Store< N, I, K >.clear(), cond::Tag_t.clear(), ora::IRelationalReader.clear(), edm::Association< C >.clear(), DDBase< N, C >.clear(), edm::DetSet< T >.clear(), SiPixelCalibDigiProducer.clear(), DTTFFEDReader.clear(), ora::STLContainerHandler.clear(), ora::QueryableVectorReader.clear(), ora::MappingDatabase.clear(), edm::ProcessHistory.clear(), FBaseSimEvent.clear(), ora::PVectorHandler.clear(), BXVector< T >.clear(), ora::PrimitiveReader.clear(), ora::OraReferenceReader.clear(), edm::PtrVectorBase.clear(), HLTPerformanceInfo::Path.clear(), DataFormats_MuonReco::dictionary::edm::PtrVectorBase.clear(), ora::BlobReader.clear(), l1t::IntervalManager< TimeType, PayloadType >.clear(), ora::UniqueRefReader.clear(), ora::OraPtrReader.clear(), ora::CArrayReader.clear(), ora::InlineCArrayReader.clear(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >.clear(), ora::ObjectReader.clear(), OpticalAlignInfo.clear(), DTCCBConfig.clear(), HcalDTCHeader.clear(), ora::STLContainerReader.clear(), CondBasicIter.clear(), edm::RefVectorBase< T >.clear(), ora::NamedRefReader.clear(), CSCDCCExaminer.clear(), DTLVStatus.clear(), DTT0.clear(), DDXMLElement.clear(), DTTPGParameters.clear(), FWGeometry.clear(), ora::SpecialSTLContainerHandler.clear(), DTRangeT0.clear(), CastorCTDCHeader.clear(), edm::Handle< GenericObject >.clear(), Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor.clear(), HcalDCCHeader.clear(), AlignmentParameterSelector::PXBDetIdRanges.clear(), DTHVStatus.clear(), edm::EventSetup.clear(), edm::Handle< FWGenericObject >.clear(), edm::TrieNode< T >.clear(), DTReadOutMapping.clear(), edm::OwnArray< T, MAX_SIZE, P >.clear(), reco::FlavorHistoryEvent.clear(), AlignmentParameterSelector::PXFDetIdRanges.clear(), edm::RefVector< C, T, F >.clear(), edm::OwnVector< T, P >.clear(), DTTtrig.clear(), DTPerformance.clear(), AlignmentParameterSelector::TIBDetIdRanges.clear(), edm::AssociationMap< Tag >.clear(), DTStatusFlag.clear(), HLTPerformanceInfo.clear(), AlignmentParameterSelector::TIDDetIdRanges.clear(), edm::ValueMap< T >.clear(), DTDeadFlag.clear(), ora::SelectOperation.clear(), AlignmentParameterSelector::TOBDetIdRanges.clear(), DTMtime.clear(), AlignmentParameterSelector::TECDetIdRanges.clear(), pos::PixelFEDCard.clear(), ora::PVector< Tp >.clear(), graph< N, E >.clear(), edm::Trie< T >.clear(), reco::HitPattern.clear(), ora::QueryableVector< Tp >.clear(), Json::Value.clear(), BeautifulSoup.Tag.clear(), Vispa.Share.ObjectHolder.ObjectHolder.dataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.dataAccessor(), and Vispa.Share.ObjectHolder.ObjectHolder.dataObjects().

29 
30  def findUsingFindDialog(self, dialog):
31  logging.debug(__name__ +': findUsingFindDialog')
32  self.clear()
33  if self.dataAccessor():
34  for object in self.dataObjects():
35  self._results+=self._findIn(object,dialog)
36  self._index=0
37  if len(self._results)>0:
38  return self._results[0]
39  else:
40  return []
def Vispa.Share.FindAlgorithm.FindAlgorithm.message (   self)

Definition at line 126 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._message, and RooGKCounter._message.

def Vispa.Share.FindAlgorithm.FindAlgorithm.next (   self)

Definition at line 110 of file FindAlgorithm.py.

References SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, and Vispa.Share.FindAlgorithm.FindAlgorithm._results.

Referenced by BeautifulSoup.PageElement._invert().

111  def next(self):
112  if len(self._results)==0:
113  return None
114  self._index+=1
115  if self._index>len(self._results)-1:
116  self._index=0
117  return self._results[self._index]
def Vispa.Share.FindAlgorithm.FindAlgorithm.numberOfResults (   self)

Definition at line 104 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._results.

105  def numberOfResults(self):
106  return len(self._results)
def Vispa.Share.FindAlgorithm.FindAlgorithm.previous (   self)

Definition at line 118 of file FindAlgorithm.py.

References SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, and Vispa.Share.FindAlgorithm.FindAlgorithm._results.

Referenced by BeautifulSoup.PageElement._invert().

119  def previous(self):
120  if len(self._results)==0:
121  return None
122  self._index-=1
123  if self._index<0:
124  self._index=len(self._results)-1
125  return self._results[self._index]
def Vispa.Share.FindAlgorithm.FindAlgorithm.results (   self)

Definition at line 101 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._results.

102  def results(self):
103  return self._results
def Vispa.Share.FindAlgorithm.FindAlgorithm.setDataAccessor (   self,
  accessor 
)

Definition at line 19 of file FindAlgorithm.py.

19 
20  def setDataAccessor(self, accessor):
21  logging.debug(__name__ + ": setDataAccessor")
22  if not isinstance(accessor, BasicDataAccessor):
23  raise TypeError(__name__ + " requires data accessor of type BasicDataAccessor.")
24  ObjectHolder.setDataAccessor(self, accessor)

Member Data Documentation

Vispa.Share.FindAlgorithm.FindAlgorithm._index
private

Definition at line 16 of file FindAlgorithm.py.

Referenced by python.cmstools.EventTree.__getitem__(), python.cmstools.EventTree.__iter__(), python.cmstools.EventBranch.__readData(), python.cmstools.EventTree.__setBranchIndicies(), Vispa.Share.FindAlgorithm.FindAlgorithm.currentNumber(), Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog(), python.cmstools.EventTree.index(), Vispa.Share.FindAlgorithm.FindAlgorithm.next(), Vispa.Share.FindAlgorithm.FindAlgorithm.previous(), python.cmstools.EventBranch.setIndex(), and html.HtmlReport.write().

Vispa.Share.FindAlgorithm.FindAlgorithm._message
private

Definition at line 17 of file FindAlgorithm.py.

Referenced by Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), Vispa.Share.FindAlgorithm.FindAlgorithm.clear(), and Vispa.Share.FindAlgorithm.FindAlgorithm.message().

Vispa.Share.FindAlgorithm.FindAlgorithm._results
private

Definition at line 15 of file FindAlgorithm.py.

Referenced by Vispa.Share.FindAlgorithm.FindAlgorithm.clear(), Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog(), Vispa.Share.FindAlgorithm.FindAlgorithm.next(), Vispa.Share.FindAlgorithm.FindAlgorithm.numberOfResults(), Vispa.Share.FindAlgorithm.FindAlgorithm.previous(), and Vispa.Share.FindAlgorithm.FindAlgorithm.results().