Produced by Araxis Merge on 12/13/2018 10:35:23 AM Eastern Standard 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\model\report\scheduled | MultiDayTimeUnitType.java | Fri Dec 7 17:36:44 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\model\report\scheduled | MultiDayTimeUnitType.java | Thu Dec 13 15:05:36 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 338 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | package go v.va.med.c cht.model. report.sch eduled; | |
| 2 | ||
| 3 | import sta tic gov.va .med.ccht. model.repo rt.schedul ed.FixedDa teType.FIF TEENTH; | |
| 4 | import sta tic gov.va .med.ccht. model.repo rt.schedul ed.FixedDa teType.FIR ST; | |
| 5 | import sta tic gov.va .med.ccht. model.repo rt.schedul ed.FixedDa teType.LAS T; | |
| 6 | import sta tic java.u til.Calend ar.APRIL; | |
| 7 | import sta tic java.u til.Calend ar.DAY_OF_ MONTH; | |
| 8 | import sta tic java.u til.Calend ar.DAY_OF_ WEEK; | |
| 9 | import sta tic java.u til.Calend ar.DAY_OF_ YEAR; | |
| 10 | import sta tic java.u til.Calend ar.DECEMBE R; | |
| 11 | import sta tic java.u til.Calend ar.JANUARY ; | |
| 12 | import sta tic java.u til.Calend ar.JULY; | |
| 13 | import sta tic java.u til.Calend ar.JUNE; | |
| 14 | import sta tic java.u til.Calend ar.MARCH; | |
| 15 | import sta tic java.u til.Calend ar.OCTOBER ; | |
| 16 | import sta tic java.u til.Calend ar.SEPTEMB ER; | |
| 17 | ||
| 18 | import jav a.util.Cal endar; | |
| 19 | import jav a.util.Dat e; | |
| 20 | import jav a.util.Loc ale; | |
| 21 | ||
| 22 | import gov .va.med.fw .model.loo kup.Lookup ; | |
| 23 | import gov .va.med.fw .util.Date Utils; | |
| 24 | ||
| 25 | /** | |
| 26 | * These t ypes repre sent units of time t hat contai n days. Gi ven a spec ific day, | |
| 27 | * we can deduce the start and end of th e unit con taining th at day (an d the | |
| 28 | * previou s or next unit as we ll). | |
| 29 | * | |
| 30 | * @author DNS | |
| 31 | * | |
| 32 | */ | |
| 33 | public enu m MultiDay TimeUnitTy pe impleme nts Lookup { | |
| 34 | WE EK("Week", new DateC alculator( ) { | |
| 35 | publ ic Date ca lculateDat e(Date sta rtDate, Fi xedDateTyp e fixedDat eType, boo lean previ ous) { | |
| 36 | if (fi xedDateTyp e == Fixed DateType.F IFTEENTH) | |
| 37 | throw ne w IllegalA rgumentExc eption("Ca n't calcul ate the fi fteenth of a week!") ; | |
| 38 | ||
| 39 | Date a djustedSta rtDate = s tartDate; | |
| 40 | if (pr evious) | |
| 41 | adjusted StartDate = DateUtil s.add(star tDate, Cal endar.WEEK _OF_YEAR, -1); | |
| 42 | ||
| 43 | return calculate DateGivenF ield(fixed DateType, adjustedSt artDate, D AY_OF_WEEK ); | |
| 44 | } | |
| 45 | }) , | |
| 46 | MO NTH("Month ", new Dat eCalculato r() { | |
| 47 | publ ic Date ca lculateDat e(Date sta rtDate, Fi xedDateTyp e fixedDat eType, boo lean previ ous) { | |
| 48 | Date a djustedSta rtDate = s tartDate; | |
| 49 | if (pr evious) | |
| 50 | adjusted StartDate = DateUtil s.add(star tDate, Cal endar.MONT H, -1); | |
| 51 | ||
| 52 | return calculate DateGivenF ield(fixed DateType, adjustedSt artDate, D AY_OF_MONT H); | |
| 53 | } | |
| 54 | }) , | |
| 55 | QU ARTER("Qua rter", new DateCalcu lator() { | |
| 56 | publ ic Date ca lculateDat e(Date sta rtDate, Fi xedDateTyp e fixedDat eType, boo lean previ ous) { | |
| 57 | Calend ar c = Cal endar.getI nstance(Lo cale.US); | |
| 58 | c.setT ime(startD ate); | |
| 59 | ||
| 60 | /* Det ermine cur rent quart er */ | |
| 61 | int mo nth = c.ge t(Calendar .MONTH); | |
| 62 | ||
| 63 | int qu arter = 1; | |
| 64 | if (mo nth >= APR IL && mont h <= JUNE) { | |
| 65 | quarter = 2; | |
| 66 | } else if (month >= JULY & & month <= SEPTEMBER ) { | |
| 67 | quarter = 3; | |
| 68 | } else if (month >= OCTOBE R && month <= DECEMB ER) { | |
| 69 | quarter = 4; | |
| 70 | } | |
| 71 | ||
| 72 | /* Cal culate new quarter ( and roll y ear back i f necessar y) */ | |
| 73 | int fi nalQuarter = quarter ; | |
| 74 | if (pr evious) { | |
| 75 | finalQua rter = qua rter - 1; | |
| 76 | if (fina lQuarter = = 0) { | |
| 77 | finalQuart er = 4; | |
| 78 | c.add(Cale ndar.YEAR, -1); | |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | /* Mon th setting */ | |
| 83 | if (fi xedDateTyp e == FIRST || fixedD ateType == FixedDate Type.SECON D | |
| 84 | || fixedDa teType == FIFTEENTH) { | |
| 85 | if (fina lQuarter = = 1) { | |
| 86 | c.set(Cale ndar.MONTH , JANUARY) ; | |
| 87 | } else i f (finalQu arter == 2 ) { | |
| 88 | c.set(Cale ndar.MONTH , APRIL); | |
| 89 | } else i f (finalQu arter == 3 ) { | |
| 90 | c.set(Cale ndar.MONTH , JULY); | |
| 91 | } else { | |
| 92 | c.set(Cale ndar.MONTH , OCTOBER) ; | |
| 93 | } | |
| 94 | } else if (fixed DateType = = LAST) { | |
| 95 | if (fina lQuarter = = 1) { | |
| 96 | c.set(Cale ndar.MONTH , MARCH); | |
| 97 | } else i f (finalQu arter == 2 ) { | |
| 98 | c.set(Cale ndar.MONTH , JUNE); | |
| 99 | } else i f (finalQu arter == 3 ) { | |
| 100 | c.set(Cale ndar.MONTH , SEPTEMBE R); | |
| 101 | } else { | |
| 102 | c.set(Cale ndar.MONTH , DECEMBER ); | |
| 103 | } | |
| 104 | } | |
| 105 | ||
| 106 | /* Day setting * / | |
| 107 | fixedD ateType.se tCalendar( c, DAY_OF_ MONTH); | |
| 108 | return c.getTime (); | |
| 109 | } | |
| 110 | }) , | |
| 111 | YE AR("Year", new DateC alculator( ) { | |
| 112 | publ ic Date ca lculateDat e(Date sta rtDate, Fi xedDateTyp e fixedDat eType, boo lean previ ous) { | |
| 113 | Date a djustedSta rtDate = s tartDate; | |
| 114 | if (pr evious) | |
| 115 | adjusted StartDate = DateUtil s.add(star tDate, Cal endar.YEAR , -1); | |
| 116 | ||
| 117 | return calculate DateGivenF ield(fixed DateType, adjustedSt artDate, D AY_OF_YEAR ); | |
| 118 | } | |
| 119 | }) ; | |
| 120 | ||
| 121 | pr ivate Stri ng name; | |
| 122 | pr ivate Date Calculator dateCalcu lator; | |
| 123 | ||
| 124 | pr ivate Mult iDayTimeUn itType(Str ing name, DateCalcul ator dateC alculator) { | |
| 125 | this .name = na me; | |
| 126 | this .dateCalcu lator = da teCalculat or; | |
| 127 | } | |
| 128 | ||
| 129 | pu blic Strin g getName( ) { | |
| 130 | retu rn name; | |
| 131 | } | |
| 132 | ||
| 133 | pu blic Strin g getCode( ) { | |
| 134 | retu rn name(); | |
| 135 | } | |
| 136 | ||
| 137 | pu blic Strin g getDescr iption() { | |
| 138 | retu rn getName (); | |
| 139 | } | |
| 140 | ||
| 141 | /* * | |
| 142 | * Calculate s a date g iven a sta rting date , FixedDat eType and whether to use | |
| 143 | * the previ ous or cur rent versi on of the FixedDateT ype. | |
| 144 | * | |
| 145 | * @param st artDate | |
| 146 | * The star t date | |
| 147 | * @param fi xedDateTyp e | |
| 148 | * The Fixe dDateType to use ins ide this s pecified r ange | |
| 149 | * @param pr evious | |
| 150 | * True to use the pr evious ver sion of th e FixedDat eType; fal se | |
| 151 | * to use t he current . | |
| 152 | * @return T he newly c alculated Date | |
| 153 | * / | |
| 154 | pu blic Date calculateD ate(Date s tartDate, FixedDateT ype fixedD ateType, b oolean pre vious) { | |
| 155 | retu rn dateCal culator.ca lculateDat e(startDat e, fixedDa teType, pr evious); | |
| 156 | } | |
| 157 | ||
| 158 | pr ivate inte rface Date Calculator { | |
| 159 | Date calculate Date(Date startDate, FixedDate Type fixed DateType, boolean pr evious); | |
| 160 | } | |
| 161 | ||
| 162 | pr ivate stat ic Date ca lculateDat eGivenFiel d(FixedDat eType fixe dDateType, | |
| 163 | Date a djustedSta rtDate, in t field) t hrows Asse rtionError { | |
| 164 | Cale ndar c = C alendar.ge tInstance( Locale.US) ; | |
| 165 | c.se tTime(adju stedStartD ate); | |
| 166 | fixe dDateType. setCalenda r(c, field ); | |
| 167 | retu rn c.getTi me(); | |
| 168 | } | |
| 169 | ||
| 170 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.