BesTofDatSvc::BesTofDatSvc Class Reference

List of all members.

Public Member Functions

def __init__
def do
def write

Private Attributes

 __rootPath
 __file
 __fileLines

Detailed Description

Definition at line 3 of file BesTofDatSvc.py.


Member Function Documentation

def BesTofDatSvc::BesTofDatSvc::__init__ (   self  ) 

Definition at line 4 of file BesTofDatSvc.py.

00004                     :
00005     import os
00006     self.__rootPath = os.getenv('TOFSIMROOT') + '/dat/'
00007 
00008     self.__file = open(self.__rootPath + 'srcBesTof.txt', 'r')
00009     self.__fileLines = self.__file.readlines()
00010     self.__file.close()
00011 
  def do(self, key, value): 

def BesTofDatSvc::BesTofDatSvc::do (   self,
  key,
  value 
)

Definition at line 12 of file BesTofDatSvc.py.

00012                           : 
00013     oldLines = self.__fileLines
00014     upperKey = key.upper()
00015     lineNo = 0
00016     wantLine = 0
00017     wantWord = 0
00018     
00019     for eachLine in oldLines:
00020       upperLine = eachLine.upper()
00021       allWords = upperLine.split()
00022       wordNo = 0
00023       flag = 0
00024       
00025       for eachWord in allWords:
00026         if eachWord == upperKey:
00027           wantLine = lineNo + 1
00028           wantWord = wordNo
00029           flag = 1
00030           break
00031         wordNo = wordNo + 1
00032       
00033       if flag == 1:
00034         break
00035       lineNo = lineNo + 1       
00036     
00037     oldValues = oldLines[wantLine].split()
00038 
00039     newValues = []
00040     for i in xrange(oldValues.__len__()):
00041       if i == wantWord:
00042         newValues.append(value)
00043       else:
00044         newValues.append(oldValues[i])
00045     newLine = ' '.join(newValues)
00046     newLine = newLine + '\n'
00047 
00048     self.__fileLines = []
00049     for i in xrange(oldLines.__len__()):
00050       if i == wantLine:
00051         self.__fileLines.append(newLine)
00052       else:
00053         self.__fileLines.append(oldLines[i])
00054 

def BesTofDatSvc::BesTofDatSvc::write (   self  ) 

Definition at line 55 of file BesTofDatSvc.py.

00055                  :    
00056     outFile = open(self.__rootPath + 'BesTof.txt', 'w')
00057     outFile.writelines(self.__fileLines)
00058     outFile.close()
00059 
00060 


Member Data Documentation

BesTofDatSvc::BesTofDatSvc::__file [private]

Definition at line 8 of file BesTofDatSvc.py.

BesTofDatSvc::BesTofDatSvc::__fileLines [private]

Definition at line 9 of file BesTofDatSvc.py.

BesTofDatSvc::BesTofDatSvc::__rootPath [private]

Definition at line 6 of file BesTofDatSvc.py.


Generated on Tue Nov 29 23:36:23 2016 for BOSS_7.0.2 by  doxygen 1.4.7