260 lines
8.0 KiB
Java
260 lines
8.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.virtual;
|
|
|
|
import javax.baja.naming.BHost;
|
|
import javax.baja.naming.BISession;
|
|
import javax.baja.naming.BOrd;
|
|
import javax.baja.naming.SlotPath;
|
|
import javax.baja.nav.BINavNode;
|
|
import javax.baja.space.BComponentSpace;
|
|
import javax.baja.spy.SpyWriter;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.LexiconText;
|
|
import javax.baja.virtual.BVirtualComponent;
|
|
import javax.baja.virtual.BVirtualGateway;
|
|
import javax.baja.virtual.VirtualCacheCallbacks;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BVirtualComponentSpace
|
|
extends BComponentSpace {
|
|
public static final Type TYPE;
|
|
VirtualCacheCallbacks virtualCacheCallbacks;
|
|
final BVirtualGateway gateway;
|
|
boolean isRunning;
|
|
Object lock;
|
|
static /* synthetic */ Class class$javax$baja$virtual$BVirtualComponentSpace;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void start() {
|
|
Object object = this.lock;
|
|
synchronized (object) {
|
|
if (this.isRunning) {
|
|
return;
|
|
}
|
|
BComponent bComponent = this.getRootComponent();
|
|
if (bComponent == null) {
|
|
throw new IllegalStateException("Cannot start virtual space due to null root component.");
|
|
}
|
|
if (this.virtualCacheCallbacks == null) {
|
|
throw new IllegalStateException("Cannot start virtual space due to null virtual cache callbacks.");
|
|
}
|
|
bComponent.start();
|
|
this.virtualCacheCallbacks.start();
|
|
this.isRunning = true;
|
|
this.started();
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void started() {
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void stop() {
|
|
Object object = this.lock;
|
|
synchronized (object) {
|
|
if (!this.isRunning) {
|
|
return;
|
|
}
|
|
this.virtualCacheCallbacks.stop();
|
|
this.getRootComponent().stop();
|
|
this.isRunning = false;
|
|
this.stopped();
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void stopped() {
|
|
}
|
|
|
|
public final boolean isRunning() {
|
|
return this.isRunning;
|
|
}
|
|
|
|
public final BVirtualGateway getVirtualGateway() {
|
|
return this.gateway;
|
|
}
|
|
|
|
public final VirtualCacheCallbacks getVirtualCacheCallbacks() {
|
|
return this.virtualCacheCallbacks;
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void setVirtualCacheCallbacks(VirtualCacheCallbacks virtualCacheCallbacks) {
|
|
Object object = this.lock;
|
|
synchronized (object) {
|
|
if (this.isRunning) {
|
|
throw new IllegalStateException("Cannot set virtual cache callbacks because the virtual space is already running.");
|
|
}
|
|
this.virtualCacheCallbacks = virtualCacheCallbacks;
|
|
return;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void setRootComponent(BComponent bComponent) {
|
|
Object object = this.lock;
|
|
synchronized (object) {
|
|
if (this.isRunning) {
|
|
throw new IllegalStateException("Cannot set root component because the virtual space is already running.");
|
|
}
|
|
super.setRootComponent(bComponent);
|
|
return;
|
|
}
|
|
}
|
|
|
|
public boolean isSpaceReadonly() {
|
|
return true;
|
|
}
|
|
|
|
public BHost getHost() {
|
|
return this.gateway.getSpace().getHost();
|
|
}
|
|
|
|
public BISession getSession() {
|
|
return this.gateway.getSpace().getSession();
|
|
}
|
|
|
|
public BOrd getAbsoluteOrd() {
|
|
return BOrd.make(this.gateway.getAbsoluteOrd(), "virtual:");
|
|
}
|
|
|
|
public BOrd getOrdInHost() {
|
|
return BOrd.make(this.gateway.getOrdInHost(), "virtual:");
|
|
}
|
|
|
|
public final BOrd getNavOrd() {
|
|
return this.gateway.getNavOrd();
|
|
}
|
|
|
|
public final BINavNode getNavParent() {
|
|
return this.gateway;
|
|
}
|
|
|
|
public void spy(SpyWriter spyWriter) throws Exception {
|
|
spyWriter.startProps();
|
|
spyWriter.trTitle("VirtualComponentSpace", 2);
|
|
spyWriter.prop((Object)"isRunning", this.isRunning);
|
|
spyWriter.endProps();
|
|
if (this.virtualCacheCallbacks != null) {
|
|
this.virtualCacheCallbacks.spy(spyWriter);
|
|
}
|
|
super.spy(spyWriter);
|
|
BComponent bComponent = this.getRootComponent();
|
|
if (bComponent != null) {
|
|
spyWriter.startProps();
|
|
spyWriter.trTitle("VirtualComponentSpace Root Component", 2);
|
|
spyWriter.endProps();
|
|
bComponent.spy(spyWriter);
|
|
}
|
|
}
|
|
|
|
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
|
if (n == 104 && this.gateway != null) {
|
|
if (object instanceof SlotPath[]) {
|
|
SlotPath[] slotPathArray = (SlotPath[])object;
|
|
int n2 = slotPathArray.length;
|
|
BOrd[] bOrdArray = new BOrd[n2];
|
|
BOrd bOrd = this.getNavOrd();
|
|
int n3 = 0;
|
|
while (n3 < n2) {
|
|
bOrdArray[n3] = BOrd.make(bOrd, slotPathArray[n3]).normalize();
|
|
++n3;
|
|
}
|
|
this.gateway.ensureVirtualsLoaded(bOrdArray);
|
|
} else {
|
|
this.gateway.ensureVirtualsLoaded((BOrd[])object);
|
|
}
|
|
}
|
|
if (n == 110) {
|
|
this.touch((BOrd[])object);
|
|
}
|
|
return super.fw(n, object, object2, object3, object4);
|
|
}
|
|
|
|
void touch(BOrd[] bOrdArray) {
|
|
if (bOrdArray == null) {
|
|
return;
|
|
}
|
|
int n = 0;
|
|
while (n < bOrdArray.length) {
|
|
try {
|
|
BObject bObject = bOrdArray[n].get(this);
|
|
if (bObject instanceof BVirtualComponent) {
|
|
((BVirtualComponent)bObject).updateTicks();
|
|
}
|
|
}
|
|
catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
++n;
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.virtualCacheCallbacks = null;
|
|
this.isRunning = false;
|
|
this.lock = new Object();
|
|
}
|
|
|
|
public BVirtualComponentSpace(String string, LexiconText lexiconText, BOrd bOrd, BVirtualGateway bVirtualGateway) {
|
|
super(string, lexiconText, BOrd.make(bVirtualGateway.getOrdInSession(), "virtual:"));
|
|
this.this();
|
|
this.gateway = bVirtualGateway;
|
|
this.setVirtualCacheCallbacks(new VirtualCacheCallbacks(this));
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$javax$baja$virtual$BVirtualComponentSpace;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$virtual$BVirtualComponentSpace = BVirtualComponentSpace.class("[Ljavax.baja.virtual.BVirtualComponentSpace;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
}
|
|
}
|
|
|