Skip to content

Commit ef39882

Browse files
Updating the reports on enumerations: A new enumeration (a subset of values) is a restriction and equally the removal of an enumeration is an extension. Aside of these edge cases, a larger enumeration is always an extension and a smaller a restriction of the grammar.
1 parent 8f49896 commit ef39882

10 files changed

+21
-266
lines changed

src/main/java/com/compare/xsd/comparison/MultiLineChangeTextReport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@ private void createChangeMessage(Change c){
213213
c.setReportHeader(c.getReportHeader() + "\n\t\tChanged enumeration from " + c.oldNode.getEnumeration() + " to " + c.newNode.getEnumeration());
214214
ArrayList<String> newEnumerationList = new ArrayList<>(c.newNode.getEnumeration());
215215
boolean isFixedDefaultByEnumeration = newEnumerationList.size() == 1;
216-
newEnumerationList.removeAll(c.oldNode.getEnumeration());
217-
if(newEnumerationList.size() > 0){
216+
if(c.oldNode.getEnumeration() != null) {
217+
newEnumerationList.removeAll(c.oldNode.getEnumeration());
218+
}
219+
if(c.oldNode.getEnumeration() == null || newEnumerationList.size() > 0){
218220
c.setReportHeader(c.getReportHeader() + "\n\t\t\tadded: " + newEnumerationList.toString());
219221
if(isFixedDefaultByEnumeration) {// if single enumeration (new)
220222
if (c.oldNode.getFixedValue() != null && c.oldNode.getFixedValue().equals(newEnumerationList.get(0))) {

src/main/java/com/compare/xsd/comparison/OnlyNewExtensionsReport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private void createChangeMessage(Change c){
155155
boolean isFixedDefaultByEnumeration = newEnumerationList.size() == 1;
156156
newEnumerationList.removeAll(c.oldNode.getEnumeration());
157157
// an enumeration is a restriction of the set of strings
158-
// so there have to be some enumeration earlier and if the new enumeration list is longer (it is an extension)
158+
// so to be an extension there have to be some enumeration earlier and if the new enumeration list is longer (it is an extension)
159159
if((c.oldNode.getEnumeration() != null && c.oldNode.getEnumeration().size() > 0) && newEnumerationList.size() > 0){
160160
getModificationStringBuilder().append("\n\t\tExtended enumeration from " + c.oldNode.getEnumeration() + " to " + c.newNode.getEnumeration() +
161161
"\n\t\t\tadded: " + newEnumerationList.toString());

src/main/java/com/compare/xsd/comparison/OnlyNewRestrictionsReport.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,19 @@ private void createChangeMessage(Change c){
147147
getModificationStringBuilder().append("\n\t\tChanged fractionDigits from " + c.oldNode.getFractionDigits() + " to " + c.newNode.getFractionDigits());
148148
}
149149
if (c.isEnumerationChanged()) {
150-
ArrayList<String> oldEnumerationList = new ArrayList<>(c.oldNode.getEnumeration());
151-
boolean wasFixedDefaultByEnumeration = oldEnumerationList.size() == 1;
152-
oldEnumerationList.removeAll(c.newNode.getEnumeration());
150+
151+
152+
ArrayList<String> oldEnumerationList = null;
153+
boolean wasFixedDefaultByEnumeration = false;
154+
if(c.oldNode.getEnumeration() != null) {
155+
oldEnumerationList = new ArrayList<>(c.oldNode.getEnumeration());
156+
wasFixedDefaultByEnumeration = oldEnumerationList.size() == 1;
157+
oldEnumerationList.removeAll(c.newNode.getEnumeration());
158+
}
153159
// an enumeration is a restriction of the set of strings
154-
// either enumeration old list was longer or did not exist at all
155-
if(oldEnumerationList.size() > 0 || (c.oldNode.getEnumeration() == null || c.oldNode.getEnumeration().size() == 0)){
156-
if(oldEnumerationList.size() > 0){
160+
// either enumeration old list was longer (and now shorter being restricted) or did not exist at all (and the new existence is a restriction by the set of values)
161+
if(c.oldNode.getEnumeration() == null || oldEnumerationList.size() > 0 && (c.newNode.getEnumeration() != null && c.newNode.getEnumeration().size() > 0) || c.oldNode.getEnumeration().size() == 0){
162+
if(c.oldNode.getEnumeration() != null && oldEnumerationList.size() > 0){
157163
getModificationStringBuilder().append("\n\t\tNarrowed enumeration from " + c.oldNode.getEnumeration() + " to " + c.newNode.getEnumeration() +
158164
"\n\t\t\tremoved: " + oldEnumerationList.toString());
159165
}else{

src/main/java/com/compare/xsd/comparison/SingleLineChangeTextReport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ private void createChangeMessage(Change c){
114114
c.setReportHeader(c.getReportHeader() + "changed enumeration from " + c.oldNode.getEnumeration() + " to " + c.newNode.getEnumeration());
115115
ArrayList<String> newEnumerationList = new ArrayList<>(c.newNode.getEnumeration());
116116
boolean isFixedDefaultByEnumeration = newEnumerationList.size() == 1;
117-
newEnumerationList.removeAll(c.oldNode.getEnumeration());
118-
if(newEnumerationList.size() > 0){
117+
if(c.oldNode.getEnumeration() != null) {
118+
newEnumerationList.removeAll(c.oldNode.getEnumeration());
119+
}
120+
if(c.oldNode.getEnumeration() == null || newEnumerationList.size() > 0){
119121
if(isFixedDefaultByEnumeration) {// if single enumeration (new)
120122
if (c.oldNode.getFixedValue() != null && c.oldNode.getFixedValue().equals(newEnumerationList.get(0))) {
121123
c.setReportHeader(c.getReportHeader() + (" (no semantic change, as new single enumeration value existed as previous fixed default: " + c.newNode.getFixedValue() + ")"));
Original file line numberDiff line numberDiff line change
@@ -1,45 +0,0 @@
1-
In type {ExchangedDocumentType} modifying element:
2-
old: <TypeCode>{DocumentCodeType}{1..1} in type {ExchangedDocumentType}
3-
new: <TypeCode>{DocumentCodeType}{0..1} in type {ExchangedDocumentType}
4-
Narrowed enumeration from [80, 81, 82, 83, 84, 130, 202, 203, 204, 211, 261, 262, 295, 296, 308, 325, 326, 380, 381, 383, 384, 385, 386, 387, 388, 389, 390, 393, 394, 395, 396, 420, 456, 457, 458, 527, 575, 623, 633, 751, 780, 875, 876, 877, 935] to []
5-
removed: [80, 81, 82, 83, 84, 130, 202, 203, 204, 211, 261, 262, 295, 296, 308, 325, 326, 380, 381, 383, 384, 385, 386, 387, 388, 389, 390, 393, 394, 395, 396, 420, 456, 457, 458, 527, 575, 623, 633, 751, 780, 875, 876, 877, 935]
6-
In type {HeaderTradeSettlementType} modifying element:
7-
old: <InvoiceCurrencyCode>{CurrencyCodeType}{1..1} in type {HeaderTradeSettlementType}
8-
new: <InvoiceCurrencyCode>{CurrencyCodeType}{0..1} in type {HeaderTradeSettlementType}
9-
Narrowed enumeration from [AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL] to []
10-
removed: [AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL]
11-
In type {HeaderTradeSettlementType} modifying element:
12-
old: <TaxCurrencyCode>{CurrencyCodeType}{0..1} in type {HeaderTradeSettlementType}
13-
new: <TaxCurrencyCode>{CurrencyCodeType}{0..1} in type {HeaderTradeSettlementType}
14-
Narrowed enumeration from [AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL] to []
15-
removed: [AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL]
16-
In type {TradeAddressType} modifying element:
17-
old: <CountryID>{CountryIDType}{1..1} in type {TradeAddressType}
18-
new: <CountryID>{CountryIDType}{0..1} in type {TradeAddressType}
19-
Narrowed enumeration from [1A, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, XI, YE, YT, ZA, ZM, ZW] to []
20-
removed: [1A, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, XI, YE, YT, ZA, ZM, ZW]
21-
In type {TradeAllowanceChargeType} modifying element:
22-
old: <ReasonCode>{AllowanceChargeReasonCodeType}{0..1} in type {TradeAllowanceChargeType}
23-
new: <ReasonCode>{AllowanceChargeReasonCodeType}{0..1} in type {TradeAllowanceChargeType}
24-
Narrowed enumeration from [AA, AAA, AAC, AAD, AAE, AAF, AAH, AAI, AAS, AAT, AAV, AAY, AAZ, ABA, ABB, ABC, ABD, ABF, ABK, ABL, ABN, ABR, ABS, ABT, ABU, ACF, ACG, ACH, ACI, ACJ, ACK, ACL, ACM, ACS, ADC, ADE, ADJ, ADK, ADL, ADM, ADN, ADO, ADP, ADQ, ADR, ADT, ADW, ADY, ADZ, AEA, AEB, AEC, AED, AEF, AEH, AEI, AEJ, AEK, AEL, AEM, AEN, AEO, AEP, AES, AET, AEU, AEV, AEW, AEX, AEY, AEZ, AJ, AU, CA, CAB, CAD, CAE, CAF, CAI, CAJ, CAK, CAL, CAM, CAN, CAO, CAP, CAQ, CAR, CAS, CAT, CAU, CAV, CAW, CAX, CAY, CAZ, CD, CG, CS, CT, DAB, DAC, DAD, DAF, DAG, DAH, DAI, DAJ, DAK, DAL, DAM, DAN, DAO, DAP, DAQ, DL, EG, EP, ER, FAA, FAB, FAC, FC, FH, FI, GAA, HAA, HD, HH, IAA, IAB, ID, IF, IR, IS, KO, L1, LA, LAA, LAB, LF, MAE, MI, ML, NAA, OA, PA, PAA, PC, PL, RAB, RAC, RAD, RAF, RE, RF, RH, RV, SA, SAA, SAD, SAE, SAI, SG, SH, SM, SU, TAB, TAC, TT, TV, V1, V2, WH, XAA, YY, ZZZ, 41, 42, 60, 62, 63, 64, 65, 66, 67, 68, 70, 71, 88, 95, 100, 102, 103, 104, 105] to []
25-
removed: [AA, AAA, AAC, AAD, AAE, AAF, AAH, AAI, AAS, AAT, AAV, AAY, AAZ, ABA, ABB, ABC, ABD, ABF, ABK, ABL, ABN, ABR, ABS, ABT, ABU, ACF, ACG, ACH, ACI, ACJ, ACK, ACL, ACM, ACS, ADC, ADE, ADJ, ADK, ADL, ADM, ADN, ADO, ADP, ADQ, ADR, ADT, ADW, ADY, ADZ, AEA, AEB, AEC, AED, AEF, AEH, AEI, AEJ, AEK, AEL, AEM, AEN, AEO, AEP, AES, AET, AEU, AEV, AEW, AEX, AEY, AEZ, AJ, AU, CA, CAB, CAD, CAE, CAF, CAI, CAJ, CAK, CAL, CAM, CAN, CAO, CAP, CAQ, CAR, CAS, CAT, CAU, CAV, CAW, CAX, CAY, CAZ, CD, CG, CS, CT, DAB, DAC, DAD, DAF, DAG, DAH, DAI, DAJ, DAK, DAL, DAM, DAN, DAO, DAP, DAQ, DL, EG, EP, ER, FAA, FAB, FAC, FC, FH, FI, GAA, HAA, HD, HH, IAA, IAB, ID, IF, IR, IS, KO, L1, LA, LAA, LAB, LF, MAE, MI, ML, NAA, OA, PA, PAA, PC, PL, RAB, RAC, RAD, RAF, RE, RF, RH, RV, SA, SAA, SAD, SAE, SAI, SG, SH, SM, SU, TAB, TAC, TT, TV, V1, V2, WH, XAA, YY, ZZZ, 41, 42, 60, 62, 63, 64, 65, 66, 67, 68, 70, 71, 88, 95, 100, 102, 103, 104, 105]
26-
In type {TradeSettlementPaymentMeansType} modifying element:
27-
old: <TypeCode>{PaymentMeansCodeType}{1..1} in type {TradeSettlementPaymentMeansType}
28-
new: <TypeCode>{PaymentMeansCodeType}{0..1} in type {TradeSettlementPaymentMeansType}
29-
Narrowed enumeration from [10, 20, 30, 42, 48, 49, 57, 58, 59, 97, ZZZ] to []
30-
removed: [10, 20, 30, 42, 48, 49, 57, 58, 59, 97, ZZZ]
31-
In type {TradeTaxType} modifying element:
32-
old: <CategoryCode>{TaxCategoryCodeType}{1..1} in type {TradeTaxType}
33-
new: <CategoryCode>{TaxCategoryCodeType}{0..1} in type {TradeTaxType}
34-
Narrowed enumeration from [AE, E, G, K, L, M, O, S, Z] to []
35-
removed: [AE, E, G, K, L, M, O, S, Z]
36-
In type {TradeTaxType} modifying element:
37-
old: <DueDateTypeCode>{TimeReferenceCodeType}{0..1} in type {TradeTaxType}
38-
new: <DueDateTypeCode>{TimeReferenceCodeType}{0..1} in type {TradeTaxType}
39-
Narrowed enumeration from [5, 29, 72] to []
40-
removed: [5, 29, 72]
41-
In type {TradeTaxType} modifying element:
42-
old: <TypeCode>{TaxTypeCodeType}{1..1} in type {TradeTaxType}
43-
new: <TypeCode>{TaxTypeCodeType}{0..1} in type {TradeTaxType}
44-
Narrowed enumeration from [VAT] to []
45-
removed: [VAT]

0 commit comments

Comments
 (0)