-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSBBase.java
42 lines (36 loc) · 1.06 KB
/
SBBase.java
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
package skylinebreaker;
import flatlc.levels.FlatLevelCombination;
public abstract class SBBase {
public static final class NearestNeighborOfZero
{
public FlatLevelCombination neighbor = null;
public int norm = Integer.MAX_VALUE;
public int threadCount = 0;
}
public static FlatLevelCombination[] combineLocalSkyline(final FlatLevelCombination[] a, final FlatLevelCombination[] b)
{
int areserved = a.length;
int breserved = b.length;
for(int i = 0; i < a.length && i < areserved; ++i)
{
if(b.length == 0) break;
aLoop:
for(int j = 0; j < b.length && j < breserved; ++j)
{
bLoop:
switch(a[i].compare(b[j])) {
case FlatLevelCombination.LESS:
a[i--] = a[--areserved];
break aLoop;
case FlatLevelCombination.GREATER:
b[j--] = b[--breserved];
break bLoop;
}
}
}
final FlatLevelCombination[] c = new FlatLevelCombination[areserved + breserved];
for(int i = 0; i < areserved; ++i) c[i] = a[i];
for(int i = 0; i < breserved; ++i) c[i+areserved] = b[i];
return c;
}
}