@@ -51,22 +51,45 @@ source product.
51
51
namespace iText . PdfCleanup . Autosweep {
52
52
/// <summary>
53
53
/// This class is a composite pattern for
54
- /// <c>ICleanupStrategy</c>
55
- /// It allows users to have multiple ICleanupStrategy implementations and bundle them as one.
54
+ /// <see cref="ICleanupStrategy"/>.
56
55
/// </summary>
56
+ /// <remarks>
57
+ /// This class is a composite pattern for
58
+ /// <see cref="ICleanupStrategy"/>.
59
+ /// It allows users to have multiple ICleanupStrategy implementations and bundle them as one.
60
+ /// </remarks>
57
61
public class CompositeCleanupStrategy : ICleanupStrategy {
58
62
private IDictionary < int , ICollection < IPdfTextLocation > > locations = new Dictionary < int , ICollection < IPdfTextLocation
59
63
> > ( ) ;
60
64
61
65
private IList < ICleanupStrategy > strategies = new List < ICleanupStrategy > ( ) ;
62
66
67
+ /// <summary>
68
+ /// Creates a
69
+ /// <see cref="CompositeCleanupStrategy">composite pattern</see>
70
+ /// for
71
+ /// <see cref="ICleanupStrategy">cleanup strategies</see>.
72
+ /// </summary>
63
73
public CompositeCleanupStrategy ( ) {
64
74
}
65
75
66
- public virtual void Add ( ICleanupStrategy ies ) {
67
- strategies . Add ( ies ) ;
76
+ /// <summary>
77
+ /// Adds a
78
+ /// <see cref="ICleanupStrategy">cleanup strategy</see>
79
+ /// to this
80
+ /// <see cref="CompositeCleanupStrategy">composite pattern</see>.
81
+ /// </summary>
82
+ /// <param name="strategy">
83
+ /// a
84
+ /// <see cref="ICleanupStrategy">cleanup strategy</see>
85
+ /// to be added to this
86
+ /// <see cref="CompositeCleanupStrategy">composite pattern</see>.
87
+ /// </param>
88
+ public virtual void Add ( ICleanupStrategy strategy ) {
89
+ strategies . Add ( strategy ) ;
68
90
}
69
91
92
+ /// <summary><inheritDoc/></summary>
70
93
public virtual ICollection < IPdfTextLocation > GetResultantLocations ( ) {
71
94
locations . Clear ( ) ;
72
95
// build return value
@@ -78,13 +101,12 @@ public virtual ICollection<IPdfTextLocation> GetResultantLocations() {
78
101
locations . Put ( i , new HashSet < IPdfTextLocation > ( rects ) ) ;
79
102
}
80
103
IList < IPdfTextLocation > rectangles = new List < IPdfTextLocation > ( retval ) ;
81
- JavaCollectionsUtil . Sort ( rectangles , new _IComparer_94 ( ) ) ;
82
- // return
104
+ JavaCollectionsUtil . Sort ( rectangles , new _IComparer_106 ( ) ) ;
83
105
return rectangles ;
84
106
}
85
107
86
- private sealed class _IComparer_94 : IComparer < IPdfTextLocation > {
87
- public _IComparer_94 ( ) {
108
+ private sealed class _IComparer_106 : IComparer < IPdfTextLocation > {
109
+ public _IComparer_106 ( ) {
88
110
}
89
111
90
112
public int Compare ( IPdfTextLocation l1 , IPdfTextLocation l2 ) {
@@ -99,6 +121,7 @@ public int Compare(IPdfTextLocation l1, IPdfTextLocation l2) {
99
121
}
100
122
}
101
123
124
+ /// <summary><inheritDoc/></summary>
102
125
public virtual Color GetRedactionColor ( IPdfTextLocation location ) {
103
126
for ( int i = 0 ; i < strategies . Count ; i ++ ) {
104
127
if ( locations . Get ( i ) . Contains ( location ) ) {
@@ -108,12 +131,14 @@ public virtual Color GetRedactionColor(IPdfTextLocation location) {
108
131
return ColorConstants . BLACK ;
109
132
}
110
133
134
+ /// <summary><inheritDoc/></summary>
111
135
public virtual void EventOccurred ( IEventData data , EventType type ) {
112
136
foreach ( ILocationExtractionStrategy s in strategies ) {
113
137
s . EventOccurred ( data , type ) ;
114
138
}
115
139
}
116
140
141
+ /// <summary><inheritDoc/></summary>
117
142
public virtual ICollection < EventType > GetSupportedEvents ( ) {
118
143
ICollection < EventType > evts = new HashSet < EventType > ( ) ;
119
144
foreach ( ILocationExtractionStrategy s in strategies ) {
@@ -125,13 +150,35 @@ public virtual ICollection<EventType> GetSupportedEvents() {
125
150
return evts . IsEmpty ( ) ? null : evts ;
126
151
}
127
152
153
+ /// <summary>
154
+ /// Returns a
155
+ /// <see cref="ICleanupStrategy">cleanup strategy</see>
156
+ /// which represents
157
+ /// a reset
158
+ /// <see cref="CompositeCleanupStrategy">composite cleanup strategy</see>.
159
+ /// </summary>
160
+ /// <remarks>
161
+ /// Returns a
162
+ /// <see cref="ICleanupStrategy">cleanup strategy</see>
163
+ /// which represents
164
+ /// a reset
165
+ /// <see cref="CompositeCleanupStrategy">composite cleanup strategy</see>.
166
+ /// <para />
167
+ /// Note that all the inner
168
+ /// <see cref="ICleanupStrategy">strategies</see>
169
+ /// will be reset as well.
170
+ /// </remarks>
171
+ /// <returns>
172
+ /// a reset
173
+ /// <see cref="CompositeCleanupStrategy">composite strategy</see>
174
+ /// </returns>
128
175
public virtual ICleanupStrategy Reset ( ) {
129
- iText . PdfCleanup . Autosweep . CompositeCleanupStrategy retval = new iText . PdfCleanup . Autosweep . CompositeCleanupStrategy
176
+ iText . PdfCleanup . Autosweep . CompositeCleanupStrategy resetCompositeStrategy = new iText . PdfCleanup . Autosweep . CompositeCleanupStrategy
130
177
( ) ;
131
178
foreach ( ICleanupStrategy s in strategies ) {
132
- retval . Add ( s . Reset ( ) ) ;
179
+ resetCompositeStrategy . Add ( s . Reset ( ) ) ;
133
180
}
134
- return retval ;
181
+ return resetCompositeStrategy ;
135
182
}
136
183
}
137
184
}
0 commit comments