Skip to content

Commit d327918

Browse files
committed
Grammar fixes for visitor
1 parent 5b0f4a9 commit d327918

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

visitor/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ define a new operation without changing the classes of the elements on which it
1616

1717
## Explanation
1818

19-
Real world example
19+
Real-world example
2020

2121
> Consider a tree structure with army units. Commander has two sergeants under it and each sergeant
2222
> has three soldiers under them. Given that the hierarchy implements the visitor pattern, we can
23-
> easily create new objects that interact with the commander, sergeants, soldiers or all of them.
23+
> easily create new objects that interact with the commander, sergeants, soldiers, or all of them.
2424
2525
In plain words
2626

@@ -214,7 +214,7 @@ Use the Visitor pattern when
214214
* Many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them.
215215
* The classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes.
216216

217-
## Real world examples
217+
## Known uses
218218

219219
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
220220
* [javax.lang.model.element.AnnotationValue](http://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/AnnotationValue.html) and [AnnotationValueVisitor](http://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/AnnotationValueVisitor.html)

visitor/src/main/java/com/iluwatar/visitor/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
package com.iluwatar.visitor;
2525

2626
/**
27-
* <p>Visitor pattern defines mechanism to apply operations on nodes in hierarchy. New operations
28-
* can be added without altering the node interface.</p>
27+
* <p>Visitor pattern defines a mechanism to apply operations on nodes in a hierarchy. New
28+
* operations can be added without altering the node interface.</p>
2929
*
3030
* <p>In this example there is a unit hierarchy beginning from {@link Commander}. This hierarchy is
3131
* traversed by visitors. {@link SoldierVisitor} applies its operation on {@link Soldier}s, {@link

0 commit comments

Comments
 (0)