Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitceca83c

Browse files
committed
Grammatical fixes
1 parentc0d3689 commitceca83c

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

‎adapter/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ couldn't otherwise because of incompatible interfaces.
1818

1919
##Explanation
2020

21-
Realworld example
21+
Real-world example
2222

23-
>Consider that you have some picturesin your memory card and you need to transfer them to your computer.In order totransfer them you need some kind of adapter that is compatible with your computer ports so that you can attach memory card to your computer. In this case card reader is an adapter.
24-
>Another example would be the famous power adapter; a threelegged plug can't be connected to a twopronged outlet, it needs to use a power adapter that makes it compatible with the twoprongedoutlet.
23+
>Consider that you have some pictureson your memory card and you need to transfer them to your computer.Totransfer them, you need some kind of adapter that is compatible with your computer ports so that you can attach a memory card to your computer. In this case card reader is an adapter.
24+
>Another example would be the famous power adapter; a three-legged plug can't be connected to a two-pronged outlet, it needs to use a power adapter that makes it compatible with the two-prongedoutlets.
2525
>Yet another example would be a translator translating words spoken by one person to another
2626
2727
In plain words
@@ -36,7 +36,7 @@ Wikipedia says
3636

3737
Consider a captain that can only use rowing boats and cannot sail at all.
3838

39-
First we have interfaces`RowingBoat` and`FishingBoat`
39+
First, we have interfaces`RowingBoat` and`FishingBoat`
4040

4141
```java
4242
publicinterfaceRowingBoat {
@@ -68,7 +68,7 @@ public class Captain {
6868
}
6969
```
7070

71-
Now let's say the pirates are coming and our captain needs to escape but there is only fishing boat available. We need to create an adapter that allows the captain to operate the fishing boat with his rowing boat skills.
71+
Now let's say the pirates are coming and our captain needs to escape but there is onlyafishing boat available. We need to create an adapter that allows the captain to operate the fishing boat with his rowing boat skills.
7272

7373
```java
7474
@Slf4j
@@ -100,25 +100,25 @@ captain.row();
100100
##Applicability
101101
Use the Adapter pattern when
102102

103-
*you want to use an existing class, and its interface does not match the one you need
104-
*you want to create a reusable class that cooperates with unrelated or unforeseen classes, that is, classes that don't necessarily have compatible interfaces
105-
*you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.
106-
*most of the applications using thirdparty libraries use adapters as a middle layer between the application and the 3rd party library to decouple the application from the library. If another library has to be used only an adapter for the new library is required without having to change the application code.
103+
*You want to use an existing class, and its interface does not match the one you need
104+
*You want to create a reusable class that cooperates with unrelated or unforeseen classes, that is, classes that don't necessarily have compatible interfaces
105+
*You need to use several existing subclasses, but it's impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.
106+
*Most of the applications using third-party libraries use adapters as a middle layer between the application and the 3rd party library to decouple the application from the library. If another library has to be used only an adapter for the new library is required without having to change the application code.
107107

108108
##Consequences:
109109
Class and object adapters have different trade-offs. A class adapter
110110

111-
*adapts Adaptee to Target by committing to a concrete Adaptee class. As a consequence, a class adapter won’t work when we want to adapt a class and all its subclasses.
112-
*let’s Adapter override some of Adaptee’s behavior, since Adapter is a subclass of Adaptee.
113-
*introduces only one object, and no additional pointer indirection is needed to get to the adaptee.
111+
*Adapts Adaptee to Target by committing to a concrete Adaptee class. As a consequence, a class adapter won’t work when we want to adapt a class and all its subclasses.
112+
*Let’s Adapter override some of Adaptee’s behavior since Adapter is a subclass of Adaptee.
113+
*Introduces only one object, and no additional pointer indirection is needed to get to the adaptee.
114114

115115
An object adapter
116116

117-
*let’s a single Adapter work with many Adaptees—that is, the Adaptee itself and all of its subclasses (if any). The Adapter can also add functionality to all Adaptees at once.
118-
*makes it harder to override Adaptee behavior. It will require subclassing Adaptee and making Adapter refer to the subclass rather than the Adaptee itself.
117+
*Lets a single Adapter work with many Adaptees—that is, the Adaptee itself and all of its subclasses (if any). The Adapter can also add functionality to all Adaptees at once.
118+
*Makes it harder to override Adaptee behavior. It will require subclassing Adaptee and making the Adapter refer to the subclass rather than the Adaptee itself.
119119

120120

121-
##Realworld examples
121+
##Real-world examples
122122

123123
*[java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)
124124
*[java.util.Collections#list()](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#list-java.util.Enumeration-)

‎adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
importstaticorg.mockito.Mockito.verify;
3434

3535
/**
36-
*Test class
36+
*Tests for the adapter pattern.
3737
*/
3838
classAdapterPatternTest {
3939

‎adapter/src/test/java/com/iluwatar/adapter/AppTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
classAppTest {
3434

3535
/**
36-
* Issue: Add at least one assertion to this test case.
37-
*
38-
* Solution: Inserted assertion to check whether the execution of the main method in {@link App}
36+
* Check whether the execution of the main method in {@link App}
3937
* throws an exception.
4038
*/
4139

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp