ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/extra166y/ParallelArrayWithMapping.java
(Generate patch)

Comparing jsr166/src/extra166y/ParallelArrayWithMapping.java (file contents):
Revision 1.1 by dl, Tue Jan 6 14:30:58 2009 UTC vs.
Revision 1.7 by jsr166, Sun Jan 18 20:17:32 2015 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   package extra166y;
8 +
9   import jsr166y.*;
10   import static extra166y.Ops.*;
11   import java.util.*;
# Line 24 | Line 25 | public abstract class ParallelArrayWithM
25      }
26  
27      /**
28 <     * Applies the given procedure to elements
28 >     * Applies the given procedure to elements.
29       * @param procedure the procedure
30       */
31      public void apply(Procedure<? super U> procedure) {
# Line 32 | Line 33 | public abstract class ParallelArrayWithM
33      }
34  
35      /**
36 <     * Returns reduction of elements
36 >     * Returns reduction of elements.
37       * @param reducer the reducer
38       * @param base the result for an empty array
39       * @return reduction
# Line 47 | Line 48 | public abstract class ParallelArrayWithM
48      /**
49       * Returns some element matching bound and filter
50       * constraints, or null if none.
51 <     * @return an element, or null if none.
51 >     * @return an element, or null if none
52       */
53      public U any() {
54          int i = anyIndex();
55 <        return (i < 0)? null : (U)oget(i);
55 >        return (i < 0) ? null : (U)oget(i);
56      }
57  
58      /**
59 <     * Returns the minimum element, or null if empty
59 >     * Returns the minimum element, or null if empty.
60       * @param comparator the comparator
61       * @return minimum element, or null if empty
62       */
# Line 65 | Line 66 | public abstract class ParallelArrayWithM
66  
67      /**
68       * Returns the minimum element, or null if empty,
69 <     * assuming that all elements are Comparables
69 >     * assuming that all elements are Comparables.
70       * @return minimum element, or null if empty
71 <     * @throws ClassCastException if any element is not Comparable.
71 >     * @throws ClassCastException if any element is not Comparable
72       */
73      public U min() {
74          return reduce((Reducer<U>)(CommonOps.castedMinReducer()), null);
75      }
76  
77      /**
78 <     * Returns the maximum element, or null if empty
78 >     * Returns the maximum element, or null if empty.
79       * @param comparator the comparator
80       * @return maximum element, or null if empty
81       */
# Line 83 | Line 84 | public abstract class ParallelArrayWithM
84      }
85  
86      /**
87 <     * Returns the maximum element, or null if empty
88 <     * assuming that all elements are Comparables
87 >     * Returns the maximum element, or null if empty,
88 >     * assuming that all elements are Comparables.
89       * @return maximum element, or null if empty
90 <     * @throws ClassCastException if any element is not Comparable.
90 >     * @throws ClassCastException if any element is not Comparable
91       */
92      public U max() {
93          return reduce((Reducer<U>)(CommonOps.castedMaxReducer()), null);
# Line 97 | Line 98 | public abstract class ParallelArrayWithM
98       * to locate minimum and maximum elements.
99       * @param comparator the comparator to use for
100       * locating minimum and maximum elements
101 <     * @return the summary.
101 >     * @return the summary
102       */
103      public ParallelArray.SummaryStatistics<U> summary
104          (Comparator<? super U> comparator) {
# Line 109 | Line 110 | public abstract class ParallelArrayWithM
110  
111      /**
112       * Returns summary statistics, assuming that all elements are
113 <     * Comparables
114 <     * @return the summary.
113 >     * Comparables.
114 >     * @return the summary
115       */
116      public ParallelArray.SummaryStatistics<U> summary() {
117          return summary((Comparator<? super U>)(CommonOps.castedComparator()));
118      }
119  
120      /**
121 <     * Returns a new ParallelArray holding elements
121 >     * Returns a new ParallelArray holding elements.
122       * @return a new ParallelArray holding elements
123       */
124      public ParallelArray<U> all() {
# Line 126 | Line 127 | public abstract class ParallelArrayWithM
127  
128      /**
129       * Returns a new ParallelArray with the given element type
130 <     * holding elements
130 >     * holding elements.
131       * @param elementType the type of the elements
132       * @return a new ParallelArray holding elements
133       */
# Line 137 | Line 138 | public abstract class ParallelArrayWithM
138      /**
139       * Returns an operation prefix that causes a method to operate
140       * on mapped elements of the array using the given op
141 <     * applied to current op's results
141 >     * applied to current op's results.
142       * @param op the op
143       * @return operation prefix
144       */
145 <    public abstract <V> ParallelArrayWithMapping<T, V> withMapping
145 >    public abstract <V> ParallelArrayWithMapping<T,V> withMapping
146          (Op<? super U, ? extends V> op);
147  
148      /**
149       * Returns an operation prefix that causes a method to operate
150       * on mapped elements of the array using the given op
151 <     * applied to current op's results
151 >     * applied to current op's results.
152       * @param op the op
153       * @return operation prefix
154       */
# Line 157 | Line 158 | public abstract class ParallelArrayWithM
158      /**
159       * Returns an operation prefix that causes a method to operate
160       * on mapped elements of the array using the given op
161 <     * applied to current op's results
161 >     * applied to current op's results.
162       * @param op the op
163       * @return operation prefix
164       */
# Line 171 | Line 172 | public abstract class ParallelArrayWithM
172       * @param other the other array
173       * @return operation prefix
174       * @throws IllegalArgumentException if other array is a
175 <     * filtered view (all filters must precede all mappings).
175 >     * filtered view (all filters must precede all mappings)
176       */
177      public <V,W,X> ParallelArrayWithMapping<T,W> withMapping
178          (BinaryOp<? super U, ? super V, ? extends W> combiner,
# Line 188 | Line 189 | public abstract class ParallelArrayWithM
189       * @param other the other array
190       * @return operation prefix
191       * @throws IllegalArgumentException if other array is a
192 <     * filtered view (all filters must precede all mappings).
192 >     * filtered view (all filters must precede all mappings)
193       */
194      public <V> ParallelArrayWithMapping<T,V> withMapping
195          (ObjectAndDoubleToObject<? super U, ? extends V> combiner,
# Line 205 | Line 206 | public abstract class ParallelArrayWithM
206       * @param other the other array
207       * @return operation prefix
208       * @throws IllegalArgumentException if other array is a
209 <     * filtered view (all filters must precede all mappings).
209 >     * filtered view (all filters must precede all mappings)
210       */
211      public <V> ParallelArrayWithMapping<T,V> withMapping
212          (ObjectAndLongToObject<? super U, ? extends V> combiner,
# Line 222 | Line 223 | public abstract class ParallelArrayWithM
223       * @param other the other array
224       * @return operation prefix
225       * @throws IllegalArgumentException if other array is a
226 <     * filtered view (all filters must precede all mappings).
226 >     * filtered view (all filters must precede all mappings)
227       */
228      public <V,W> ParallelArrayWithDoubleMapping<T> withMapping
229          (ObjectAndObjectToDouble<? super U, ? super V> combiner,
# Line 239 | Line 240 | public abstract class ParallelArrayWithM
240       * @param other the other array
241       * @return operation prefix
242       * @throws IllegalArgumentException if other array is a
243 <     * filtered view (all filters must precede all mappings).
243 >     * filtered view (all filters must precede all mappings)
244       */
245      public ParallelArrayWithDoubleMapping<T> withMapping
246          (ObjectAndDoubleToDouble<? super U> combiner,
# Line 256 | Line 257 | public abstract class ParallelArrayWithM
257       * @param other the other array
258       * @return operation prefix
259       * @throws IllegalArgumentException if other array is a
260 <     * filtered view (all filters must precede all mappings).
260 >     * filtered view (all filters must precede all mappings)
261       */
262      public ParallelArrayWithDoubleMapping<T> withMapping
263          (ObjectAndLongToDouble<? super U> combiner,
# Line 273 | Line 274 | public abstract class ParallelArrayWithM
274       * @param other the other array
275       * @return operation prefix
276       * @throws IllegalArgumentException if other array is a
277 <     * filtered view (all filters must precede all mappings).
277 >     * filtered view (all filters must precede all mappings)
278       */
279      public <V,W> ParallelArrayWithLongMapping<T> withMapping
280          (ObjectAndObjectToLong<? super U, ? super V> combiner,
# Line 290 | Line 291 | public abstract class ParallelArrayWithM
291       * @param other the other array
292       * @return operation prefix
293       * @throws IllegalArgumentException if other array is a
294 <     * filtered view (all filters must precede all mappings).
294 >     * filtered view (all filters must precede all mappings)
295       */
296      public ParallelArrayWithLongMapping<T> withMapping
297          (ObjectAndDoubleToLong<? super U> combiner,
# Line 307 | Line 308 | public abstract class ParallelArrayWithM
308       * @param other the other array
309       * @return operation prefix
310       * @throws IllegalArgumentException if other array is a
311 <     * filtered view (all filters must precede all mappings).
311 >     * filtered view (all filters must precede all mappings)
312       */
313      public ParallelArrayWithLongMapping<T> withMapping
314          (ObjectAndLongToLong<? super U> combiner,
# Line 356 | Line 357 | public abstract class ParallelArrayWithM
357      /**
358       * Returns an Iterable view to sequentially step through mapped
359       * elements also obeying bound and filter constraints, without
360 <     * performing computations to evaluate them in parallel
360 >     * performing computations to evaluate them in parallel.
361       * @return the Iterable view
362       */
363      public Iterable<U> sequentially() {
# Line 364 | Line 365 | public abstract class ParallelArrayWithM
365      }
366  
367   }
367

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines