199 lines
6.0 KiB
Java
199 lines
6.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.schema;
|
|
|
|
import com.tridium.sys.schema.DynamicTable;
|
|
import com.tridium.sys.schema.NProperty;
|
|
import javax.baja.log.Log;
|
|
import javax.baja.sys.Action;
|
|
import javax.baja.sys.BComplex;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.CursorException;
|
|
import javax.baja.sys.Property;
|
|
import javax.baja.sys.Slot;
|
|
import javax.baja.sys.SlotCursor;
|
|
import javax.baja.sys.Topic;
|
|
|
|
final class PropertyCursor
|
|
implements SlotCursor {
|
|
private static final Log log = Log.getLog("baja.PropertyCursor");
|
|
private int index = -1;
|
|
private BComplex object;
|
|
private NProperty[] frozen;
|
|
private DynamicTable dynamic;
|
|
private int count;
|
|
|
|
public final BObject target() {
|
|
return this.object;
|
|
}
|
|
|
|
public final Context getContext() {
|
|
return null;
|
|
}
|
|
|
|
public final boolean next() {
|
|
boolean bl = false;
|
|
if (++this.index < this.count) {
|
|
bl = true;
|
|
}
|
|
return bl;
|
|
}
|
|
|
|
public final boolean nextObject() {
|
|
while (++this.index < this.count) {
|
|
block4: {
|
|
try {
|
|
Property property = this.property();
|
|
if (property.getTypeAccess() != 7) {
|
|
}
|
|
break block4;
|
|
}
|
|
catch (RuntimeException runtimeException) {
|
|
if (!log.isTraceOn()) continue;
|
|
log.trace(runtimeException.getMessage(), runtimeException);
|
|
}
|
|
continue;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean nextComponent() {
|
|
while (++this.index < this.count) {
|
|
block4: {
|
|
try {
|
|
Property property = this.property();
|
|
if (property.getTypeAccess() != 7) continue;
|
|
if (!this.object.get(property).isComponent()) {
|
|
}
|
|
break block4;
|
|
}
|
|
catch (RuntimeException runtimeException) {
|
|
if (!log.isTraceOn()) continue;
|
|
log.trace(runtimeException.getMessage(), runtimeException);
|
|
}
|
|
continue;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean next(Class clazz) {
|
|
while (++this.index < this.count) {
|
|
block4: {
|
|
try {
|
|
Property property = this.property();
|
|
if (property.getTypeAccess() != 7) continue;
|
|
if (!clazz.isInstance(this.object.get(property))) {
|
|
}
|
|
break block4;
|
|
}
|
|
catch (RuntimeException runtimeException) {
|
|
runtimeException.printStackTrace();
|
|
}
|
|
continue;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final Slot slot() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.frozen[this.index];
|
|
}
|
|
return this.dynamic.slots[this.index - this.frozen.length];
|
|
}
|
|
|
|
public final Property property() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.frozen[this.index];
|
|
}
|
|
return this.dynamic.slots[this.index - this.frozen.length];
|
|
}
|
|
|
|
public final int getTypeAccess() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.frozen[this.index].typeAccess;
|
|
}
|
|
return this.dynamic.slots[this.index - this.frozen.length].typeAccess;
|
|
}
|
|
|
|
public final BObject get() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.get(this.frozen[this.index]);
|
|
}
|
|
return this.object.get(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final boolean getBoolean() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getBoolean(this.frozen[this.index]);
|
|
}
|
|
return this.object.getBoolean(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final int getInt() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getInt(this.frozen[this.index]);
|
|
}
|
|
return this.object.getInt(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final long getLong() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getLong(this.frozen[this.index]);
|
|
}
|
|
return this.object.getLong(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final float getFloat() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getFloat(this.frozen[this.index]);
|
|
}
|
|
return this.object.getFloat(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final double getDouble() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getDouble(this.frozen[this.index]);
|
|
}
|
|
return this.object.getDouble(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final String getString() {
|
|
if (this.index < this.frozen.length) {
|
|
return this.object.getString(this.frozen[this.index]);
|
|
}
|
|
return this.object.getString(this.dynamic.slots[this.index - this.frozen.length]);
|
|
}
|
|
|
|
public final Action action() {
|
|
Slot slot = this.slot();
|
|
if (slot.isAction()) {
|
|
return slot.asAction();
|
|
}
|
|
throw new CursorException("not action");
|
|
}
|
|
|
|
public final Topic topic() {
|
|
Slot slot = this.slot();
|
|
if (slot.isTopic()) {
|
|
return slot.asTopic();
|
|
}
|
|
throw new CursorException("not topic");
|
|
}
|
|
|
|
PropertyCursor(BComplex bComplex, NProperty[] nPropertyArray, DynamicTable dynamicTable) {
|
|
this.object = bComplex;
|
|
this.frozen = nPropertyArray;
|
|
this.dynamic = dynamicTable;
|
|
this.count = dynamicTable == null ? nPropertyArray.length : nPropertyArray.length + dynamicTable.count;
|
|
}
|
|
}
|
|
|