@@ -68,6 +68,7 @@ private static void addEmptyValue(final TableRow row,
68
68
row .getCells ().add (cell );
69
69
}
70
70
71
+ @ SuppressWarnings ("unused" )
71
72
private static void addMissingRowGroup (final RowGroup group ,
72
73
final Table table ) {
73
74
String groupGuid = null ;
@@ -110,7 +111,7 @@ private static void addMissingRowGroup(final RowGroup group,
110
111
}
111
112
}
112
113
113
- private static void createDiffContent (final int i , final TableRow row ,
114
+ private void createDiffContent (final int i , final TableRow row ,
114
115
final TableRow match ,
115
116
final BiFunction <TableCell , TableCell , CellContent > createCompareContent ) {
116
117
final TableCell oldCell = row .getCells ().get (i );
@@ -120,76 +121,22 @@ private static void createDiffContent(final int i, final TableRow row,
120
121
if (match != null ) {
121
122
newCell = match .getCells ().get (i );
122
123
}
123
- if (oldCell .getContent () instanceof MultiColorCellContent ) {
124
- createMultiColorDiffCotent (oldCell , newCell );
124
+
125
+ final CellContent oldCellContent = EObjectExtensions
126
+ .getNullableObject (oldCell , TableCell ::getContent )
127
+ .orElse (null );
128
+ final CellContent newCellContent = EObjectExtensions
129
+ .getNullableObject (newCell , TableCell ::getContent )
130
+ .orElse (null );
131
+ if (isSameValue (oldCellContent , newCellContent )) {
125
132
return ;
126
133
}
134
+
127
135
final CellContent compareCellContent = createCompareContent
128
136
.apply (oldCell , newCell );
129
- if (compareCellContent == null ) {
130
- return ;
131
- }
132
137
oldCell .setContent (compareCellContent );
133
138
}
134
139
135
- // IMPROVE: this function isn't completely.
136
- private static void createMultiColorDiffCotent (final TableCell oldCell ,
137
- final TableCell newCell ) {
138
- if (oldCell .getContent () instanceof MultiColorCellContent ) {
139
- if (newCell != null && newCell
140
- .getContent () instanceof final MultiColorCellContent newCellContent ) {
141
- final MultiColorCellContent clone = EcoreUtil
142
- .copy (newCellContent );
143
-
144
- oldCell .setContent (clone );
145
- }
146
- final MultiColorCellContent oldCellContent = (MultiColorCellContent ) oldCell
147
- .getContent ();
148
- oldCellContent .getValue ()
149
- .forEach (e -> e .setDisableMultiColor (false ));
150
- }
151
- }
152
-
153
- // if (oldCell
154
- // .getContent() instanceof final MultiColorCellContent oldCellContent
155
- // && newCell
156
- // .getContent() instanceof final MultiColorCellContent newCellContent)
157
- // {
158
- // final BiFunction<MultiColorCellContent, Function<MultiColorContent,
159
- // String>, Set<String>> getIterableStr = (
160
- // cellContent, getValueFunc) -> cellContent.getValue()
161
- // .stream()
162
- // .map(getValueFunc::apply)
163
- // .collect(Collectors.toSet());
164
- //
165
- // final Set<String> oldMultiColorValueStr = getIterableStr.apply(
166
- // oldCellContent, MultiColorContent::getMultiColorValue);
167
- // final Set<String> newMultiColorValueStr = getIterableStr.apply(
168
- // newCellContent, MultiColorContent::getMultiColorValue);
169
- // final Set<String> oldStringformatValueStr = getIterableStr
170
- // .apply(oldCellContent, MultiColorContent::getStringFormat);
171
- // final Set<String> newStringformatValueStr = getIterableStr
172
- // .apply(newCellContent, MultiColorContent::getStringFormat);
173
- // // Fall multicolor value of both is empty, but stringformat is
174
- // // difference, then replace OldContent with CompareCellContent
175
- // if (oldMultiColorValueStr.isEmpty()
176
- // && newMultiColorValueStr.isEmpty()
177
- // && !oldStringformatValueStr
178
- // .equals(newStringformatValueStr)) {
179
- // oldCell.setContent(createCompareCellContent(
180
- // oldStringformatValueStr, newStringformatValueStr,
181
- // oldCellContent.getSeparator()));
182
- // // Fall multicolor
183
- // } else if (!oldMultiColorValueStr.isEmpty()
184
- // && !newMultiColorValueStr.isEmpty()
185
- // && !oldMultiColorValueStr.equals(newMultiColorValueStr)) {
186
- // final MultiColorCellContent clone = EcoreUtil
187
- // .copy(newCellContent);
188
- // clone.getValue().forEach(e -> e.setDisableMultiColor(false));
189
- // oldCell.setContent(clone);
190
- // }
191
- // }
192
-
193
140
private static CompareCellContent createCompareCellContent (
194
141
final TableCell oldCell , final TableCell newCell ) {
195
142
final Set <String > oldValues = getIterableStringValue (oldCell );
@@ -211,17 +158,6 @@ private static CompareCellContent createCompareCellContent(
211
158
private CompareTableCellContent createTableCompareCellContent (
212
159
final TableCell mainTableCell , final TableCell compareTableCell ) {
213
160
214
- if (isSameValue (
215
- EObjectExtensions
216
- .getNullableObject (mainTableCell , TableCell ::getContent )
217
- .orElse (null ),
218
- EObjectExtensions
219
- .getNullableObject (compareTableCell ,
220
- TableCell ::getContent )
221
- .orElse (null ))) {
222
- return null ;
223
- }
224
-
225
161
final CompareTableCellContent compareTableCellContent = TablemodelFactory .eINSTANCE
226
162
.createCompareTableCellContent ();
227
163
compareTableCellContent
@@ -364,7 +300,7 @@ private static Table expandNewRowGroups(final Table oldTable,
364
300
return result ;
365
301
}
366
302
367
- private static void matchRow (final TableRow row , final Table newTable ) {
303
+ private void matchRow (final TableRow row , final Table newTable ) {
368
304
final TableRow match = TableExtensions .getMatchingRow (newTable , row );
369
305
// Create diff content
370
306
for (int i = 0 ; i < row .getCells ().size (); i ++) {
@@ -413,7 +349,7 @@ private static List<Bearbeitungsvermerk> getFootnotes(final TableRow row) {
413
349
return ((SimpleFootnoteContainer ) row .getFootnotes ()).getFootnotes ();
414
350
}
415
351
416
- private static Table matchRows (final Table expanded , final Table newTable ) {
352
+ private Table matchRows (final Table expanded , final Table newTable ) {
417
353
final Table result = EcoreUtil .copy (expanded );
418
354
final List <TableRow > rows = TableExtensions .getTableRows (result );
419
355
rows .forEach (row -> matchRow (row , newTable ));
0 commit comments