FvctxSizeCounter.java
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.scene7.is.util.SizeInt
* com.scene7.is.util.collections.CollectionUtil
* org.jetbrains.annotations.NotNull
*/
package com.scene7.is.ps.provider.fvctx;
import com.scene7.is.util.SizeInt;
import com.scene7.is.util.collections.CollectionUtil;
import java.util.List;
import org.jetbrains.annotations.NotNull;
class FvctxSizeCounter {
private final List<SizeCount> counters = CollectionUtil.list();
FvctxSizeCounter() {
}
public void add(@NotNull SizeInt size) {
for (SizeCount sc : this.counters) {
if (!sc.size.equals((Object)size)) continue;
++sc.count;
return;
}
this.counters.add(new SizeCount(size));
}
@NotNull
public SizeInt getMostOftenSize() {
if (this.counters.isEmpty()) {
return SizeInt.zeroSizeInt();
}
int highest = 0;
for (int i = 0; i < this.counters.size(); ++i) {
if (this.counters.get((int)highest).count >= this.counters.get((int)i).count) continue;
highest = i;
}
return this.counters.get((int)highest).size;
}
private static class SizeCount {
@NotNull
public final SizeInt size;
public int count;
public SizeCount(@NotNull SizeInt size) {
this.size = size;
this.count = 1;
}
}
}