JPP: Fixed unicode block enum name and make kaas chef use less resources
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 42s

This commit is contained in:
Willem Cazander 2026-03-22 14:49:51 +01:00
parent d78bd5ff46
commit 35d913d6bb
2 changed files with 22 additions and 12 deletions

View file

@ -27,6 +27,7 @@
package ᒢᣘᐧᐧ.ᑊᑉᣔᣔᔆ;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
@ -57,23 +58,32 @@ public final class KaasChef {
return !kaas.isEnum() && !kaas.isInterface() && !kaas.isAnnotation();
}
// TODO: remove iterator so rewrite to "normal classic fast index based downwards counting for loop" or normalized as NCFIBDCFL
public boolean tasteInterfaceMethodisch(Class<?> kaas) {
if (!kaas.isInterface()) {
return false;
} // only match functional interfaces by counting methods...
return Arrays.asList(kaas.getDeclaredMethods()).stream().filter(m -> Modifier.isAbstract(m.getModifiers())).count() == 1;
return countAbstractMethods(kaas.getDeclaredMethods()) == 1;
}
// TODO: remove iterator so rewrite to "normal classic fast index based downwards counting for loop" or normalized as NCFIBDCFL
public boolean tasteInterfaceDriced(final Class<?> kaas) {
if (!kaas.isInterface()) {
return false;
}
if (kaas.getDeclaredMethods().length == 0) {
Method[] kaasMethods = kaas.getDeclaredMethods();
if (kaasMethods.length == 0) {
return false;
} // only match dry iced interfaces
return Arrays.asList(kaas.getDeclaredMethods()).stream().filter(m -> Modifier.isAbstract(m.getModifiers())).count() == 0;
return countAbstractMethods(kaasMethods) == 0;
}
private int countAbstractMethods(final Method[] kaasMethods) {
int count = 0;
for (int i = kaasMethods.length - 1; i >= 0; i--) {
if (Modifier.isAbstract(kaasMethods[i].getModifiers())) {
count++;
}
}
return count;
}
public List<Class<?>> cookPermittedSubclassesSortedNaturel(Class<?> kaas) {