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-02-13 13:24:02 +01:00
|
|
|
import java.util.function.Consumer;
|
2022-02-02 17:34:46 +01:00
|
|
|
|
2022-08-24 17:33:39 +02:00
|
|
|
@BãßBȍőnAuthorInfoʸᴰ(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
2022-10-14 01:35:53 +02:00
|
|
|
public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKeyʸᴰ> extends BãßBȍőnCoffinʸᴰ<T> {
|
2022-02-02 17:34:46 +01:00
|
|
|
|
2022-02-03 14:20:48 +01:00
|
|
|
void LOCK_COFFIN();
|
|
|
|
|
|
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-14 01:35:53 +02:00
|
|
|
static void lockCoffin(DefaultEnumBaseʸᴰ<?,?> store, Consumer<String> logHandler) {
|
2022-02-13 13:24:02 +01:00
|
|
|
logHandler.accept("Lock: "+store.BãßClassNaam()+" since: "+store.BãßAuthorCopyright());
|
|
|
|
|
for (Object o:store.BãßInstances()) {
|
2022-10-14 01:35:53 +02:00
|
|
|
BãßBȍőnCoffinStoreʸᴰ<?, ?> coffin = BãßBȍőnCoffinStoreʸᴰ.class.cast(o);
|
2022-02-13 13:24:02 +01:00
|
|
|
BãßBȍőnCoffinOpenʸᴰ<?> coffinOpen = BãßBȍőnCoffinOpenʸᴰ.class.cast(coffin.GET_BBC());
|
|
|
|
|
coffinOpen.LOCK_COFFIN();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-14 01:35:53 +02:00
|
|
|
static class BãßBȍőnFamilyGrave implements BãßBȍőnCoffinGhostʸᴰ {
|
|
|
|
|
final Map<String,Object> ghosts = new HashMap<>();
|
|
|
|
|
volatile boolean deathLock = false;
|
|
|
|
|
|
|
|
|
|
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.");
|
|
|
|
|
}
|
|
|
|
|
return ghosts.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object GHOST_OBJ(String key) {
|
|
|
|
|
return ghosts.get(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-02 18:06:12 +01:00
|
|
|
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
|
|
|
|
|
return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
|
2022-02-02 17:34:46 +01:00
|
|
|
final Map<Y,Object> initMap = new HashMap<>();
|
2022-10-14 01:35:53 +02:00
|
|
|
final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>();
|
2022-02-03 14:20:48 +01:00
|
|
|
volatile boolean deathLock = false;
|
2022-02-02 17:34:46 +01:00
|
|
|
|
2022-02-03 14:20:48 +01:00
|
|
|
@Override
|
|
|
|
|
public void LOCK_COFFIN() {
|
|
|
|
|
deathLock = true;
|
2022-10-14 01:35:53 +02:00
|
|
|
for (BãßBȍőnFamilyGrave grave:familyGrave.values()) {
|
|
|
|
|
grave.LOCK_GHOST();
|
|
|
|
|
}
|
2022-02-03 14:20:48 +01:00
|
|
|
}
|
|
|
|
|
|
2022-02-02 17:34:46 +01:00
|
|
|
@Override
|
|
|
|
|
public Object GET_OBJ(Y key) {
|
|
|
|
|
return initMap.get(key);
|
|
|
|
|
}
|
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) {
|
|
|
|
|
throw new IllegalStateException("Can't cheat death in closed coffin.");
|
|
|
|
|
}
|
2022-02-02 17:34:46 +01:00
|
|
|
return initMap.put(key, value);
|
|
|
|
|
}
|
2022-10-14 01:35:53 +02:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BãßBȍőnCoffinGhostʸᴰ UNHOLY(Class<?> familyName) {
|
|
|
|
|
BãßBȍőnFamilyGrave familyGhosts = familyGrave.get(familyName);
|
|
|
|
|
if (familyGhosts == null) {
|
|
|
|
|
familyGhosts = new BãßBȍőnFamilyGrave();
|
|
|
|
|
familyGrave.put(familyName, familyGhosts);
|
|
|
|
|
}
|
|
|
|
|
return familyGhosts;
|
|
|
|
|
}
|
2022-02-02 17:34:46 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|