Skip to content

Commit e01e9b0

Browse files
committed
1.66
1 parent 0d4552d commit e01e9b0

File tree

7 files changed

+48
-7
lines changed

7 files changed

+48
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dev.felnull.fnjl;
22

33
public class FNJLBuildIn {
4-
protected static final String VERSION = "1.65";
4+
protected static final String VERSION = "1.66";
55
}

common/src/main/java/dev/felnull/fnjl/concurrent/InvokeExecutor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,13 @@ public void runTasks() {
2626
while (!tasks.isEmpty())
2727
tasks.poll().run();
2828
}
29+
30+
/**
31+
* 現在の実行待ちタスクの数
32+
*
33+
* @return タスク数
34+
*/
35+
public int getTaskCount() {
36+
return tasks.size();
37+
}
2938
}

common/src/main/java/dev/felnull/fnjl/util/FNDataUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.security.MessageDigest;
2222
import java.security.NoSuchAlgorithmException;
2323
import java.util.*;
24+
import java.util.concurrent.ConcurrentHashMap;
2425
import java.util.concurrent.ThreadFactory;
2526
import java.util.concurrent.atomic.AtomicInteger;
2627
import java.util.concurrent.atomic.AtomicReference;
@@ -618,13 +619,11 @@ public static void readZipStreamed(InputStream zipStream, BiConsumer<ZipEntry, I
618619
@NotNull
619620
public static <T, M> Function<T, M> memoize(@NotNull final Function<T, M> function) {
620621
return new Function<T, M>() {
621-
private final Map<T, M> cache = new HashMap<>();
622+
private final Map<T, M> cache = new ConcurrentHashMap<>();
622623

623624
@Override
624625
public M apply(T t) {
625-
synchronized (cache) {
626-
return cache.computeIfAbsent(t, function);
627-
}
626+
return cache.computeIfAbsent(t, function);
628627
}
629628
};
630629
}

common/src/main/java/dev/felnull/fnjl/util/FNForUtil.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package dev.felnull.fnjl.util;
22

3+
import dev.felnull.fnjl.math.FNVec3f;
4+
import dev.felnull.fnjl.tuple.FNPair;
5+
6+
import java.util.function.Consumer;
37
import java.util.function.IntConsumer;
48

59
/**
@@ -34,4 +38,32 @@ public static void forMinToMaxDownwards(int start, int end, IntConsumer action)
3438
action.accept(i);
3539
}
3640
}
41+
42+
/**
43+
* 箱の指定から縁の繰り返す
44+
*
45+
* @param stX 箱の開始地点x
46+
* @param stY 箱の開始地点y
47+
* @param stZ 箱の開始地点z
48+
* @param enX 箱の終了地点x
49+
* @param enY 箱の終了地点y
50+
* @param enZ 箱の終了地点z
51+
* @param action 実行
52+
*/
53+
public static void forBoxEdge(float stX, float stY, float stZ, float enX, float enY, float enZ, Consumer<FNPair<FNVec3f, FNVec3f>> action) {
54+
action.accept(FNPair.of(new FNVec3f(stX, stY, stZ), new FNVec3f(stX, enY, stZ)));
55+
action.accept(FNPair.of(new FNVec3f(enX, stY, stZ), new FNVec3f(enX, enY, stZ)));
56+
action.accept(FNPair.of(new FNVec3f(stX, stY, enZ), new FNVec3f(stX, enY, enZ)));
57+
action.accept(FNPair.of(new FNVec3f(enX, stY, enZ), new FNVec3f(enX, enY, enZ)));
58+
59+
action.accept(FNPair.of(new FNVec3f(stX, stY, stZ), new FNVec3f(enX, stY, stZ)));
60+
action.accept(FNPair.of(new FNVec3f(stX, stY, enZ), new FNVec3f(enX, stY, enZ)));
61+
action.accept(FNPair.of(new FNVec3f(stX, enY, stZ), new FNVec3f(enX, enY, stZ)));
62+
action.accept(FNPair.of(new FNVec3f(stX, enY, enZ), new FNVec3f(enX, enY, enZ)));
63+
64+
action.accept(FNPair.of(new FNVec3f(stX, stY, stZ), new FNVec3f(stX, stY, enZ)));
65+
action.accept(FNPair.of(new FNVec3f(enX, stY, stZ), new FNVec3f(enX, stY, enZ)));
66+
action.accept(FNPair.of(new FNVec3f(stX, enY, stZ), new FNVec3f(stX, enY, enZ)));
67+
action.accept(FNPair.of(new FNVec3f(enX, enY, stZ), new FNVec3f(enX, enY, enZ)));
68+
}
3769
}

common/src/test/java/dev/felnull/fnjltest/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
public class Main {
44
public static void main(String[] args) throws Exception {
5+
56
}
67
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fnjl_group=dev.felnull
22
fnjl_name=felnull-java-library
3-
fnjl_version=1.65
3+
fnjl_version=1.66
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.felnull.fnjln;
22

33
public class FNJLNBuildIn {
4-
protected static final String VERSION = "1.65";
4+
protected static final String VERSION = "1.66";
55

66
protected static final int NATIVE_LIBRARY_VERSION = 1;
77
}

0 commit comments

Comments
 (0)