2022-02-02 17:34:46 +01:00
|
|
|
package love.distributedrebirth.bassboonyd;
|
|
|
|
|
|
2022-02-15 19:48:29 +01:00
|
|
|
import java.util.ArrayList;
|
2022-02-02 17:34:46 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
2022-10-17 16:42:12 +02:00
|
|
|
import love.distributedrebirth.bassboonyd.clazz.BãßBȍőnAuthor注;
|
2022-10-17 16:25:23 +02:00
|
|
|
import love.distributedrebirth.bassboonyd.sinit.BãßBȍőnꝐŕḯṿª₮ḕ;
|
2022-02-02 17:34:46 +01:00
|
|
|
|
2022-10-15 02:34:58 +02:00
|
|
|
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
2022-10-17 16:27:36 +02:00
|
|
|
public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinNailʸᴰ> extends BãßBȍőnCoffinʸᴰ<T> {
|
2022-10-15 02:34:58 +02:00
|
|
|
|
|
|
|
|
BãßBȍőnCoffinʸᴰ<T> LOCK_COFFIN();
|
2022-02-03 14:20:48 +01:00
|
|
|
|
2022-02-02 17:34:46 +01:00
|
|
|
Object PUT_OBJ(T key, Object value);
|
|
|
|
|
|
|
|
|
|
default void PUT_MAP(T key) {
|
|
|
|
|
PUT_OBJ(key, new HashMap<>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default void PUT_LIST(T key) {
|
2022-02-15 19:48:29 +01:00
|
|
|
PUT_OBJ(key, new ArrayList<>());
|
2022-02-02 17:34:46 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-17 18:59:42 +02:00
|
|
|
static <X, K extends BãßBȍőnCoffinNailʸᴰ> BãßBȍőnCoffinOpenʸᴰ<K> FROM(BãßBȍőnʸᴰ<X,K> boon) {
|
2022-10-15 13:20:04 +02:00
|
|
|
return FROM(boon.toBBC());
|
2022-10-15 02:34:58 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-17 16:27:36 +02:00
|
|
|
static <K extends BãßBȍőnCoffinNailʸᴰ> BãßBȍőnCoffinOpenʸᴰ<K> FROM(BãßBȍőnCoffinʸᴰ<K> bbc) {
|
2022-10-15 02:34:58 +02:00
|
|
|
return (BãßBȍőnCoffinOpenʸᴰ<K>) bbc;
|
2022-02-13 13:24:02 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-14 01:35:53 +02:00
|
|
|
static class BãßBȍőnFamilyGrave implements BãßBȍőnCoffinGhostʸᴰ {
|
2022-10-15 02:34:58 +02:00
|
|
|
private final Map<String,Object> ghosts = new HashMap<>();
|
|
|
|
|
//private volatile boolean deathLock = false;
|
2022-10-14 01:35:53 +02:00
|
|
|
|
2022-10-15 02:34:58 +02:00
|
|
|
//public void LOCK_GHOST() {
|
|
|
|
|
// deathLock = true;
|
|
|
|
|
//}
|
2022-10-14 01:35:53 +02:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object PUT_GHOST(String key, Object value) {
|
2022-10-15 02:34:58 +02:00
|
|
|
//if (deathLock) {
|
|
|
|
|
// throw new IllegalStateException("Can't restore body of family ghost.");
|
|
|
|
|
//}
|
2022-10-14 01:35:53 +02:00
|
|
|
return ghosts.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object GHOST_OBJ(String key) {
|
|
|
|
|
return ghosts.get(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-17 16:27:36 +02:00
|
|
|
static <Y extends BãßBȍőnCoffinNailʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
|
2022-02-02 18:06:12 +01:00
|
|
|
return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
|
2022-10-15 14:12:04 +02:00
|
|
|
private final Map<Y,Object> corpseParts = new HashMap<>();
|
2022-10-15 02:34:58 +02:00
|
|
|
private final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>();
|
|
|
|
|
private volatile boolean deathLock = false;
|
2022-02-02 17:34:46 +01:00
|
|
|
|
2022-02-03 14:20:48 +01:00
|
|
|
@Override
|
2022-10-15 02:34:58 +02:00
|
|
|
public BãßBȍőnCoffinʸᴰ<Y> LOCK_COFFIN() {
|
2022-02-03 14:20:48 +01:00
|
|
|
deathLock = true;
|
2022-10-15 02:34:58 +02:00
|
|
|
//for (BãßBȍőnFamilyGrave grave:familyGrave.values()) {
|
|
|
|
|
// grave.LOCK_GHOST();
|
|
|
|
|
//}
|
|
|
|
|
return createProxy();
|
2022-02-03 14:20:48 +01:00
|
|
|
}
|
|
|
|
|
|
2022-02-02 17:34:46 +01:00
|
|
|
@Override
|
|
|
|
|
public Object GET_OBJ(Y key) {
|
2022-10-15 14:12:04 +02:00
|
|
|
return corpseParts.get(key);
|
2022-02-02 17:34:46 +01:00
|
|
|
}
|
2022-10-14 01:35:53 +02:00
|
|
|
|
2022-02-02 17:34:46 +01:00
|
|
|
@Override
|
|
|
|
|
public Object PUT_OBJ(Y key, Object value) {
|
2022-02-03 14:20:48 +01:00
|
|
|
if (deathLock) {
|
2022-10-15 14:12:04 +02:00
|
|
|
throw new IllegalStateException("Can't put body parts in closed coffin.");
|
2022-02-03 14:20:48 +01:00
|
|
|
}
|
2022-10-15 14:12:04 +02:00
|
|
|
return corpseParts.put(key, value);
|
2022-02-02 17:34:46 +01:00
|
|
|
}
|
2022-10-14 01:35:53 +02:00
|
|
|
|
|
|
|
|
@Override
|
2022-10-14 12:56:07 +02:00
|
|
|
public BãßBȍőnCoffinGhostʸᴰ UNHOLY(Class<? extends BãßBȍőnꝐŕḯṿª₮ḕ> familyName) {
|
2022-10-14 01:35:53 +02:00
|
|
|
BãßBȍőnFamilyGrave familyGhosts = familyGrave.get(familyName);
|
|
|
|
|
if (familyGhosts == null) {
|
2022-10-15 02:34:58 +02:00
|
|
|
//if (deathLock) {
|
|
|
|
|
// throw new IllegalStateException("Can't add more death in closed coffin, its unholy.");
|
|
|
|
|
//}
|
2022-10-14 01:35:53 +02:00
|
|
|
familyGhosts = new BãßBȍőnFamilyGrave();
|
|
|
|
|
familyGrave.put(familyName, familyGhosts);
|
|
|
|
|
}
|
|
|
|
|
return familyGhosts;
|
|
|
|
|
}
|
2022-10-15 02:34:58 +02:00
|
|
|
|
|
|
|
|
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());
|
2022-10-15 14:12:04 +02:00
|
|
|
return localMethod.invoke(local, args);
|
2022-10-15 02:34:58 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-02-02 17:34:46 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|