Skip to content

Commit 2c2c171

Browse files
committed
SpreadsheetFormatterSharedCollection was SpreadsheetFormatterCollection extends SpreadsheetFormatterShared
1 parent 3895e68 commit 2c2c171

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/main/java/walkingkooka/spreadsheet/format/SpreadsheetFormatterCollection.java renamed to src/main/java/walkingkooka/spreadsheet/format/SpreadsheetFormatterSharedCollection.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
/**
3232
* A {@link SpreadsheetFormatter} that forms a collection trying each {@link SpreadsheetFormatter formatter} until success.
3333
*/
34-
final class SpreadsheetFormatterCollection implements SpreadsheetFormatter {
34+
final class SpreadsheetFormatterSharedCollection extends SpreadsheetFormatterShared {
3535

3636
/**
37-
* Creates a new {@link SpreadsheetFormatterCollection} as necessary.
37+
* Creates a new {@link SpreadsheetFormatterSharedCollection} as necessary.
3838
*/
3939
static SpreadsheetFormatter with(final List<SpreadsheetFormatter> formatters) {
4040
Objects.requireNonNull(formatters, "formatters");
@@ -49,7 +49,7 @@ static SpreadsheetFormatter with(final List<SpreadsheetFormatter> formatters) {
4949
result = copy.iterator().next();
5050
break;
5151
default:
52-
result = new SpreadsheetFormatterCollection(copy);
52+
result = new SpreadsheetFormatterSharedCollection(copy);
5353
break;
5454
}
5555

@@ -59,7 +59,7 @@ static SpreadsheetFormatter with(final List<SpreadsheetFormatter> formatters) {
5959
/**
6060
* Private ctor.
6161
*/
62-
private SpreadsheetFormatterCollection(final List<SpreadsheetFormatter> formatters) {
62+
private SpreadsheetFormatterSharedCollection(final List<SpreadsheetFormatter> formatters) {
6363
super();
6464
this.formatters = formatters;
6565
}
@@ -104,11 +104,11 @@ public int hashCode() {
104104
@Override
105105
public boolean equals(final Object other) {
106106
return this == other ||
107-
other instanceof SpreadsheetFormatterCollection &&
107+
other instanceof SpreadsheetFormatterSharedCollection &&
108108
this.equals0(Cast.to(other));
109109
}
110110

111-
private boolean equals0(final SpreadsheetFormatterCollection other) {
111+
private boolean equals0(final SpreadsheetFormatterSharedCollection other) {
112112
return this.formatters.equals(other.formatters);
113113
}
114114

src/main/java/walkingkooka/spreadsheet/format/SpreadsheetFormatters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ public static SpreadsheetFormatter badgeError(final SpreadsheetFormatter formatt
7373
}
7474

7575
/**
76-
* {@see SpreadsheetFormatterCollection}
76+
* {@see SpreadsheetFormatterSharedCollection}
7777
*/
7878
public static SpreadsheetFormatter collection(final List<SpreadsheetFormatter> formatters) {
79-
return SpreadsheetFormatterCollection.with(formatters);
79+
return SpreadsheetFormatterSharedCollection.with(formatters);
8080
}
8181

8282
/**

src/test/java/walkingkooka/spreadsheet/format/SpreadsheetFormatterCollectionTest.java renamed to src/test/java/walkingkooka/spreadsheet/format/SpreadsheetFormatterSharedCollectionTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import static org.junit.jupiter.api.Assertions.assertSame;
3030
import static org.junit.jupiter.api.Assertions.assertThrows;
3131

32-
public final class SpreadsheetFormatterCollectionTest implements SpreadsheetFormatterTesting2<SpreadsheetFormatterCollection>,
33-
HashCodeEqualsDefinedTesting2<SpreadsheetFormatterCollection> {
32+
public final class SpreadsheetFormatterSharedCollectionTest extends SpreadsheetFormatterSharedTestCase<SpreadsheetFormatterSharedCollection>
33+
implements HashCodeEqualsDefinedTesting2<SpreadsheetFormatterSharedCollection> {
3434

3535
private final static Integer VALUE1 = 11;
3636
private final static Double VALUE2 = 222.5;
@@ -43,22 +43,22 @@ public final class SpreadsheetFormatterCollectionTest implements SpreadsheetForm
4343
public void testWithNullFails() {
4444
assertThrows(
4545
NullPointerException.class,
46-
() -> SpreadsheetFormatterCollection.with(null)
46+
() -> SpreadsheetFormatterSharedCollection.with(null)
4747
);
4848
}
4949

5050
@Test
5151
public void testWithEmptyFails() {
5252
assertThrows(
5353
IllegalArgumentException.class,
54-
() -> SpreadsheetFormatterCollection.with(Lists.empty())
54+
() -> SpreadsheetFormatterSharedCollection.with(Lists.empty())
5555
);
5656
}
5757

5858
@Test
5959
public void testWithOneUnwraps() {
6060
final SpreadsheetFormatter formatter = SpreadsheetFormatters.fake();
61-
assertSame(formatter, SpreadsheetFormatterCollection.with(Lists.of(formatter)));
61+
assertSame(formatter, SpreadsheetFormatterSharedCollection.with(Lists.of(formatter)));
6262
}
6363

6464
// format...........................................................................................................
@@ -82,9 +82,9 @@ public void testFormatNull() {
8282
}
8383

8484
@Override
85-
public SpreadsheetFormatterCollection createFormatter() {
85+
public SpreadsheetFormatterSharedCollection createFormatter() {
8686
return Cast.to(
87-
SpreadsheetFormatterCollection.with(
87+
SpreadsheetFormatterSharedCollection.with(
8888
Lists.of(
8989
this.formatter1(),
9090
this.formatter2()
@@ -149,13 +149,13 @@ public void testTokens() {
149149
@Test
150150
public void testEqualsDifferentFormatters() {
151151
this.checkNotEquals(
152-
SpreadsheetFormatterCollection.with(
152+
SpreadsheetFormatterSharedCollection.with(
153153
Lists.of(
154154
this.formatter1(),
155155
this.formatter2()
156156
)
157157
),
158-
SpreadsheetFormatterCollection.with(
158+
SpreadsheetFormatterSharedCollection.with(
159159
Lists.of(
160160
this.formatter1()
161161
)
@@ -164,9 +164,9 @@ public void testEqualsDifferentFormatters() {
164164
}
165165

166166
@Override
167-
public SpreadsheetFormatterCollection createObject() {
168-
return (SpreadsheetFormatterCollection)
169-
SpreadsheetFormatterCollection.with(
167+
public SpreadsheetFormatterSharedCollection createObject() {
168+
return (SpreadsheetFormatterSharedCollection)
169+
SpreadsheetFormatterSharedCollection.with(
170170
Lists.of(
171171
SpreadsheetFormatters.defaultText(),
172172
SpreadsheetFormatters.defaultText()
@@ -187,8 +187,8 @@ public void testToString() {
187187
// class............................................................................................................
188188

189189
@Override
190-
public Class<SpreadsheetFormatterCollection> type() {
191-
return SpreadsheetFormatterCollection.class;
190+
public Class<SpreadsheetFormatterSharedCollection> type() {
191+
return SpreadsheetFormatterSharedCollection.class;
192192
}
193193

194194
@Override

0 commit comments

Comments
 (0)