Bassboonyd update

This commit is contained in:
Willem Cazander 2022-10-15 02:34:58 +02:00
parent 7886fc567f
commit 02cb20f16f
291 changed files with 1439 additions and 1112 deletions

View file

@ -3,12 +3,13 @@ package love.distributedrebirth.bassboonyd;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
@BãßBȍőnAuthorInfoʸᴰ(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKeyʸᴰ> extends BãßBȍőnCoffinʸᴰ<T> {
void LOCK_COFFIN();
BãßBȍőnCoffinʸᴰ<T> LOCK_COFFIN();
Object PUT_OBJ(T key, Object value);
@ -20,28 +21,27 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
PUT_OBJ(key, new ArrayList<>());
}
static void lockCoffin(DefaultEnumBaseʸᴰ<?,?> store, Consumer<String> logHandler) {
logHandler.accept("Lock: "+store.BãßClassNaam()+" since: "+store.BãßAuthorCopyright());
for (Object o:store.BãßInstances()) {
BãßBȍőnCoffinStoreʸᴰ<?, ?> coffin = BãßBȍőnCoffinStoreʸᴰ.class.cast(o);
BãßBȍőnCoffinOpenʸᴰ<?> coffinOpen = BãßBȍőnCoffinOpenʸᴰ.class.cast(coffin.GET_BBC());
coffinOpen.LOCK_COFFIN();
}
static <X, K extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<K> FROM(BãßBȍőn<X,K> boon) {
return FROM(boon.GET_BBC());
}
static <K extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<K> FROM(BãßBȍőnCoffinʸᴰ<K> bbc) {
return (BãßBȍőnCoffinOpenʸᴰ<K>) bbc;
}
static class BãßBȍőnFamilyGrave implements BãßBȍőnCoffinGhostʸᴰ {
final Map<String,Object> ghosts = new HashMap<>();
volatile boolean deathLock = false;
private final Map<String,Object> ghosts = new HashMap<>();
//private volatile boolean deathLock = false;
public void LOCK_GHOST() {
deathLock = true;
}
//public void LOCK_GHOST() {
// deathLock = true;
//}
@Override
public Object PUT_GHOST(String key, Object value) {
if (deathLock) {
throw new IllegalStateException("Can't restore body of family ghost.");
}
//if (deathLock) {
// throw new IllegalStateException("Can't restore body of family ghost.");
//}
return ghosts.put(key, value);
}
@ -53,16 +53,17 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
final Map<Y,Object> initMap = new HashMap<>();
final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>();
volatile boolean deathLock = false;
private final Map<Y,Object> initMap = new HashMap<>();
private final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>();
private volatile boolean deathLock = false;
@Override
public void LOCK_COFFIN() {
public BãßBȍőnCoffinʸᴰ<Y> LOCK_COFFIN() {
deathLock = true;
for (BãßBȍőnFamilyGrave grave:familyGrave.values()) {
grave.LOCK_GHOST();
}
//for (BãßBȍőnFamilyGrave grave:familyGrave.values()) {
// grave.LOCK_GHOST();
//}
return createProxy();
}
@Override
@ -82,11 +83,43 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
public BãßBȍőnCoffinGhostʸᴰ UNHOLY(Class<? extends BãßBȍőnꝐŕḯṿª> familyName) {
BãßBȍőnFamilyGrave familyGhosts = familyGrave.get(familyName);
if (familyGhosts == null) {
//if (deathLock) {
// throw new IllegalStateException("Can't add more death in closed coffin, its unholy.");
//}
familyGhosts = new BãßBȍőnFamilyGrave();
familyGrave.put(familyName, familyGhosts);
}
return familyGhosts;
}
private BãßBȍőnCoffinʸᴰ<Y> createProxy() {
final BãßBȍőnCoffinʸᴰ<Y> local = this;
/*
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = BãßBȍőnCoffinOpenʸᴰ.class.getClassLoader();
}
return (BãßBȍőnCoffinʸᴰ<Y>) Proxy.newProxyInstance(cl, new Class[]{BãßBȍőnCoffinʸᴰ.class}, new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Method localMethod = local.getClass().getMethod(method.getName(), method.getParameterTypes());
Object result = localMethod.invoke(local, args);
return result;
}
});
*/
return new BãßBȍőnCoffinʸᴰ<Y>() {
@Override
public BãßBȍőnCoffinGhostʸᴰ UNHOLY(Class<? extends BãßBȍőnꝐŕḯṿª> familyName) {
return local.UNHOLY(familyName);
}
@Override
public Object GET_OBJ(Y key) {
return local.GET_OBJ(key);
}
};
}
};
}
}