54. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/16/2019 12:20:47 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

54.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\CPRS_32_P2_PCE\OR_30_405V60_SRC\Cover Sheet oDelimitedString.pas Wed Dec 12 14:04:36 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\CPRS v32 P2 PCE Standardization-redacted\CPRS_32_P2_PCE\OR_30_405V60_SRC\Cover Sheet oDelimitedString.pas Fri Apr 12 13:42:28 2019 UTC

54.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 964
Changed 1 2
Inserted 0 0
Removed 0 0

54.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

54.4 Active regular expressions

No regular expressions were active.

54.5 Comparison detail

  1   unit oDeli mitedStrin g;
  2   {
  3     ======== ========== ========== ========== ========== ========== ========== ========== ==
  4     *
  5     *        Applicatio n:  CPRS -  Utility
  6              Developer:       PII                   
  7     *        Site:          Salt L ake City I SC
  8     *        Date:          2015-1 2-04
  9     *
  10     *        Descriptio n:  A bett er (IMHO)  way of han dling deli mited stri ngs from M
  11     *                       as wel l as a way  to store  the string s as an ob ject.
  12     *
  13     *        Notes:
  14     *
  15     ======== ========== ========== ========== ========== ========== ========== ========== ==
  16   }
  17  
  18   interface
  19  
  20   uses
  21     System.C lasses,
  22     System.S ysUtils;
  23  
  24   type
  25     TDelimit edStringDa teTimeStyl e = (dsdts Fileman, d sdtsSQL);
  26     TDelimit edStringDa teTimeForm at = (dsdt fDateTime,  dsdtfDate Only, dsdt fTimeOnly) ;
  27  
  28     TDelimit edString =  class(TOb ject)
  29     private
  30       fDelim iter: Char ;
  31       fList:  TStringLi st;
  32       fTrue:  string;
  33       fFalse : string;
  34       fDateT imeStyle:  TDelimited StringDate TimeStyle;
  35       fDoubl e: double;
  36       fInteg er: intege r;
  37  
  38       functi on getFals eStr: stri ng;
  39       functi on getTrue Str: strin g;
  40       functi on getCoun t: integer ;
  41       functi on getStyl e: TDelimi tedStringD ateTimeSty le;
  42  
  43       proced ure setFal seStr(cons t aValue:  string);
  44       proced ure setTru eStr(const  aValue: s tring);
  45       proced ure setSty le(const a Value: TDe limitedStr ingDateTim eStyle);
  46     public
  47       constr uctor Crea te(aString : string;  aDelimiter : Char = ' ^');
  48       destru ctor Destr oy; overri de;
  49  
  50       functi on GetPiec e(aIndex:  integer):  string; ov erload;
  51       functi on GetPiec e(aStart:  integer; a Stop: inte ger): stri ng; overlo ad;
  52       functi on GetPiec eAsString( aIndex: in teger; aDe fault: str ing = ''):  string;
  53       functi on GetPiec eAsInteger (aIndex: i nteger; aD efault: in teger = 0) : integer;
  54       functi on GetPiec eAsDouble( aIndex: in teger; aDe fault: dou ble = 0.0) : double;
  55       functi on GetPiec eAsBoolean (aIndex: i nteger; aD efault: bo olean = Fa lse): bool ean;
  56       functi on GetPiec eAsFMDateT imeStr(aIn dex: integ er; aDefau lt: double  = 0.0): s tring;
  57       functi on GetPiec eAsTDateTi me(aIndex:  integer;  aDefault:  TDateTime  = 0.0; aFo rmat: TDel imitedStri ngDateTime Format = d sdtfDateTi me): TDate Time;
  58       functi on GetPiec eEquals(aI ndex: inte ger; aComp areValue:  string; aC aseSensiti ve: boolea n = True):  boolean;  overload;
  59       functi on GetPiec eEquals(aI ndex: inte ger; aComp areValue:  integer):  boolean; o verload;
  60       functi on GetPiec eEquals(aI ndex: inte ger; aComp areValue:  double): b oolean; ov erload;
  61       functi on GetPiec eEquals(aI ndex: inte ger; aComp areValue:  boolean):  boolean; o verload;
  62       functi on GetPiec eIsDouble( aIndex: in teger): bo olean;
  63       functi on GetPiec eIsInteger (aIndex: i nteger): b oolean;
  64       functi on GetPiec eIsNotNull (aIndex: i nteger): b oolean;
  65       functi on GetPiec eIsNull(aI ndex: inte ger): bool ean;
  66       functi on GetPiec eIsTDateTi me(aIndex:  integer):  boolean;
  67  
  68       functi on GetDeli mitedStrin g: string;
  69       functi on GetStri ngInfo: st ring;
  70  
  71       proced ure SetPie ce(aIndex:  integer;  aValue: st ring); ove rload;
  72       proced ure SetPie ce(aIndex:  integer;  aValue: in teger); ov erload;
  73       proced ure SetPie ce(aIndex:  integer;  aValue: do uble; aPre cision: in teger = 2) ; overload ;
  74       proced ure SetPie ce(aIndex:  integer;  aValue: bo olean); ov erload;
  75       proced ure SetPie ce(aIndex:  integer;  aValue: TD ateTime);  overload;
  76  
  77       proper ty FalseSt r: string  read getFa lseStr wri te setFals eStr;
  78       proper ty TrueStr : string r ead getTru eStr write  setTrueSt r;
  79       proper ty Style:  TDelimited StringDate TimeStyle  read getSt yle write  setStyle;
  80       proper ty Count:  integer re ad getCoun t;
  81       proper ty Piece[a Index: int eger]: str ing read G etPiece; d efault;
  82     end;
  83  
  84   function N ewDelimite dString(aS tring: str ing; aDeli miter: Cha r = '^'):  TDelimited String;
  85  
  86   implementa tion
  87  
  88   function N ewDelimite dString(aS tring: str ing; aDeli miter: Cha r = '^'):  TDelimited String;
  89   begin
  90     Result : = TDelimit edString.C reate(aStr ing, aDeli miter);
  91   end;
  92  
  93   { TDelimit edString }
  94  
  95   constructo r TDelimit edString.C reate(aStr ing: strin g; aDelimi ter: Char  = '^');
  96   begin
  97     inherite d Create;
  98     fTrue :=  '1';
  99     fFalse : = '0';
  100     fDateTim eStyle :=  dsdtsFilem an;
  101     fDelimit er := aDel imiter;
  102     fList :=  TStringLi st.Create;
  103     fList.De limiter :=  aDelimite r;
  104     fList.St rictDelimi ter := Tru e;
  105     fList.De limitedTex t := aStri ng;
  106   end;
  107  
  108   destructor  TDelimite dString.De stroy;
  109   begin
  110     fList.Cl ear;
  111     FreeAndN il(fList);
  112     inherite d;
  113   end;
  114  
  115   function T DelimitedS tring.getC ount: inte ger;
  116   begin
  117     Result : = fList.Co unt;
  118   end;
  119  
  120   function T DelimitedS tring.GetD elimitedSt ring: stri ng;
  121   begin
  122     Result : = fList.De limitedTex t;
  123   end;
  124  
  125   function T DelimitedS tring.getF alseStr: s tring;
  126   begin
  127     Result : = fFalse;
  128   end;
  129  
  130   function T DelimitedS tring.getS tyle: TDel imitedStri ngDateTime Style;
  131   begin
  132     Result : = fDateTim eStyle;
  133   end;
  134  
  135   function T DelimitedS tring.getT rueStr: st ring;
  136   begin
  137     Result : = fTrue;
  138   end;
  139  
  140   procedure  TDelimited String.set FalseStr(c onst aValu e: string) ;
  141   begin
  142     fFalse : = aValue;
  143   end;
  144  
  145   procedure  TDelimited String.set Style(cons t aValue:  TDelimited StringDate TimeStyle) ;
  146   begin
  147     fDateTim eStyle :=  aValue;
  148   end;
  149  
  150   procedure  TDelimited String.set TrueStr(co nst aValue : string);
  151   begin
  152     fTrue :=  aValue;
  153   end;
  154  
  155   function T DelimitedS tring.GetP iece(aInde x: integer ): string;
  156   { Does the  actual 'r eading' of  the value s - all ot her method s come her e }
  157   begin
  158     if fList .Count > 0  then
  159       if (aI ndex <= fL ist.Count)  and (aInd ex > 0) th en
  160         Resu lt := fLis t[aIndex -  1]
  161       else
  162         Resu lt := ''
  163     else
  164       Result  := '';
  165   end;
  166  
  167   function T DelimitedS tring.GetP iece(aStar t: integer ; aStop: i nteger): s tring;
  168   var
  169     i: integ er;
  170   begin
  171     Result : = '';
  172     for i :=  aStart to  aStop do
  173       begin
  174         Resu lt := Resu lt + GetPi ece(i);
  175         if i  < aStop t hen
  176           Re sult := Re sult + fDe limiter;
  177       end;
  178   end;
  179  
  180   function T DelimitedS tring.GetP ieceAsBool ean(aIndex : integer;  aDefault:  boolean):  boolean;
  181   begin
  182     Result : = CompareS tr(GetPiec e(aIndex),  fTrue) =  0;
  183   end;
  184  
  185   function T DelimitedS tring.GetP ieceAsDoub le(aIndex:  integer;  aDefault:  double): d ouble;
  186   begin
  187     Result : = StrToFlo atDef(GetP iece(aInde x), aDefau lt);
  188   end;
  189  
  190   function T DelimitedS tring.GetP ieceAsFMDa teTimeStr( aIndex: in teger; aDe fault: dou ble = 0.0) : string;
  191   var
  192     aStr: st ring;
  193     aDT: TDa teTime;
  194     YY, MM,  DD: intege r;
  195     h, m, s:  integer;
  196   begin
  197     if GetPi eceIsNotNu ll(aIndex)  then
  198       try
  199         aStr  := FloatT oStr(GetPi eceAsDoubl e(aIndex,  aDefault)  + 0.000000 1);
  200  
  201         YY : = StrToInt Def(Copy(a Str, 1, 3) , 0) + 170 0;
  202         MM : = StrToInt Def(Copy(a Str, 4, 2) , 0);
  203         DD : = StrToInt Def(Copy(a Str, 6, 2) , 0);
  204  
  205         h :=  StrToIntD ef(Copy(aS tr, 9, 2),  0);
  206         m :=  StrToIntD ef(Copy(aS tr, 11, 2) , 0);
  207         s :=  StrToIntD ef(Copy(aS tr, 13, 2) , 0);
  208  
  209         aStr  := 'MMM D D, YYYY';
  210  
  211         if ( MM = 0) th en
  212           be gin
  213              MM := 1;
  214              DD := 1;
  215              aStr := 'Y YYY';
  216           en d
  217         else  if (DD =  0) then
  218           be gin
  219              DD := 1;
  220              aStr := 'M MM YYYY';
  221           en d;
  222  
  223         aDT  := EncodeD ate(YY, MM , DD);
  224         if ( h > 0) or  (m > 0) or  (s > 0) t hen
  225           be gin
  226              aDT := aDT  + EncodeT ime(h, m,  s, 0);
  227              aStr := aS tr + ' @ h h:mm:ss';
  228           en d;
  229  
  230         Resu lt := Form atDateTime (aStr, aDT );
  231       except
  232         Resu lt := '##'  + GetPiec e(aIndex)  + '##';
  233       end
  234     else
  235       Result  := '';
  236   end;
  237  
  238   function T DelimitedS tring.GetP ieceAsInte ger(aIndex , aDefault : integer) : integer;
  239   begin
  240     Result : = StrToInt Def(GetPie ce(aIndex) , aDefault );
  241   end;
  242  
  243   function T DelimitedS tring.GetP ieceAsStri ng(aIndex:  integer;  aDefault:  string): s tring;
  244   begin
  245     Result : = GetPiece (aIndex);
  246     if Resul t = '' the n
  247       Result  := aDefau lt;
  248   end;
  249  
  250   function T DelimitedS tring.GetP ieceAsTDat eTime(aInd ex: intege r; aDefaul t: TDateTi me = 0.0;  aFormat: T DelimitedS tringDateT imeFormat  = dsdtfDat eTime): TD ateTime;
  251   var
  252     aDT: str ing;
  253     YY, MM,  DD: Word;
  254     h, m, s:  Word;
  255   begin
  256     Result : = aDefault ;
  257  
  258     aDT := G etPiece(aI ndex);
  259     if aDT =  '' then
  260       Exit;
  261  
  262     case fDa teTimeStyl e of
  263       dsdtsF ileman: {  VA Fileman  YYYMMDD.h hmmss }
  264         try
  265           aD T := Float ToStr(StrT oFloat(aDT ) + 0.0000 001); // M ay need to  use FORMA T HERE!!!
  266           YY  := StrToI nt(Copy(aD T, 1, 3))  + 1700;
  267           MM  := StrToI nt(Copy(aD T, 4, 2));
  268           DD  := StrToI nt(Copy(aD T, 6, 2));
  269           h  := StrToIn t(Copy(aDT , 9, 2));
  270           m  := StrToIn t(Copy(aDT , 11, 2));
  271           s  := StrToIn t(Copy(aDT , 13, 2));
  272           Re sult := En codeDate(Y Y, MM, DD)  + EncodeT ime(h, m,  s, 0);
  273         exce pt
  274           Re sult := aD efault;
  275         end;
  276       dsdtsS QL: { SQL  DATE TIME  YYYY-MM-DD  hh:mm:ss  }
  277         try
  278           YY  := StrToI nt(Copy(aD T, 1, 4));
  279           MM  := StrToI nt(Copy(aD T, 6, 2));
  280           DD  := StrToI nt(Copy(aD T, 9, 2));
  281           h  := StrToIn t(Copy(aDT , 12, 2));
  282           m  := StrToIn t(Copy(aDT , 15, 2));
  283           s  := StrToIn t(Copy(aDT , 18, 2));
  284           Re sult := En codeDate(Y Y, MM, DD)  + EncodeT ime(h, m,  s, 0);
  285         exce pt
  286           Re sult := aD efault;
  287         end;
  288     else
  289       Result  := aDefau lt;
  290     end;
  291   end;
  292  
  293   function T DelimitedS tring.GetP ieceEquals (aIndex: i nteger; aC ompareValu e: double) : boolean;
  294   var
  295     aPiece:  double;
  296   begin
  297     if GetPi eceIsNotNu ll(aIndex)  then
  298       begin
  299         aPie ce := GetP ieceAsDoub le(aIndex,  aCompareV alue - 1);
  300         Resu lt := aPie ce = aComp areValue;
  301       end
  302     else
  303       Result  := False;
  304   end;
  305  
  306   function T DelimitedS tring.GetP ieceEquals (aIndex, a CompareVal ue: intege r): boolea n;
  307   var
  308     aPiece:  integer;
  309   begin
  310     if GetPi eceIsNotNu ll(aIndex)  then
  311       begin
  312         aPie ce := GetP ieceAsInte ger(aIndex , aCompare Value - 1) ;
  313         Resu lt := aPie ce = aComp areValue;
  314       end
  315     else
  316       Result  := False;
  317   end;
  318  
  319   function T DelimitedS tring.GetP ieceEquals (aIndex: i nteger; aC ompareValu e: boolean ): boolean ;
  320   begin
  321     case aCo mpareValue  of
  322       True:
  323         Resu lt := (Com pareStr(Ge tPiece(aIn dex), fTru e) = 0);
  324       False:
  325         Resu lt := (Com pareStr(Ge tPiece(aIn dex), fFal se) = 0);
  326     else
  327       Result  := False;
  328     end;
  329   end;
  330  
  331   function T DelimitedS tring.GetP ieceEquals (aIndex: i nteger; aC ompareValu e: string;  aCaseSens itive: boo lean = Tru e): boolea n;
  332   var
  333     aPiece:  string;
  334   begin
  335     aPiece : = GetPiece (aIndex);
  336     case aCa seSensitiv e of
  337       True:
  338         Resu lt := (Com pareStr(aP iece, aCom pareValue)  = 0);
  339       False:
  340         Resu lt := (Com pareText(a Piece, aCo mpareValue ) = 0);
  341     else
  342       Result  := False;
  343     end;
  344   end;
  345  
  346   function T DelimitedS tring.GetS tringInfo:  string;
  347   var
  348     aLst: TS tringList;
  349     i: integ er;
  350   begin
  351     aLst :=  TStringLis t.Create;
  352     try
  353       aLst.A dd('Delimi ted String ');
  354       aLst.A dd('  Stri ng ......:  ' + GetDe limitedStr ing);
  355       aLst.A dd('  Coun t .......:  ' + IntTo Str(fList. Count));
  356       aLst.A dd('  Deli miter ...:  ' + fDeli miter);
  357       aLst.A dd('  True /False ..:  ' + fTrue  + '/' + f False);
  358       for i  := 0 to fL ist.Count  - 1 do
  359         aLst .Add(Forma t('  %2.2d :  %s', [i  + 1, fLis t[i]]));
  360       Result  := aLst.T ext;
  361     finally
  362       FreeAn dNil(aLst) ;
  363     end;
  364   end;
  365  
  366   procedure  TDelimited String.Set Piece(aInd ex: intege r; aValue:  string);
  367   { Does the  actual se tting of t he piece -  all other s convert  and come h ere }
  368   begin
  369     while fL ist.Count  < aIndex d o
  370       fList. Add('');
  371     fList[aI ndex - 1]  := aValue;
  372   end;
  373  
  374   procedure  TDelimited String.Set Piece(aInd ex: intege r; aValue:  boolean);
  375   begin
  376     if aValu e then
  377       SetPie ce(aIndex,  fTrue)
  378     else
  379       SetPie ce(aIndex,  fFalse);
  380   end;
  381  
  382   procedure  TDelimited String.Set Piece(aInd ex: intege r; aValue:  TDateTime );
  383   var
  384     aFMDT: d ouble;
  385     YY: Word ;
  386     MM: Word ;
  387     DD: Word ;
  388     h: Word;
  389     m: Word;
  390     s: Word;
  391     ms: Word ;
  392   begin
  393     DecodeDa te(aValue,  YY, MM, D D);
  394     DecodeTi me(aValue,  h, m, s,  ms);
  395  
  396     case fDa teTimeStyl e of
  397       dsdtsF ileman:
  398         begi n
  399           YY  := YY - 1 700;
  400           aF MDT := (YY  * 10000)  + (MM * 10 0) + DD;
  401           if  (h + m +  s) > 0 the n
  402              aFMDT := a FMDT + (h  * 0.01) +  (m * 0.000 1) + (s *  0.000001);
  403           Se tPiece(aIn dex, Forma t('%.6f',  [aFMDT]));
  404         end;
  405       dsdtsS QL:
  406         begi n
  407           Se tPiece(aIn dex, Forma tDateTime( 'YYYY-MM-D D hh:nn:ss ', aValue) );
  408         end;
  409     else
  410     end;
  411   end;
  412  
  413   procedure  TDelimited String.Set Piece(aInd ex: intege r; aValue:  double; a Precision:  integer =  2);
  414   begin
  415     SetPiece (aIndex, F ormat('%1. *f', [aPre cision, aV alue]));
  416   end;
  417  
  418   procedure  TDelimited String.Set Piece(aInd ex: intege r; aValue:  integer);
  419   begin
  420     SetPiece (aIndex, I ntToStr(aV alue))
  421   end;
  422  
  423   function T DelimitedS tring.GetP ieceIsDoub le(aIndex:  integer):  boolean;
  424   var
  425     aCode: i nteger;
  426   begin
  427     try
  428       if Get PieceIsNot Null(aInde x) then
  429         begi n
  430           Va l(GetPiece (aIndex),  fDouble, a Code);
  431           Re sult := (a Code = 0);
  432         end
  433       else
  434         Resu lt := Fals e;
  435     except
  436       on E:  EConvertEr ror do
  437         Resu lt := Fals e;
  438       on E:  Exception  do
  439         rais e E;
  440     end;
  441   end;
  442  
  443   function T DelimitedS tring.GetP ieceIsInte ger(aIndex : integer) : boolean;
  444   var
  445     aCode: i nteger;
  446   begin
  447     try
  448       if Get PieceIsNot Null(aInde x) then
  449         begi n
  450           Va l(GetPiece (aIndex),  fInteger,  aCode);
  451           Re sult := (a Code = 0);
  452         end
  453       else
  454         Resu lt := Fals e;
  455     except
  456       on E:  EConvertEr ror do
  457         Resu lt := Fals e;
  458       on E:  Exception  do
  459         rais e E;
  460     end;
  461   end;
  462  
  463   function T DelimitedS tring.GetP ieceIsNotN ull(aIndex : integer) : boolean;
  464   begin
  465     Result : = (Length( GetPiece(a Index)) >  0);
  466   end;
  467  
  468   function T DelimitedS tring.GetP ieceIsNull (aIndex: i nteger): b oolean;
  469   begin
  470     Result : = (Length( GetPiece(a Index)) =  0);
  471   end;
  472  
  473   function T DelimitedS tring.GetP ieceIsTDat eTime(aInd ex: intege r): boolea n;
  474   begin
  475     try
  476       GetPie ceAsTDateT ime(aIndex );
  477       Result  := True;
  478     except
  479       Result  := False;
  480     end;
  481   end;
  482  
  483   end.