96 |
|
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
97 |
|
* Java Collections Framework</a>. |
98 |
|
* |
99 |
< |
* <p><em>jsr166e note: This class is a candidate replacement for |
100 |
< |
* java.util.concurrent.ConcurrentHashMap. During transition, this |
99 |
> |
* <p><em> During transition to JDK8, this |
100 |
|
* class declares and uses nested functional interfaces with different |
101 |
|
* names but the same forms as those expected for JDK8.<em> |
102 |
|
* |
2286 |
|
int index; // index of bin to use next |
2287 |
|
int baseIndex; // current index of initial table |
2288 |
|
int baseLimit; // index bound for initial table |
2289 |
< |
final int baseSize; // initial table size |
2289 |
> |
int baseSize; // initial table size |
2290 |
|
|
2291 |
|
/** Creates iterator for all entries in the table. */ |
2292 |
|
Traverser(ConcurrentHashMap<K, V> map) { |
2293 |
< |
this.tab = (this.map = map).table; |
2295 |
< |
baseLimit = baseSize = (tab == null) ? 0 : tab.length; |
2293 |
> |
this.map = map; |
2294 |
|
} |
2295 |
|
|
2296 |
|
/** Creates iterator for split() methods */ |
2297 |
|
Traverser(Traverser<K,V,?> it) { |
2298 |
< |
this.map = it.map; |
2299 |
< |
this.tab = it.tab; |
2298 |
> |
ConcurrentHashMap<K, V> m; Node[] t; |
2299 |
> |
if ((m = this.map = it.map) == null) |
2300 |
> |
t = null; |
2301 |
> |
else if ((t = it.tab) == null && // force parent tab initialization |
2302 |
> |
(t = it.tab = m.table) != null) |
2303 |
> |
it.baseLimit = it.baseSize = t.length; |
2304 |
> |
this.tab = t; |
2305 |
|
this.baseSize = it.baseSize; |
2306 |
|
it.baseLimit = this.index = this.baseIndex = |
2307 |
|
((this.baseLimit = it.baseLimit) + it.baseIndex + 1) >>> 1; |
2318 |
|
if (e != null) // advance past used/skipped node |
2319 |
|
e = e.next; |
2320 |
|
while (e == null) { // get to next non-null bin |
2321 |
+ |
ConcurrentHashMap<K, V> m; |
2322 |
|
Node[] t; int b, i, n; Object ek; // checks must use locals |
2323 |
< |
if ((b = baseIndex) >= baseLimit || (i = index) < 0 || |
2324 |
< |
(t = tab) == null || i >= (n = t.length)) |
2323 |
> |
if ((t = tab) != null) |
2324 |
> |
n = t.length; |
2325 |
> |
else if ((m = map) != null && (t = tab = m.table) != null) |
2326 |
> |
n = baseLimit = baseSize = t.length; |
2327 |
> |
else |
2328 |
|
break outer; |
2329 |
< |
else if ((e = tabAt(t, i)) != null && e.hash == MOVED) { |
2329 |
> |
if ((b = baseIndex) >= baseLimit || |
2330 |
> |
(i = index) < 0 || i >= n) |
2331 |
> |
break outer; |
2332 |
> |
if ((e = tabAt(t, i)) != null && e.hash == MOVED) { |
2333 |
|
if ((ek = e.key) instanceof TreeBin) |
2334 |
|
e = ((TreeBin)ek).first; |
2335 |
|
else { |
4186 |
|
(ConcurrentHashMap<K,V> map, |
4187 |
|
BiAction<K,V> action) { |
4188 |
|
if (action == null) throw new NullPointerException(); |
4189 |
< |
return new ForEachMappingTask<K,V>(map, action); |
4189 |
> |
return new ForEachMappingTask<K,V>(map, null, -1, action); |
4190 |
|
} |
4191 |
|
|
4192 |
|
/** |
4207 |
|
if (transformer == null || action == null) |
4208 |
|
throw new NullPointerException(); |
4209 |
|
return new ForEachTransformedMappingTask<K,V,U> |
4210 |
< |
(map, transformer, action); |
4210 |
> |
(map, null, -1, transformer, action); |
4211 |
|
} |
4212 |
|
|
4213 |
|
/** |
4227 |
|
BiFun<? super K, ? super V, ? extends U> searchFunction) { |
4228 |
|
if (searchFunction == null) throw new NullPointerException(); |
4229 |
|
return new SearchMappingsTask<K,V,U> |
4230 |
< |
(map, searchFunction, |
4230 |
> |
(map, null, -1, searchFunction, |
4231 |
|
new AtomicReference<U>()); |
4232 |
|
} |
4233 |
|
|
4250 |
|
if (transformer == null || reducer == null) |
4251 |
|
throw new NullPointerException(); |
4252 |
|
return new MapReduceMappingsTask<K,V,U> |
4253 |
< |
(map, transformer, reducer); |
4253 |
> |
(map, null, -1, null, transformer, reducer); |
4254 |
|
} |
4255 |
|
|
4256 |
|
/** |
4274 |
|
if (transformer == null || reducer == null) |
4275 |
|
throw new NullPointerException(); |
4276 |
|
return new MapReduceMappingsToDoubleTask<K,V> |
4277 |
< |
(map, transformer, basis, reducer); |
4277 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4278 |
|
} |
4279 |
|
|
4280 |
|
/** |
4298 |
|
if (transformer == null || reducer == null) |
4299 |
|
throw new NullPointerException(); |
4300 |
|
return new MapReduceMappingsToLongTask<K,V> |
4301 |
< |
(map, transformer, basis, reducer); |
4301 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4302 |
|
} |
4303 |
|
|
4304 |
|
/** |
4321 |
|
if (transformer == null || reducer == null) |
4322 |
|
throw new NullPointerException(); |
4323 |
|
return new MapReduceMappingsToIntTask<K,V> |
4324 |
< |
(map, transformer, basis, reducer); |
4324 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4325 |
|
} |
4326 |
|
|
4327 |
|
/** |
4336 |
|
(ConcurrentHashMap<K,V> map, |
4337 |
|
Action<K> action) { |
4338 |
|
if (action == null) throw new NullPointerException(); |
4339 |
< |
return new ForEachKeyTask<K,V>(map, action); |
4339 |
> |
return new ForEachKeyTask<K,V>(map, null, -1, action); |
4340 |
|
} |
4341 |
|
|
4342 |
|
/** |
4357 |
|
if (transformer == null || action == null) |
4358 |
|
throw new NullPointerException(); |
4359 |
|
return new ForEachTransformedKeyTask<K,V,U> |
4360 |
< |
(map, transformer, action); |
4360 |
> |
(map, null, -1, transformer, action); |
4361 |
|
} |
4362 |
|
|
4363 |
|
/** |
4377 |
|
Fun<? super K, ? extends U> searchFunction) { |
4378 |
|
if (searchFunction == null) throw new NullPointerException(); |
4379 |
|
return new SearchKeysTask<K,V,U> |
4380 |
< |
(map, searchFunction, |
4380 |
> |
(map, null, -1, searchFunction, |
4381 |
|
new AtomicReference<U>()); |
4382 |
|
} |
4383 |
|
|
4395 |
|
BiFun<? super K, ? super K, ? extends K> reducer) { |
4396 |
|
if (reducer == null) throw new NullPointerException(); |
4397 |
|
return new ReduceKeysTask<K,V> |
4398 |
< |
(map, reducer); |
4398 |
> |
(map, null, -1, null, reducer); |
4399 |
|
} |
4400 |
|
|
4401 |
|
/** |
4417 |
|
if (transformer == null || reducer == null) |
4418 |
|
throw new NullPointerException(); |
4419 |
|
return new MapReduceKeysTask<K,V,U> |
4420 |
< |
(map, transformer, reducer); |
4420 |
> |
(map, null, -1, null, transformer, reducer); |
4421 |
|
} |
4422 |
|
|
4423 |
|
/** |
4441 |
|
if (transformer == null || reducer == null) |
4442 |
|
throw new NullPointerException(); |
4443 |
|
return new MapReduceKeysToDoubleTask<K,V> |
4444 |
< |
(map, transformer, basis, reducer); |
4444 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4445 |
|
} |
4446 |
|
|
4447 |
|
/** |
4465 |
|
if (transformer == null || reducer == null) |
4466 |
|
throw new NullPointerException(); |
4467 |
|
return new MapReduceKeysToLongTask<K,V> |
4468 |
< |
(map, transformer, basis, reducer); |
4468 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4469 |
|
} |
4470 |
|
|
4471 |
|
/** |
4489 |
|
if (transformer == null || reducer == null) |
4490 |
|
throw new NullPointerException(); |
4491 |
|
return new MapReduceKeysToIntTask<K,V> |
4492 |
< |
(map, transformer, basis, reducer); |
4492 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4493 |
|
} |
4494 |
|
|
4495 |
|
/** |
4503 |
|
(ConcurrentHashMap<K,V> map, |
4504 |
|
Action<V> action) { |
4505 |
|
if (action == null) throw new NullPointerException(); |
4506 |
< |
return new ForEachValueTask<K,V>(map, action); |
4506 |
> |
return new ForEachValueTask<K,V>(map, null, -1, action); |
4507 |
|
} |
4508 |
|
|
4509 |
|
/** |
4523 |
|
if (transformer == null || action == null) |
4524 |
|
throw new NullPointerException(); |
4525 |
|
return new ForEachTransformedValueTask<K,V,U> |
4526 |
< |
(map, transformer, action); |
4526 |
> |
(map, null, -1, transformer, action); |
4527 |
|
} |
4528 |
|
|
4529 |
|
/** |
4544 |
|
Fun<? super V, ? extends U> searchFunction) { |
4545 |
|
if (searchFunction == null) throw new NullPointerException(); |
4546 |
|
return new SearchValuesTask<K,V,U> |
4547 |
< |
(map, searchFunction, |
4547 |
> |
(map, null, -1, searchFunction, |
4548 |
|
new AtomicReference<U>()); |
4549 |
|
} |
4550 |
|
|
4562 |
|
BiFun<? super V, ? super V, ? extends V> reducer) { |
4563 |
|
if (reducer == null) throw new NullPointerException(); |
4564 |
|
return new ReduceValuesTask<K,V> |
4565 |
< |
(map, reducer); |
4565 |
> |
(map, null, -1, null, reducer); |
4566 |
|
} |
4567 |
|
|
4568 |
|
/** |
4584 |
|
if (transformer == null || reducer == null) |
4585 |
|
throw new NullPointerException(); |
4586 |
|
return new MapReduceValuesTask<K,V,U> |
4587 |
< |
(map, transformer, reducer); |
4587 |
> |
(map, null, -1, null, transformer, reducer); |
4588 |
|
} |
4589 |
|
|
4590 |
|
/** |
4608 |
|
if (transformer == null || reducer == null) |
4609 |
|
throw new NullPointerException(); |
4610 |
|
return new MapReduceValuesToDoubleTask<K,V> |
4611 |
< |
(map, transformer, basis, reducer); |
4611 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4612 |
|
} |
4613 |
|
|
4614 |
|
/** |
4632 |
|
if (transformer == null || reducer == null) |
4633 |
|
throw new NullPointerException(); |
4634 |
|
return new MapReduceValuesToLongTask<K,V> |
4635 |
< |
(map, transformer, basis, reducer); |
4635 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4636 |
|
} |
4637 |
|
|
4638 |
|
/** |
4656 |
|
if (transformer == null || reducer == null) |
4657 |
|
throw new NullPointerException(); |
4658 |
|
return new MapReduceValuesToIntTask<K,V> |
4659 |
< |
(map, transformer, basis, reducer); |
4659 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4660 |
|
} |
4661 |
|
|
4662 |
|
/** |
4670 |
|
(ConcurrentHashMap<K,V> map, |
4671 |
|
Action<Map.Entry<K,V>> action) { |
4672 |
|
if (action == null) throw new NullPointerException(); |
4673 |
< |
return new ForEachEntryTask<K,V>(map, action); |
4673 |
> |
return new ForEachEntryTask<K,V>(map, null, -1, action); |
4674 |
|
} |
4675 |
|
|
4676 |
|
/** |
4690 |
|
if (transformer == null || action == null) |
4691 |
|
throw new NullPointerException(); |
4692 |
|
return new ForEachTransformedEntryTask<K,V,U> |
4693 |
< |
(map, transformer, action); |
4693 |
> |
(map, null, -1, transformer, action); |
4694 |
|
} |
4695 |
|
|
4696 |
|
/** |
4711 |
|
Fun<Map.Entry<K,V>, ? extends U> searchFunction) { |
4712 |
|
if (searchFunction == null) throw new NullPointerException(); |
4713 |
|
return new SearchEntriesTask<K,V,U> |
4714 |
< |
(map, searchFunction, |
4714 |
> |
(map, null, -1, searchFunction, |
4715 |
|
new AtomicReference<U>()); |
4716 |
|
} |
4717 |
|
|
4729 |
|
BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) { |
4730 |
|
if (reducer == null) throw new NullPointerException(); |
4731 |
|
return new ReduceEntriesTask<K,V> |
4732 |
< |
(map, reducer); |
4732 |
> |
(map, null, -1, null, reducer); |
4733 |
|
} |
4734 |
|
|
4735 |
|
/** |
4751 |
|
if (transformer == null || reducer == null) |
4752 |
|
throw new NullPointerException(); |
4753 |
|
return new MapReduceEntriesTask<K,V,U> |
4754 |
< |
(map, transformer, reducer); |
4754 |
> |
(map, null, -1, null, transformer, reducer); |
4755 |
|
} |
4756 |
|
|
4757 |
|
/** |
4775 |
|
if (transformer == null || reducer == null) |
4776 |
|
throw new NullPointerException(); |
4777 |
|
return new MapReduceEntriesToDoubleTask<K,V> |
4778 |
< |
(map, transformer, basis, reducer); |
4778 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4779 |
|
} |
4780 |
|
|
4781 |
|
/** |
4799 |
|
if (transformer == null || reducer == null) |
4800 |
|
throw new NullPointerException(); |
4801 |
|
return new MapReduceEntriesToLongTask<K,V> |
4802 |
< |
(map, transformer, basis, reducer); |
4802 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4803 |
|
} |
4804 |
|
|
4805 |
|
/** |
4823 |
|
if (transformer == null || reducer == null) |
4824 |
|
throw new NullPointerException(); |
4825 |
|
return new MapReduceEntriesToIntTask<K,V> |
4826 |
< |
(map, transformer, basis, reducer); |
4826 |
> |
(map, null, -1, null, transformer, basis, reducer); |
4827 |
|
} |
4828 |
|
} |
4829 |
|
|
4842 |
|
*/ |
4843 |
|
@SuppressWarnings("serial") static abstract class BulkTask<K,V,R> extends Traverser<K,V,R> { |
4844 |
|
final BulkTask<K,V,?> parent; // completion target |
4845 |
< |
int batch; // split control |
4845 |
> |
int batch; // split control; -1 for unknown |
4846 |
|
int pending; // completion control |
4847 |
|
|
4848 |
< |
/** Constructor for root tasks */ |
4849 |
< |
BulkTask(ConcurrentHashMap<K,V> map) { |
4848 |
> |
BulkTask(ConcurrentHashMap<K,V> map, BulkTask<K,V,?> parent, |
4849 |
> |
int batch) { |
4850 |
|
super(map); |
4841 |
– |
this.parent = null; |
4842 |
– |
this.batch = -1; // force call to batch() on execution |
4843 |
– |
} |
4844 |
– |
|
4845 |
– |
/** Constructor for subtasks */ |
4846 |
– |
BulkTask(BulkTask<K,V,?> parent, int batch) { |
4847 |
– |
super(parent); |
4851 |
|
this.parent = parent; |
4852 |
|
this.batch = batch; |
4853 |
+ |
if (parent != null && map != null) { // split parent |
4854 |
+ |
Node[] t; |
4855 |
+ |
if ((t = parent.tab) == null && |
4856 |
+ |
(t = parent.tab = map.table) != null) |
4857 |
+ |
parent.baseLimit = parent.baseSize = t.length; |
4858 |
+ |
this.tab = t; |
4859 |
+ |
this.baseSize = parent.baseSize; |
4860 |
+ |
int hi = this.baseLimit = parent.baseLimit; |
4861 |
+ |
parent.baseLimit = this.index = this.baseIndex = |
4862 |
+ |
(hi + parent.baseIndex + 1) >>> 1; |
4863 |
+ |
} |
4864 |
|
} |
4865 |
|
|
4866 |
|
// FJ methods |
4924 |
|
* dividing by two anyway. |
4925 |
|
*/ |
4926 |
|
final int batch() { |
4927 |
< |
int b = batch; |
4928 |
< |
if (b < 0) { |
4929 |
< |
long n = map.counter.sum(); |
4930 |
< |
int sp = getPool().getParallelism() << 3; // slack of 8 |
4931 |
< |
b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp; |
4927 |
> |
ConcurrentHashMap<K, V> m; int b; Node[] t; |
4928 |
> |
if ((b = batch) < 0 && (m = map) != null) { // force initialization |
4929 |
> |
if ((t = tab) == null && (t = tab = m.table) != null) |
4930 |
> |
baseLimit = baseSize = t.length; |
4931 |
> |
if (t != null) { |
4932 |
> |
long n = m.counter.sum(); |
4933 |
> |
int sp = getPool().getParallelism() << 3; // slack of 8 |
4934 |
> |
b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp; |
4935 |
> |
} |
4936 |
|
} |
4937 |
|
return b; |
4938 |
|
} |
4968 |
|
extends BulkTask<K,V,Void> { |
4969 |
|
final Action<K> action; |
4970 |
|
ForEachKeyTask |
4971 |
< |
(ConcurrentHashMap<K,V> m, |
4971 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
4972 |
|
Action<K> action) { |
4973 |
< |
super(m); |
4956 |
< |
this.action = action; |
4957 |
< |
} |
4958 |
< |
ForEachKeyTask |
4959 |
< |
(BulkTask<K,V,?> p, int b, |
4960 |
< |
Action<K> action) { |
4961 |
< |
super(p, b); |
4973 |
> |
super(m, p, b); |
4974 |
|
this.action = action; |
4975 |
|
} |
4976 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
4981 |
|
int b = batch(), c; |
4982 |
|
while (b > 1 && baseIndex != baseLimit) { |
4983 |
|
do {} while (!casPending(c = pending, c+1)); |
4984 |
< |
new ForEachKeyTask<K,V>(this, b >>>= 1, action).fork(); |
4984 |
> |
new ForEachKeyTask<K,V>(map, this, b >>>= 1, action).fork(); |
4985 |
|
} |
4986 |
|
while (advance() != null) |
4987 |
|
action.apply((K)nextKey); |
4997 |
|
extends BulkTask<K,V,Void> { |
4998 |
|
final Action<V> action; |
4999 |
|
ForEachValueTask |
5000 |
< |
(ConcurrentHashMap<K,V> m, |
5000 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5001 |
|
Action<V> action) { |
5002 |
< |
super(m); |
4991 |
< |
this.action = action; |
4992 |
< |
} |
4993 |
< |
ForEachValueTask |
4994 |
< |
(BulkTask<K,V,?> p, int b, |
4995 |
< |
Action<V> action) { |
4996 |
< |
super(p, b); |
5002 |
> |
super(m, p, b); |
5003 |
|
this.action = action; |
5004 |
|
} |
5005 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5010 |
|
int b = batch(), c; |
5011 |
|
while (b > 1 && baseIndex != baseLimit) { |
5012 |
|
do {} while (!casPending(c = pending, c+1)); |
5013 |
< |
new ForEachValueTask<K,V>(this, b >>>= 1, action).fork(); |
5013 |
> |
new ForEachValueTask<K,V>(map, this, b >>>= 1, action).fork(); |
5014 |
|
} |
5015 |
|
Object v; |
5016 |
|
while ((v = advance()) != null) |
5027 |
|
extends BulkTask<K,V,Void> { |
5028 |
|
final Action<Entry<K,V>> action; |
5029 |
|
ForEachEntryTask |
5030 |
< |
(ConcurrentHashMap<K,V> m, |
5025 |
< |
Action<Entry<K,V>> action) { |
5026 |
< |
super(m); |
5027 |
< |
this.action = action; |
5028 |
< |
} |
5029 |
< |
ForEachEntryTask |
5030 |
< |
(BulkTask<K,V,?> p, int b, |
5030 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5031 |
|
Action<Entry<K,V>> action) { |
5032 |
< |
super(p, b); |
5032 |
> |
super(m, p, b); |
5033 |
|
this.action = action; |
5034 |
|
} |
5035 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5040 |
|
int b = batch(), c; |
5041 |
|
while (b > 1 && baseIndex != baseLimit) { |
5042 |
|
do {} while (!casPending(c = pending, c+1)); |
5043 |
< |
new ForEachEntryTask<K,V>(this, b >>>= 1, action).fork(); |
5043 |
> |
new ForEachEntryTask<K,V>(map, this, b >>>= 1, action).fork(); |
5044 |
|
} |
5045 |
|
Object v; |
5046 |
|
while ((v = advance()) != null) |
5057 |
|
extends BulkTask<K,V,Void> { |
5058 |
|
final BiAction<K,V> action; |
5059 |
|
ForEachMappingTask |
5060 |
< |
(ConcurrentHashMap<K,V> m, |
5060 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5061 |
|
BiAction<K,V> action) { |
5062 |
< |
super(m); |
5062 |
> |
super(m, p, b); |
5063 |
|
this.action = action; |
5064 |
|
} |
5065 |
– |
ForEachMappingTask |
5066 |
– |
(BulkTask<K,V,?> p, int b, |
5067 |
– |
BiAction<K,V> action) { |
5068 |
– |
super(p, b); |
5069 |
– |
this.action = action; |
5070 |
– |
} |
5071 |
– |
|
5065 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5066 |
|
final BiAction<K,V> action = this.action; |
5067 |
|
if (action == null) |
5070 |
|
int b = batch(), c; |
5071 |
|
while (b > 1 && baseIndex != baseLimit) { |
5072 |
|
do {} while (!casPending(c = pending, c+1)); |
5073 |
< |
new ForEachMappingTask<K,V>(this, b >>>= 1, |
5073 |
> |
new ForEachMappingTask<K,V>(map, this, b >>>= 1, |
5074 |
|
action).fork(); |
5075 |
|
} |
5076 |
|
Object v; |
5089 |
|
final Fun<? super K, ? extends U> transformer; |
5090 |
|
final Action<U> action; |
5091 |
|
ForEachTransformedKeyTask |
5092 |
< |
(ConcurrentHashMap<K,V> m, |
5092 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5093 |
|
Fun<? super K, ? extends U> transformer, |
5094 |
|
Action<U> action) { |
5095 |
< |
super(m); |
5095 |
> |
super(m, p, b); |
5096 |
|
this.transformer = transformer; |
5097 |
|
this.action = action; |
5098 |
|
|
5099 |
|
} |
5107 |
– |
ForEachTransformedKeyTask |
5108 |
– |
(BulkTask<K,V,?> p, int b, |
5109 |
– |
Fun<? super K, ? extends U> transformer, |
5110 |
– |
Action<U> action) { |
5111 |
– |
super(p, b); |
5112 |
– |
this.transformer = transformer; |
5113 |
– |
this.action = action; |
5114 |
– |
} |
5100 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5101 |
|
final Fun<? super K, ? extends U> transformer = |
5102 |
|
this.transformer; |
5108 |
|
while (b > 1 && baseIndex != baseLimit) { |
5109 |
|
do {} while (!casPending(c = pending, c+1)); |
5110 |
|
new ForEachTransformedKeyTask<K,V,U> |
5111 |
< |
(this, b >>>= 1, transformer, action).fork(); |
5111 |
> |
(map, this, b >>>= 1, transformer, action).fork(); |
5112 |
|
} |
5113 |
|
U u; |
5114 |
|
while (advance() != null) { |
5128 |
|
final Fun<? super V, ? extends U> transformer; |
5129 |
|
final Action<U> action; |
5130 |
|
ForEachTransformedValueTask |
5131 |
< |
(ConcurrentHashMap<K,V> m, |
5131 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5132 |
|
Fun<? super V, ? extends U> transformer, |
5133 |
|
Action<U> action) { |
5134 |
< |
super(m); |
5134 |
> |
super(m, p, b); |
5135 |
|
this.transformer = transformer; |
5136 |
|
this.action = action; |
5137 |
|
|
5138 |
|
} |
5154 |
– |
ForEachTransformedValueTask |
5155 |
– |
(BulkTask<K,V,?> p, int b, |
5156 |
– |
Fun<? super V, ? extends U> transformer, |
5157 |
– |
Action<U> action) { |
5158 |
– |
super(p, b); |
5159 |
– |
this.transformer = transformer; |
5160 |
– |
this.action = action; |
5161 |
– |
} |
5139 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5140 |
|
final Fun<? super V, ? extends U> transformer = |
5141 |
|
this.transformer; |
5147 |
|
while (b > 1 && baseIndex != baseLimit) { |
5148 |
|
do {} while (!casPending(c = pending, c+1)); |
5149 |
|
new ForEachTransformedValueTask<K,V,U> |
5150 |
< |
(this, b >>>= 1, transformer, action).fork(); |
5150 |
> |
(map, this, b >>>= 1, transformer, action).fork(); |
5151 |
|
} |
5152 |
|
Object v; U u; |
5153 |
|
while ((v = advance()) != null) { |
5167 |
|
final Fun<Map.Entry<K,V>, ? extends U> transformer; |
5168 |
|
final Action<U> action; |
5169 |
|
ForEachTransformedEntryTask |
5170 |
< |
(ConcurrentHashMap<K,V> m, |
5170 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5171 |
|
Fun<Map.Entry<K,V>, ? extends U> transformer, |
5172 |
|
Action<U> action) { |
5173 |
< |
super(m); |
5173 |
> |
super(m, p, b); |
5174 |
|
this.transformer = transformer; |
5175 |
|
this.action = action; |
5176 |
|
|
5177 |
|
} |
5201 |
– |
ForEachTransformedEntryTask |
5202 |
– |
(BulkTask<K,V,?> p, int b, |
5203 |
– |
Fun<Map.Entry<K,V>, ? extends U> transformer, |
5204 |
– |
Action<U> action) { |
5205 |
– |
super(p, b); |
5206 |
– |
this.transformer = transformer; |
5207 |
– |
this.action = action; |
5208 |
– |
} |
5178 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5179 |
|
final Fun<Map.Entry<K,V>, ? extends U> transformer = |
5180 |
|
this.transformer; |
5186 |
|
while (b > 1 && baseIndex != baseLimit) { |
5187 |
|
do {} while (!casPending(c = pending, c+1)); |
5188 |
|
new ForEachTransformedEntryTask<K,V,U> |
5189 |
< |
(this, b >>>= 1, transformer, action).fork(); |
5189 |
> |
(map, this, b >>>= 1, transformer, action).fork(); |
5190 |
|
} |
5191 |
|
Object v; U u; |
5192 |
|
while ((v = advance()) != null) { |
5206 |
|
final BiFun<? super K, ? super V, ? extends U> transformer; |
5207 |
|
final Action<U> action; |
5208 |
|
ForEachTransformedMappingTask |
5209 |
< |
(ConcurrentHashMap<K,V> m, |
5209 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5210 |
|
BiFun<? super K, ? super V, ? extends U> transformer, |
5211 |
|
Action<U> action) { |
5212 |
< |
super(m); |
5212 |
> |
super(m, p, b); |
5213 |
|
this.transformer = transformer; |
5214 |
|
this.action = action; |
5215 |
|
|
5216 |
|
} |
5248 |
– |
ForEachTransformedMappingTask |
5249 |
– |
(BulkTask<K,V,?> p, int b, |
5250 |
– |
BiFun<? super K, ? super V, ? extends U> transformer, |
5251 |
– |
Action<U> action) { |
5252 |
– |
super(p, b); |
5253 |
– |
this.transformer = transformer; |
5254 |
– |
this.action = action; |
5255 |
– |
} |
5217 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5218 |
|
final BiFun<? super K, ? super V, ? extends U> transformer = |
5219 |
|
this.transformer; |
5225 |
|
while (b > 1 && baseIndex != baseLimit) { |
5226 |
|
do {} while (!casPending(c = pending, c+1)); |
5227 |
|
new ForEachTransformedMappingTask<K,V,U> |
5228 |
< |
(this, b >>>= 1, transformer, action).fork(); |
5228 |
> |
(map, this, b >>>= 1, transformer, action).fork(); |
5229 |
|
} |
5230 |
|
Object v; U u; |
5231 |
|
while ((v = advance()) != null) { |
5245 |
|
final Fun<? super K, ? extends U> searchFunction; |
5246 |
|
final AtomicReference<U> result; |
5247 |
|
SearchKeysTask |
5248 |
< |
(ConcurrentHashMap<K,V> m, |
5248 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5249 |
|
Fun<? super K, ? extends U> searchFunction, |
5250 |
|
AtomicReference<U> result) { |
5251 |
< |
super(m); |
5291 |
< |
this.searchFunction = searchFunction; this.result = result; |
5292 |
< |
} |
5293 |
< |
SearchKeysTask |
5294 |
< |
(BulkTask<K,V,?> p, int b, |
5295 |
< |
Fun<? super K, ? extends U> searchFunction, |
5296 |
< |
AtomicReference<U> result) { |
5297 |
< |
super(p, b); |
5251 |
> |
super(m, p, b); |
5252 |
|
this.searchFunction = searchFunction; this.result = result; |
5253 |
|
} |
5254 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5261 |
|
int b = batch(), c; |
5262 |
|
while (b > 1 && baseIndex != baseLimit && result.get() == null) { |
5263 |
|
do {} while (!casPending(c = pending, c+1)); |
5264 |
< |
new SearchKeysTask<K,V,U>(this, b >>>= 1, |
5264 |
> |
new SearchKeysTask<K,V,U>(map, this, b >>>= 1, |
5265 |
|
searchFunction, result).fork(); |
5266 |
|
} |
5267 |
|
U u; |
5286 |
|
final Fun<? super V, ? extends U> searchFunction; |
5287 |
|
final AtomicReference<U> result; |
5288 |
|
SearchValuesTask |
5289 |
< |
(ConcurrentHashMap<K,V> m, |
5336 |
< |
Fun<? super V, ? extends U> searchFunction, |
5337 |
< |
AtomicReference<U> result) { |
5338 |
< |
super(m); |
5339 |
< |
this.searchFunction = searchFunction; this.result = result; |
5340 |
< |
} |
5341 |
< |
SearchValuesTask |
5342 |
< |
(BulkTask<K,V,?> p, int b, |
5289 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5290 |
|
Fun<? super V, ? extends U> searchFunction, |
5291 |
|
AtomicReference<U> result) { |
5292 |
< |
super(p, b); |
5292 |
> |
super(m, p, b); |
5293 |
|
this.searchFunction = searchFunction; this.result = result; |
5294 |
|
} |
5295 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5302 |
|
int b = batch(), c; |
5303 |
|
while (b > 1 && baseIndex != baseLimit && result.get() == null) { |
5304 |
|
do {} while (!casPending(c = pending, c+1)); |
5305 |
< |
new SearchValuesTask<K,V,U>(this, b >>>= 1, |
5305 |
> |
new SearchValuesTask<K,V,U>(map, this, b >>>= 1, |
5306 |
|
searchFunction, result).fork(); |
5307 |
|
} |
5308 |
|
Object v; U u; |
5327 |
|
final Fun<Entry<K,V>, ? extends U> searchFunction; |
5328 |
|
final AtomicReference<U> result; |
5329 |
|
SearchEntriesTask |
5330 |
< |
(ConcurrentHashMap<K,V> m, |
5384 |
< |
Fun<Entry<K,V>, ? extends U> searchFunction, |
5385 |
< |
AtomicReference<U> result) { |
5386 |
< |
super(m); |
5387 |
< |
this.searchFunction = searchFunction; this.result = result; |
5388 |
< |
} |
5389 |
< |
SearchEntriesTask |
5390 |
< |
(BulkTask<K,V,?> p, int b, |
5330 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5331 |
|
Fun<Entry<K,V>, ? extends U> searchFunction, |
5332 |
|
AtomicReference<U> result) { |
5333 |
< |
super(p, b); |
5333 |
> |
super(m, p, b); |
5334 |
|
this.searchFunction = searchFunction; this.result = result; |
5335 |
|
} |
5336 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5343 |
|
int b = batch(), c; |
5344 |
|
while (b > 1 && baseIndex != baseLimit && result.get() == null) { |
5345 |
|
do {} while (!casPending(c = pending, c+1)); |
5346 |
< |
new SearchEntriesTask<K,V,U>(this, b >>>= 1, |
5346 |
> |
new SearchEntriesTask<K,V,U>(map, this, b >>>= 1, |
5347 |
|
searchFunction, result).fork(); |
5348 |
|
} |
5349 |
|
Object v; U u; |
5368 |
|
final BiFun<? super K, ? super V, ? extends U> searchFunction; |
5369 |
|
final AtomicReference<U> result; |
5370 |
|
SearchMappingsTask |
5371 |
< |
(ConcurrentHashMap<K,V> m, |
5432 |
< |
BiFun<? super K, ? super V, ? extends U> searchFunction, |
5433 |
< |
AtomicReference<U> result) { |
5434 |
< |
super(m); |
5435 |
< |
this.searchFunction = searchFunction; this.result = result; |
5436 |
< |
} |
5437 |
< |
SearchMappingsTask |
5438 |
< |
(BulkTask<K,V,?> p, int b, |
5371 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5372 |
|
BiFun<? super K, ? super V, ? extends U> searchFunction, |
5373 |
|
AtomicReference<U> result) { |
5374 |
< |
super(p, b); |
5374 |
> |
super(m, p, b); |
5375 |
|
this.searchFunction = searchFunction; this.result = result; |
5376 |
|
} |
5377 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5384 |
|
int b = batch(), c; |
5385 |
|
while (b > 1 && baseIndex != baseLimit && result.get() == null) { |
5386 |
|
do {} while (!casPending(c = pending, c+1)); |
5387 |
< |
new SearchMappingsTask<K,V,U>(this, b >>>= 1, |
5387 |
> |
new SearchMappingsTask<K,V,U>(map, this, b >>>= 1, |
5388 |
|
searchFunction, result).fork(); |
5389 |
|
} |
5390 |
|
Object v; U u; |
5410 |
|
K result; |
5411 |
|
ReduceKeysTask<K,V> rights, nextRight; |
5412 |
|
ReduceKeysTask |
5413 |
< |
(ConcurrentHashMap<K,V> m, |
5481 |
< |
BiFun<? super K, ? super K, ? extends K> reducer) { |
5482 |
< |
super(m); |
5483 |
< |
this.reducer = reducer; |
5484 |
< |
} |
5485 |
< |
ReduceKeysTask |
5486 |
< |
(BulkTask<K,V,?> p, int b, |
5413 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5414 |
|
ReduceKeysTask<K,V> nextRight, |
5415 |
|
BiFun<? super K, ? super K, ? extends K> reducer) { |
5416 |
< |
super(p, b); this.nextRight = nextRight; |
5416 |
> |
super(m, p, b); this.nextRight = nextRight; |
5417 |
|
this.reducer = reducer; |
5418 |
|
} |
5492 |
– |
|
5419 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5420 |
|
final BiFun<? super K, ? super K, ? extends K> reducer = |
5421 |
|
this.reducer; |
5425 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5426 |
|
do {} while (!casPending(c = pending, c+1)); |
5427 |
|
(rights = new ReduceKeysTask<K,V> |
5428 |
< |
(this, b >>>= 1, rights, reducer)).fork(); |
5428 |
> |
(map, this, b >>>= 1, rights, reducer)).fork(); |
5429 |
|
} |
5430 |
|
K r = null; |
5431 |
|
while (advance() != null) { |
5464 |
|
V result; |
5465 |
|
ReduceValuesTask<K,V> rights, nextRight; |
5466 |
|
ReduceValuesTask |
5467 |
< |
(ConcurrentHashMap<K,V> m, |
5542 |
< |
BiFun<? super V, ? super V, ? extends V> reducer) { |
5543 |
< |
super(m); |
5544 |
< |
this.reducer = reducer; |
5545 |
< |
} |
5546 |
< |
ReduceValuesTask |
5547 |
< |
(BulkTask<K,V,?> p, int b, |
5467 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5468 |
|
ReduceValuesTask<K,V> nextRight, |
5469 |
|
BiFun<? super V, ? super V, ? extends V> reducer) { |
5470 |
< |
super(p, b); this.nextRight = nextRight; |
5470 |
> |
super(m, p, b); this.nextRight = nextRight; |
5471 |
|
this.reducer = reducer; |
5472 |
|
} |
5553 |
– |
|
5473 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5474 |
|
final BiFun<? super V, ? super V, ? extends V> reducer = |
5475 |
|
this.reducer; |
5479 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5480 |
|
do {} while (!casPending(c = pending, c+1)); |
5481 |
|
(rights = new ReduceValuesTask<K,V> |
5482 |
< |
(this, b >>>= 1, rights, reducer)).fork(); |
5482 |
> |
(map, this, b >>>= 1, rights, reducer)).fork(); |
5483 |
|
} |
5484 |
|
V r = null; |
5485 |
|
Object v; |
5519 |
|
Map.Entry<K,V> result; |
5520 |
|
ReduceEntriesTask<K,V> rights, nextRight; |
5521 |
|
ReduceEntriesTask |
5522 |
< |
(ConcurrentHashMap<K,V> m, |
5604 |
< |
BiFun<Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) { |
5605 |
< |
super(m); |
5606 |
< |
this.reducer = reducer; |
5607 |
< |
} |
5608 |
< |
ReduceEntriesTask |
5609 |
< |
(BulkTask<K,V,?> p, int b, |
5522 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5523 |
|
ReduceEntriesTask<K,V> nextRight, |
5524 |
< |
BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) { |
5525 |
< |
super(p, b); this.nextRight = nextRight; |
5524 |
> |
BiFun<Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) { |
5525 |
> |
super(m, p, b); this.nextRight = nextRight; |
5526 |
|
this.reducer = reducer; |
5527 |
|
} |
5615 |
– |
|
5528 |
|
@SuppressWarnings("unchecked") public final boolean exec() { |
5529 |
|
final BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer = |
5530 |
|
this.reducer; |
5534 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5535 |
|
do {} while (!casPending(c = pending, c+1)); |
5536 |
|
(rights = new ReduceEntriesTask<K,V> |
5537 |
< |
(this, b >>>= 1, rights, reducer)).fork(); |
5537 |
> |
(map, this, b >>>= 1, rights, reducer)).fork(); |
5538 |
|
} |
5539 |
|
Map.Entry<K,V> r = null; |
5540 |
|
Object v; |
5575 |
|
U result; |
5576 |
|
MapReduceKeysTask<K,V,U> rights, nextRight; |
5577 |
|
MapReduceKeysTask |
5578 |
< |
(ConcurrentHashMap<K,V> m, |
5667 |
< |
Fun<? super K, ? extends U> transformer, |
5668 |
< |
BiFun<? super U, ? super U, ? extends U> reducer) { |
5669 |
< |
super(m); |
5670 |
< |
this.transformer = transformer; |
5671 |
< |
this.reducer = reducer; |
5672 |
< |
} |
5673 |
< |
MapReduceKeysTask |
5674 |
< |
(BulkTask<K,V,?> p, int b, |
5578 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5579 |
|
MapReduceKeysTask<K,V,U> nextRight, |
5580 |
|
Fun<? super K, ? extends U> transformer, |
5581 |
|
BiFun<? super U, ? super U, ? extends U> reducer) { |
5582 |
< |
super(p, b); this.nextRight = nextRight; |
5582 |
> |
super(m, p, b); this.nextRight = nextRight; |
5583 |
|
this.transformer = transformer; |
5584 |
|
this.reducer = reducer; |
5585 |
|
} |
5594 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5595 |
|
do {} while (!casPending(c = pending, c+1)); |
5596 |
|
(rights = new MapReduceKeysTask<K,V,U> |
5597 |
< |
(this, b >>>= 1, rights, transformer, reducer)).fork(); |
5597 |
> |
(map, this, b >>>= 1, rights, transformer, reducer)).fork(); |
5598 |
|
} |
5599 |
|
U r = null, u; |
5600 |
|
while (advance() != null) { |
5634 |
|
U result; |
5635 |
|
MapReduceValuesTask<K,V,U> rights, nextRight; |
5636 |
|
MapReduceValuesTask |
5637 |
< |
(ConcurrentHashMap<K,V> m, |
5734 |
< |
Fun<? super V, ? extends U> transformer, |
5735 |
< |
BiFun<? super U, ? super U, ? extends U> reducer) { |
5736 |
< |
super(m); |
5737 |
< |
this.transformer = transformer; |
5738 |
< |
this.reducer = reducer; |
5739 |
< |
} |
5740 |
< |
MapReduceValuesTask |
5741 |
< |
(BulkTask<K,V,?> p, int b, |
5637 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5638 |
|
MapReduceValuesTask<K,V,U> nextRight, |
5639 |
|
Fun<? super V, ? extends U> transformer, |
5640 |
|
BiFun<? super U, ? super U, ? extends U> reducer) { |
5641 |
< |
super(p, b); this.nextRight = nextRight; |
5641 |
> |
super(m, p, b); this.nextRight = nextRight; |
5642 |
|
this.transformer = transformer; |
5643 |
|
this.reducer = reducer; |
5644 |
|
} |
5653 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5654 |
|
do {} while (!casPending(c = pending, c+1)); |
5655 |
|
(rights = new MapReduceValuesTask<K,V,U> |
5656 |
< |
(this, b >>>= 1, rights, transformer, reducer)).fork(); |
5656 |
> |
(map, this, b >>>= 1, rights, transformer, reducer)).fork(); |
5657 |
|
} |
5658 |
|
U r = null, u; |
5659 |
|
Object v; |
5694 |
|
U result; |
5695 |
|
MapReduceEntriesTask<K,V,U> rights, nextRight; |
5696 |
|
MapReduceEntriesTask |
5697 |
< |
(ConcurrentHashMap<K,V> m, |
5802 |
< |
Fun<Map.Entry<K,V>, ? extends U> transformer, |
5803 |
< |
BiFun<? super U, ? super U, ? extends U> reducer) { |
5804 |
< |
super(m); |
5805 |
< |
this.transformer = transformer; |
5806 |
< |
this.reducer = reducer; |
5807 |
< |
} |
5808 |
< |
MapReduceEntriesTask |
5809 |
< |
(BulkTask<K,V,?> p, int b, |
5697 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5698 |
|
MapReduceEntriesTask<K,V,U> nextRight, |
5699 |
|
Fun<Map.Entry<K,V>, ? extends U> transformer, |
5700 |
|
BiFun<? super U, ? super U, ? extends U> reducer) { |
5701 |
< |
super(p, b); this.nextRight = nextRight; |
5701 |
> |
super(m, p, b); this.nextRight = nextRight; |
5702 |
|
this.transformer = transformer; |
5703 |
|
this.reducer = reducer; |
5704 |
|
} |
5713 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5714 |
|
do {} while (!casPending(c = pending, c+1)); |
5715 |
|
(rights = new MapReduceEntriesTask<K,V,U> |
5716 |
< |
(this, b >>>= 1, rights, transformer, reducer)).fork(); |
5716 |
> |
(map, this, b >>>= 1, rights, transformer, reducer)).fork(); |
5717 |
|
} |
5718 |
|
U r = null, u; |
5719 |
|
Object v; |
5754 |
|
U result; |
5755 |
|
MapReduceMappingsTask<K,V,U> rights, nextRight; |
5756 |
|
MapReduceMappingsTask |
5757 |
< |
(ConcurrentHashMap<K,V> m, |
5870 |
< |
BiFun<? super K, ? super V, ? extends U> transformer, |
5871 |
< |
BiFun<? super U, ? super U, ? extends U> reducer) { |
5872 |
< |
super(m); |
5873 |
< |
this.transformer = transformer; |
5874 |
< |
this.reducer = reducer; |
5875 |
< |
} |
5876 |
< |
MapReduceMappingsTask |
5877 |
< |
(BulkTask<K,V,?> p, int b, |
5757 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5758 |
|
MapReduceMappingsTask<K,V,U> nextRight, |
5759 |
|
BiFun<? super K, ? super V, ? extends U> transformer, |
5760 |
|
BiFun<? super U, ? super U, ? extends U> reducer) { |
5761 |
< |
super(p, b); this.nextRight = nextRight; |
5761 |
> |
super(m, p, b); this.nextRight = nextRight; |
5762 |
|
this.transformer = transformer; |
5763 |
|
this.reducer = reducer; |
5764 |
|
} |
5773 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5774 |
|
do {} while (!casPending(c = pending, c+1)); |
5775 |
|
(rights = new MapReduceMappingsTask<K,V,U> |
5776 |
< |
(this, b >>>= 1, rights, transformer, reducer)).fork(); |
5776 |
> |
(map, this, b >>>= 1, rights, transformer, reducer)).fork(); |
5777 |
|
} |
5778 |
|
U r = null, u; |
5779 |
|
Object v; |
5815 |
|
double result; |
5816 |
|
MapReduceKeysToDoubleTask<K,V> rights, nextRight; |
5817 |
|
MapReduceKeysToDoubleTask |
5818 |
< |
(ConcurrentHashMap<K,V> m, |
5939 |
< |
ObjectToDouble<? super K> transformer, |
5940 |
< |
double basis, |
5941 |
< |
DoubleByDoubleToDouble reducer) { |
5942 |
< |
super(m); |
5943 |
< |
this.transformer = transformer; |
5944 |
< |
this.basis = basis; this.reducer = reducer; |
5945 |
< |
} |
5946 |
< |
MapReduceKeysToDoubleTask |
5947 |
< |
(BulkTask<K,V,?> p, int b, |
5818 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5819 |
|
MapReduceKeysToDoubleTask<K,V> nextRight, |
5820 |
|
ObjectToDouble<? super K> transformer, |
5821 |
|
double basis, |
5822 |
|
DoubleByDoubleToDouble reducer) { |
5823 |
< |
super(p, b); this.nextRight = nextRight; |
5823 |
> |
super(m, p, b); this.nextRight = nextRight; |
5824 |
|
this.transformer = transformer; |
5825 |
|
this.basis = basis; this.reducer = reducer; |
5826 |
|
} |
5835 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5836 |
|
do {} while (!casPending(c = pending, c+1)); |
5837 |
|
(rights = new MapReduceKeysToDoubleTask<K,V> |
5838 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5838 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5839 |
|
} |
5840 |
|
double r = id; |
5841 |
|
while (advance() != null) |
5873 |
|
double result; |
5874 |
|
MapReduceValuesToDoubleTask<K,V> rights, nextRight; |
5875 |
|
MapReduceValuesToDoubleTask |
5876 |
< |
(ConcurrentHashMap<K,V> m, |
6006 |
< |
ObjectToDouble<? super V> transformer, |
6007 |
< |
double basis, |
6008 |
< |
DoubleByDoubleToDouble reducer) { |
6009 |
< |
super(m); |
6010 |
< |
this.transformer = transformer; |
6011 |
< |
this.basis = basis; this.reducer = reducer; |
6012 |
< |
} |
6013 |
< |
MapReduceValuesToDoubleTask |
6014 |
< |
(BulkTask<K,V,?> p, int b, |
5876 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5877 |
|
MapReduceValuesToDoubleTask<K,V> nextRight, |
5878 |
|
ObjectToDouble<? super V> transformer, |
5879 |
|
double basis, |
5880 |
|
DoubleByDoubleToDouble reducer) { |
5881 |
< |
super(p, b); this.nextRight = nextRight; |
5881 |
> |
super(m, p, b); this.nextRight = nextRight; |
5882 |
|
this.transformer = transformer; |
5883 |
|
this.basis = basis; this.reducer = reducer; |
5884 |
|
} |
5893 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5894 |
|
do {} while (!casPending(c = pending, c+1)); |
5895 |
|
(rights = new MapReduceValuesToDoubleTask<K,V> |
5896 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5896 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5897 |
|
} |
5898 |
|
double r = id; |
5899 |
|
Object v; |
5932 |
|
double result; |
5933 |
|
MapReduceEntriesToDoubleTask<K,V> rights, nextRight; |
5934 |
|
MapReduceEntriesToDoubleTask |
5935 |
< |
(ConcurrentHashMap<K,V> m, |
6074 |
< |
ObjectToDouble<Map.Entry<K,V>> transformer, |
6075 |
< |
double basis, |
6076 |
< |
DoubleByDoubleToDouble reducer) { |
6077 |
< |
super(m); |
6078 |
< |
this.transformer = transformer; |
6079 |
< |
this.basis = basis; this.reducer = reducer; |
6080 |
< |
} |
6081 |
< |
MapReduceEntriesToDoubleTask |
6082 |
< |
(BulkTask<K,V,?> p, int b, |
5935 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5936 |
|
MapReduceEntriesToDoubleTask<K,V> nextRight, |
5937 |
|
ObjectToDouble<Map.Entry<K,V>> transformer, |
5938 |
|
double basis, |
5939 |
|
DoubleByDoubleToDouble reducer) { |
5940 |
< |
super(p, b); this.nextRight = nextRight; |
5940 |
> |
super(m, p, b); this.nextRight = nextRight; |
5941 |
|
this.transformer = transformer; |
5942 |
|
this.basis = basis; this.reducer = reducer; |
5943 |
|
} |
5952 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
5953 |
|
do {} while (!casPending(c = pending, c+1)); |
5954 |
|
(rights = new MapReduceEntriesToDoubleTask<K,V> |
5955 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5955 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
5956 |
|
} |
5957 |
|
double r = id; |
5958 |
|
Object v; |
5991 |
|
double result; |
5992 |
|
MapReduceMappingsToDoubleTask<K,V> rights, nextRight; |
5993 |
|
MapReduceMappingsToDoubleTask |
5994 |
< |
(ConcurrentHashMap<K,V> m, |
6142 |
< |
ObjectByObjectToDouble<? super K, ? super V> transformer, |
6143 |
< |
double basis, |
6144 |
< |
DoubleByDoubleToDouble reducer) { |
6145 |
< |
super(m); |
6146 |
< |
this.transformer = transformer; |
6147 |
< |
this.basis = basis; this.reducer = reducer; |
6148 |
< |
} |
6149 |
< |
MapReduceMappingsToDoubleTask |
6150 |
< |
(BulkTask<K,V,?> p, int b, |
5994 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
5995 |
|
MapReduceMappingsToDoubleTask<K,V> nextRight, |
5996 |
|
ObjectByObjectToDouble<? super K, ? super V> transformer, |
5997 |
|
double basis, |
5998 |
|
DoubleByDoubleToDouble reducer) { |
5999 |
< |
super(p, b); this.nextRight = nextRight; |
5999 |
> |
super(m, p, b); this.nextRight = nextRight; |
6000 |
|
this.transformer = transformer; |
6001 |
|
this.basis = basis; this.reducer = reducer; |
6002 |
|
} |
6011 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6012 |
|
do {} while (!casPending(c = pending, c+1)); |
6013 |
|
(rights = new MapReduceMappingsToDoubleTask<K,V> |
6014 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6014 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6015 |
|
} |
6016 |
|
double r = id; |
6017 |
|
Object v; |
6050 |
|
long result; |
6051 |
|
MapReduceKeysToLongTask<K,V> rights, nextRight; |
6052 |
|
MapReduceKeysToLongTask |
6053 |
< |
(ConcurrentHashMap<K,V> m, |
6210 |
< |
ObjectToLong<? super K> transformer, |
6211 |
< |
long basis, |
6212 |
< |
LongByLongToLong reducer) { |
6213 |
< |
super(m); |
6214 |
< |
this.transformer = transformer; |
6215 |
< |
this.basis = basis; this.reducer = reducer; |
6216 |
< |
} |
6217 |
< |
MapReduceKeysToLongTask |
6218 |
< |
(BulkTask<K,V,?> p, int b, |
6053 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6054 |
|
MapReduceKeysToLongTask<K,V> nextRight, |
6055 |
|
ObjectToLong<? super K> transformer, |
6056 |
|
long basis, |
6057 |
|
LongByLongToLong reducer) { |
6058 |
< |
super(p, b); this.nextRight = nextRight; |
6058 |
> |
super(m, p, b); this.nextRight = nextRight; |
6059 |
|
this.transformer = transformer; |
6060 |
|
this.basis = basis; this.reducer = reducer; |
6061 |
|
} |
6070 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6071 |
|
do {} while (!casPending(c = pending, c+1)); |
6072 |
|
(rights = new MapReduceKeysToLongTask<K,V> |
6073 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6073 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6074 |
|
} |
6075 |
|
long r = id; |
6076 |
|
while (advance() != null) |
6108 |
|
long result; |
6109 |
|
MapReduceValuesToLongTask<K,V> rights, nextRight; |
6110 |
|
MapReduceValuesToLongTask |
6111 |
< |
(ConcurrentHashMap<K,V> m, |
6277 |
< |
ObjectToLong<? super V> transformer, |
6278 |
< |
long basis, |
6279 |
< |
LongByLongToLong reducer) { |
6280 |
< |
super(m); |
6281 |
< |
this.transformer = transformer; |
6282 |
< |
this.basis = basis; this.reducer = reducer; |
6283 |
< |
} |
6284 |
< |
MapReduceValuesToLongTask |
6285 |
< |
(BulkTask<K,V,?> p, int b, |
6111 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6112 |
|
MapReduceValuesToLongTask<K,V> nextRight, |
6113 |
|
ObjectToLong<? super V> transformer, |
6114 |
|
long basis, |
6115 |
|
LongByLongToLong reducer) { |
6116 |
< |
super(p, b); this.nextRight = nextRight; |
6116 |
> |
super(m, p, b); this.nextRight = nextRight; |
6117 |
|
this.transformer = transformer; |
6118 |
|
this.basis = basis; this.reducer = reducer; |
6119 |
|
} |
6128 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6129 |
|
do {} while (!casPending(c = pending, c+1)); |
6130 |
|
(rights = new MapReduceValuesToLongTask<K,V> |
6131 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6131 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6132 |
|
} |
6133 |
|
long r = id; |
6134 |
|
Object v; |
6167 |
|
long result; |
6168 |
|
MapReduceEntriesToLongTask<K,V> rights, nextRight; |
6169 |
|
MapReduceEntriesToLongTask |
6170 |
< |
(ConcurrentHashMap<K,V> m, |
6345 |
< |
ObjectToLong<Map.Entry<K,V>> transformer, |
6346 |
< |
long basis, |
6347 |
< |
LongByLongToLong reducer) { |
6348 |
< |
super(m); |
6349 |
< |
this.transformer = transformer; |
6350 |
< |
this.basis = basis; this.reducer = reducer; |
6351 |
< |
} |
6352 |
< |
MapReduceEntriesToLongTask |
6353 |
< |
(BulkTask<K,V,?> p, int b, |
6170 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6171 |
|
MapReduceEntriesToLongTask<K,V> nextRight, |
6172 |
|
ObjectToLong<Map.Entry<K,V>> transformer, |
6173 |
|
long basis, |
6174 |
|
LongByLongToLong reducer) { |
6175 |
< |
super(p, b); this.nextRight = nextRight; |
6175 |
> |
super(m, p, b); this.nextRight = nextRight; |
6176 |
|
this.transformer = transformer; |
6177 |
|
this.basis = basis; this.reducer = reducer; |
6178 |
|
} |
6187 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6188 |
|
do {} while (!casPending(c = pending, c+1)); |
6189 |
|
(rights = new MapReduceEntriesToLongTask<K,V> |
6190 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6190 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6191 |
|
} |
6192 |
|
long r = id; |
6193 |
|
Object v; |
6226 |
|
long result; |
6227 |
|
MapReduceMappingsToLongTask<K,V> rights, nextRight; |
6228 |
|
MapReduceMappingsToLongTask |
6229 |
< |
(ConcurrentHashMap<K,V> m, |
6413 |
< |
ObjectByObjectToLong<? super K, ? super V> transformer, |
6414 |
< |
long basis, |
6415 |
< |
LongByLongToLong reducer) { |
6416 |
< |
super(m); |
6417 |
< |
this.transformer = transformer; |
6418 |
< |
this.basis = basis; this.reducer = reducer; |
6419 |
< |
} |
6420 |
< |
MapReduceMappingsToLongTask |
6421 |
< |
(BulkTask<K,V,?> p, int b, |
6229 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6230 |
|
MapReduceMappingsToLongTask<K,V> nextRight, |
6231 |
|
ObjectByObjectToLong<? super K, ? super V> transformer, |
6232 |
|
long basis, |
6233 |
|
LongByLongToLong reducer) { |
6234 |
< |
super(p, b); this.nextRight = nextRight; |
6234 |
> |
super(m, p, b); this.nextRight = nextRight; |
6235 |
|
this.transformer = transformer; |
6236 |
|
this.basis = basis; this.reducer = reducer; |
6237 |
|
} |
6246 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6247 |
|
do {} while (!casPending(c = pending, c+1)); |
6248 |
|
(rights = new MapReduceMappingsToLongTask<K,V> |
6249 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6249 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6250 |
|
} |
6251 |
|
long r = id; |
6252 |
|
Object v; |
6285 |
|
int result; |
6286 |
|
MapReduceKeysToIntTask<K,V> rights, nextRight; |
6287 |
|
MapReduceKeysToIntTask |
6288 |
< |
(ConcurrentHashMap<K,V> m, |
6481 |
< |
ObjectToInt<? super K> transformer, |
6482 |
< |
int basis, |
6483 |
< |
IntByIntToInt reducer) { |
6484 |
< |
super(m); |
6485 |
< |
this.transformer = transformer; |
6486 |
< |
this.basis = basis; this.reducer = reducer; |
6487 |
< |
} |
6488 |
< |
MapReduceKeysToIntTask |
6489 |
< |
(BulkTask<K,V,?> p, int b, |
6288 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6289 |
|
MapReduceKeysToIntTask<K,V> nextRight, |
6290 |
|
ObjectToInt<? super K> transformer, |
6291 |
|
int basis, |
6292 |
|
IntByIntToInt reducer) { |
6293 |
< |
super(p, b); this.nextRight = nextRight; |
6293 |
> |
super(m, p, b); this.nextRight = nextRight; |
6294 |
|
this.transformer = transformer; |
6295 |
|
this.basis = basis; this.reducer = reducer; |
6296 |
|
} |
6305 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6306 |
|
do {} while (!casPending(c = pending, c+1)); |
6307 |
|
(rights = new MapReduceKeysToIntTask<K,V> |
6308 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6308 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6309 |
|
} |
6310 |
|
int r = id; |
6311 |
|
while (advance() != null) |
6343 |
|
int result; |
6344 |
|
MapReduceValuesToIntTask<K,V> rights, nextRight; |
6345 |
|
MapReduceValuesToIntTask |
6346 |
< |
(ConcurrentHashMap<K,V> m, |
6548 |
< |
ObjectToInt<? super V> transformer, |
6549 |
< |
int basis, |
6550 |
< |
IntByIntToInt reducer) { |
6551 |
< |
super(m); |
6552 |
< |
this.transformer = transformer; |
6553 |
< |
this.basis = basis; this.reducer = reducer; |
6554 |
< |
} |
6555 |
< |
MapReduceValuesToIntTask |
6556 |
< |
(BulkTask<K,V,?> p, int b, |
6346 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6347 |
|
MapReduceValuesToIntTask<K,V> nextRight, |
6348 |
|
ObjectToInt<? super V> transformer, |
6349 |
|
int basis, |
6350 |
|
IntByIntToInt reducer) { |
6351 |
< |
super(p, b); this.nextRight = nextRight; |
6351 |
> |
super(m, p, b); this.nextRight = nextRight; |
6352 |
|
this.transformer = transformer; |
6353 |
|
this.basis = basis; this.reducer = reducer; |
6354 |
|
} |
6363 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6364 |
|
do {} while (!casPending(c = pending, c+1)); |
6365 |
|
(rights = new MapReduceValuesToIntTask<K,V> |
6366 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6366 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6367 |
|
} |
6368 |
|
int r = id; |
6369 |
|
Object v; |
6402 |
|
int result; |
6403 |
|
MapReduceEntriesToIntTask<K,V> rights, nextRight; |
6404 |
|
MapReduceEntriesToIntTask |
6405 |
< |
(ConcurrentHashMap<K,V> m, |
6616 |
< |
ObjectToInt<Map.Entry<K,V>> transformer, |
6617 |
< |
int basis, |
6618 |
< |
IntByIntToInt reducer) { |
6619 |
< |
super(m); |
6620 |
< |
this.transformer = transformer; |
6621 |
< |
this.basis = basis; this.reducer = reducer; |
6622 |
< |
} |
6623 |
< |
MapReduceEntriesToIntTask |
6624 |
< |
(BulkTask<K,V,?> p, int b, |
6405 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6406 |
|
MapReduceEntriesToIntTask<K,V> nextRight, |
6407 |
|
ObjectToInt<Map.Entry<K,V>> transformer, |
6408 |
|
int basis, |
6409 |
|
IntByIntToInt reducer) { |
6410 |
< |
super(p, b); this.nextRight = nextRight; |
6410 |
> |
super(m, p, b); this.nextRight = nextRight; |
6411 |
|
this.transformer = transformer; |
6412 |
|
this.basis = basis; this.reducer = reducer; |
6413 |
|
} |
6422 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6423 |
|
do {} while (!casPending(c = pending, c+1)); |
6424 |
|
(rights = new MapReduceEntriesToIntTask<K,V> |
6425 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6425 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6426 |
|
} |
6427 |
|
int r = id; |
6428 |
|
Object v; |
6461 |
|
int result; |
6462 |
|
MapReduceMappingsToIntTask<K,V> rights, nextRight; |
6463 |
|
MapReduceMappingsToIntTask |
6464 |
< |
(ConcurrentHashMap<K,V> m, |
6465 |
< |
ObjectByObjectToInt<? super K, ? super V> transformer, |
6685 |
< |
int basis, |
6686 |
< |
IntByIntToInt reducer) { |
6687 |
< |
super(m); |
6688 |
< |
this.transformer = transformer; |
6689 |
< |
this.basis = basis; this.reducer = reducer; |
6690 |
< |
} |
6691 |
< |
MapReduceMappingsToIntTask |
6692 |
< |
(BulkTask<K,V,?> p, int b, |
6693 |
< |
MapReduceMappingsToIntTask<K,V> nextRight, |
6464 |
> |
(ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b, |
6465 |
> |
MapReduceMappingsToIntTask<K,V> rights, |
6466 |
|
ObjectByObjectToInt<? super K, ? super V> transformer, |
6467 |
|
int basis, |
6468 |
|
IntByIntToInt reducer) { |
6469 |
< |
super(p, b); this.nextRight = nextRight; |
6469 |
> |
super(m, p, b); this.nextRight = nextRight; |
6470 |
|
this.transformer = transformer; |
6471 |
|
this.basis = basis; this.reducer = reducer; |
6472 |
|
} |
6481 |
|
for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { |
6482 |
|
do {} while (!casPending(c = pending, c+1)); |
6483 |
|
(rights = new MapReduceMappingsToIntTask<K,V> |
6484 |
< |
(this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6484 |
> |
(map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); |
6485 |
|
} |
6486 |
|
int r = id; |
6487 |
|
Object v; |
6512 |
|
public final Integer getRawResult() { return result; } |
6513 |
|
} |
6514 |
|
|
6515 |
+ |
|
6516 |
|
// Unsafe mechanics |
6517 |
|
private static final sun.misc.Unsafe UNSAFE; |
6518 |
|
private static final long counterOffset; |