link start!
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import javax.baja.category.BCategoryMode;
|
||||
import javax.baja.category.BCategoryService;
|
||||
import javax.baja.status.BIStatus;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BCategory
|
||||
extends BComponent
|
||||
implements BIStatus {
|
||||
public static final Property status = BCategory.newProperty(3, BStatus.disabled, null);
|
||||
public static final Property index = BCategory.newProperty(64, 0, BFacets.makeInt(0, 100));
|
||||
public static final Property mode = BCategory.newProperty(0, BCategoryMode.union, null);
|
||||
public static final Property faultCause = BCategory.newProperty(3, "", null);
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$javax$baja$category$BCategory;
|
||||
|
||||
public final BStatus getStatus() {
|
||||
return (BStatus)this.get(status);
|
||||
}
|
||||
|
||||
public final void setStatus(BStatus bStatus) {
|
||||
this.set(status, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public final int getIndex() {
|
||||
return this.getInt(index);
|
||||
}
|
||||
|
||||
public final void setIndex(int n) {
|
||||
this.setInt(index, n, null);
|
||||
}
|
||||
|
||||
public final BCategoryMode getMode() {
|
||||
return (BCategoryMode)this.get(mode);
|
||||
}
|
||||
|
||||
public final void setMode(BCategoryMode bCategoryMode) {
|
||||
this.set(mode, (BValue)bCategoryMode, null);
|
||||
}
|
||||
|
||||
public final String getFaultCause() {
|
||||
return this.getString(faultCause);
|
||||
}
|
||||
|
||||
public final void setFaultCause(String string) {
|
||||
this.setString(faultCause, string, null);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property == index && this.getParent() instanceof BCategoryService) {
|
||||
((BCategoryService)this.getParent()).rebuildLookup();
|
||||
}
|
||||
}
|
||||
|
||||
public final String toString(Context context) {
|
||||
return this.getDisplayName(context) + '[' + this.getIndex() + ']';
|
||||
}
|
||||
|
||||
public final BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$category$BCategory;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategory = BCategory.class("[Ljavax.baja.category.BCategory;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.std("category.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BCategoryMask
|
||||
extends BSimple {
|
||||
static HashMap cache = new HashMap();
|
||||
public static final BCategoryMask NULL = new BCategoryMask("");
|
||||
public static final BCategoryMask WILDCARD;
|
||||
public static final BCategoryMask DEFAULT;
|
||||
public static final Type TYPE;
|
||||
private String hex;
|
||||
static /* synthetic */ Class class$javax$baja$category$BCategoryMask;
|
||||
|
||||
public static final BCategoryMask or(BCategoryMask bCategoryMask, BCategoryMask bCategoryMask2) {
|
||||
int n;
|
||||
String string;
|
||||
int n2;
|
||||
String string2;
|
||||
if (bCategoryMask == WILDCARD || bCategoryMask2 == WILDCARD) {
|
||||
return WILDCARD;
|
||||
}
|
||||
if (bCategoryMask == bCategoryMask2) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
String string3 = bCategoryMask.hex;
|
||||
String string4 = bCategoryMask2.hex;
|
||||
int n3 = string3.length();
|
||||
int n4 = string4.length();
|
||||
if (n3 == 0) {
|
||||
return bCategoryMask2;
|
||||
}
|
||||
if (n4 == 0) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
if (n3 < n4) {
|
||||
string2 = string3;
|
||||
n2 = n3;
|
||||
string = string4;
|
||||
n = n4;
|
||||
} else {
|
||||
string2 = string4;
|
||||
n2 = n4;
|
||||
string = string3;
|
||||
n = n3;
|
||||
}
|
||||
char[] cArray = new char[n];
|
||||
int n5 = 0;
|
||||
int n6 = n - n2;
|
||||
int n7 = 0;
|
||||
while (n7 < n6) {
|
||||
cArray[n5++] = string.charAt(n7);
|
||||
++n7;
|
||||
}
|
||||
n7 = 0;
|
||||
while (n7 < n2) {
|
||||
int n8 = string2.charAt(n7);
|
||||
n8 = n8 <= 57 ? n8 - 48 : n8 - 97 + 10;
|
||||
int n9 = string.charAt(n7 + n6);
|
||||
n9 = n9 <= 57 ? n9 - 48 : n9 - 97 + 10;
|
||||
int n10 = n8 | n9;
|
||||
cArray[n5++] = n10 < 10 ? (char)(48 + n10) : (char)(97 + n10 - 10);
|
||||
++n7;
|
||||
}
|
||||
return BCategoryMask.make(new String(cArray));
|
||||
}
|
||||
|
||||
public static final BCategoryMask and(BCategoryMask bCategoryMask, BCategoryMask bCategoryMask2) {
|
||||
int n;
|
||||
String string;
|
||||
int n2;
|
||||
String string2;
|
||||
if (bCategoryMask == WILDCARD) {
|
||||
return bCategoryMask2;
|
||||
}
|
||||
if (bCategoryMask2 == WILDCARD) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
if (bCategoryMask == bCategoryMask2) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
String string3 = bCategoryMask.hex;
|
||||
String string4 = bCategoryMask2.hex;
|
||||
int n3 = string3.length();
|
||||
int n4 = string4.length();
|
||||
if (n3 == 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (n4 == 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (n3 < n4) {
|
||||
string2 = string3;
|
||||
n2 = n3;
|
||||
string = string4;
|
||||
n = n4;
|
||||
} else {
|
||||
string2 = string4;
|
||||
n2 = n4;
|
||||
string = string3;
|
||||
n = n3;
|
||||
}
|
||||
char[] cArray = new char[n2];
|
||||
int n5 = 0;
|
||||
int n6 = n - n2;
|
||||
int n7 = 0;
|
||||
while (n7 < n2) {
|
||||
int n8 = string2.charAt(n7);
|
||||
n8 = n8 <= 57 ? n8 - 48 : n8 - 97 + 10;
|
||||
int n9 = string.charAt(n7 + n6);
|
||||
n9 = n9 <= 57 ? n9 - 48 : n9 - 97 + 10;
|
||||
int n10 = n8 & n9;
|
||||
cArray[n5++] = n10 < 10 ? (char)(48 + n10) : (char)(97 + n10 - 10);
|
||||
++n7;
|
||||
}
|
||||
n7 = 0;
|
||||
while (n7 < cArray.length && cArray[n7] == '0') {
|
||||
++n7;
|
||||
}
|
||||
return BCategoryMask.make(new String(cArray, n7, cArray.length - n7));
|
||||
}
|
||||
|
||||
public static final BCategoryMask make(int[] nArray) {
|
||||
int n;
|
||||
int n2 = nArray.length;
|
||||
if (n2 == 0) {
|
||||
return NULL;
|
||||
}
|
||||
int n3 = 0;
|
||||
int n4 = 0;
|
||||
while (n4 < n2) {
|
||||
n = nArray[n4];
|
||||
if (n < 1) {
|
||||
throw new IllegalArgumentException("index < 1");
|
||||
}
|
||||
n3 = Math.max(n3, (n - 1) / 4);
|
||||
++n4;
|
||||
}
|
||||
char[] cArray = new char[n3 + 1];
|
||||
n = 0;
|
||||
while (n < cArray.length) {
|
||||
cArray[n] = 48;
|
||||
++n;
|
||||
}
|
||||
n = 0;
|
||||
while (n < n2) {
|
||||
int n5 = nArray[n];
|
||||
int n6 = --n5 / 4;
|
||||
int n7 = n5 % 4;
|
||||
int n8 = n3 - n6;
|
||||
char c = cArray[n8];
|
||||
int n9 = c <= '9' ? c - 48 : c - 97 + 10;
|
||||
cArray[n8] = (n9 |= 1 << n7) < 10 ? (char)(48 + n9) : (char)(97 + n9 - 10);
|
||||
++n;
|
||||
}
|
||||
return BCategoryMask.make(new String(cArray));
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public static final BCategoryMask make(String string) {
|
||||
int n = string.length();
|
||||
if (n == 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (n == 1 && string.charAt(0) == '*') {
|
||||
return WILDCARD;
|
||||
}
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
BCategoryMask bCategoryMask = (BCategoryMask)cache.get(string);
|
||||
if (bCategoryMask != null) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
if (n == 0) {
|
||||
throw new IllegalArgumentException("Length cannot be 0");
|
||||
}
|
||||
if (string.charAt(0) == '0') {
|
||||
throw new IllegalArgumentException("No leading zero allowed");
|
||||
}
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (!BCategoryMask.isValid(string.charAt(n2))) {
|
||||
throw new IllegalArgumentException("Invalid char " + string.charAt(n2));
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
bCategoryMask = new BCategoryMask(string);
|
||||
cache.put(string, bCategoryMask);
|
||||
return bCategoryMask;
|
||||
}
|
||||
}
|
||||
|
||||
static final boolean isValid(int n) {
|
||||
boolean bl = false;
|
||||
if (48 <= n && n <= 57 || 97 <= n && n <= 102) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isNull() {
|
||||
boolean bl = false;
|
||||
if (this == NULL) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isWildcard() {
|
||||
boolean bl = false;
|
||||
if (this == WILDCARD) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final int size() {
|
||||
int n = this.hex.length() * 4;
|
||||
if (n > 0) {
|
||||
int n2;
|
||||
char c = this.hex.charAt(0);
|
||||
int n3 = n2 = c <= '9' ? c - 48 : c - 97 + 10;
|
||||
if ((n2 & 8) != 0) {
|
||||
return n;
|
||||
}
|
||||
if ((n2 & 4) != 0) {
|
||||
return n - 1;
|
||||
}
|
||||
if ((n2 & 2) != 0) {
|
||||
return n - 2;
|
||||
}
|
||||
if ((n2 & 1) != 0) {
|
||||
return n - 3;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public final boolean get(int n) {
|
||||
if (n < 1) {
|
||||
throw new IllegalArgumentException("index < 1");
|
||||
}
|
||||
if (this == WILDCARD) {
|
||||
return true;
|
||||
}
|
||||
int n2 = --n / 4;
|
||||
int n3 = n % 4;
|
||||
int n4 = this.hex.length();
|
||||
if (n2 >= n4) {
|
||||
return false;
|
||||
}
|
||||
char c = this.hex.charAt(n4 - n2 - 1);
|
||||
int n5 = c <= '9' ? c - 48 : c - 97 + 10;
|
||||
boolean bl = false;
|
||||
if ((n5 & 1 << n3) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return System.identityHashCode(this);
|
||||
}
|
||||
|
||||
public final boolean equals(Object object) {
|
||||
boolean bl = false;
|
||||
if (this == object) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final String toString(Context context) {
|
||||
return this.hex;
|
||||
}
|
||||
|
||||
public final void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeUTF(this.hex);
|
||||
}
|
||||
|
||||
public final BObject decode(DataInput dataInput) throws IOException {
|
||||
return BCategoryMask.make(dataInput.readUTF());
|
||||
}
|
||||
|
||||
public final String encodeToString() {
|
||||
return this.hex;
|
||||
}
|
||||
|
||||
public final BObject decodeFromString(String string) throws IOException {
|
||||
return BCategoryMask.make(string);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BCategoryMask(String string) {
|
||||
this.hex = string;
|
||||
}
|
||||
|
||||
static {
|
||||
cache.put("", NULL);
|
||||
WILDCARD = new BCategoryMask("*");
|
||||
cache.put("*", WILDCARD);
|
||||
DEFAULT = NULL;
|
||||
Class clazz = class$javax$baja$category$BCategoryMask;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategoryMask = BCategoryMask.class("[Ljavax.baja.category.BCategoryMask;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BCategoryMode
|
||||
extends BFrozenEnum {
|
||||
public static final int UNION = 0;
|
||||
public static final int INTERSECTION = 1;
|
||||
public static final BCategoryMode union = new BCategoryMode(0);
|
||||
public static final BCategoryMode intersection = new BCategoryMode(1);
|
||||
public static final Type TYPE;
|
||||
public static final BCategoryMode DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$category$BCategoryMode;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BCategoryMode make(int n) {
|
||||
return (BCategoryMode)union.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BCategoryMode make(String string) {
|
||||
return (BCategoryMode)union.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BCategoryMode(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$category$BCategoryMode;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategoryMode = BCategoryMode.class("[Ljavax.baja.category.BCategoryMode;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
DEFAULT = union;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import javax.baja.category.BCategory;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.category.BOrdToCategoryMap;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIService;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.NotRunningException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BCategoryService
|
||||
extends BComponent
|
||||
implements BIService {
|
||||
public static final Property ordMap = BCategoryService.newProperty(5, BOrdToCategoryMap.NULL, null);
|
||||
public static final Property updatePeriod = BCategoryService.newProperty(0, BRelTime.make(60000L), null);
|
||||
public static final Action update = BCategoryService.newAction(0, null);
|
||||
public static final Type TYPE;
|
||||
private static Type[] serviceTypes;
|
||||
private static final BIcon icon;
|
||||
static final BCategoryMask DEFAULT_MASK;
|
||||
BCategory[] lookup;
|
||||
UpdateThread thread;
|
||||
long lastUpdateTicks;
|
||||
long lastUpdateDuration;
|
||||
static /* synthetic */ Class class$javax$baja$category$BCategoryService;
|
||||
static /* synthetic */ Class class$javax$baja$category$BCategory;
|
||||
|
||||
public final BOrdToCategoryMap getOrdMap() {
|
||||
return (BOrdToCategoryMap)this.get(ordMap);
|
||||
}
|
||||
|
||||
public final void setOrdMap(BOrdToCategoryMap bOrdToCategoryMap) {
|
||||
this.set(ordMap, (BValue)bOrdToCategoryMap, null);
|
||||
}
|
||||
|
||||
public final BRelTime getUpdatePeriod() {
|
||||
return (BRelTime)this.get(updatePeriod);
|
||||
}
|
||||
|
||||
public final void setUpdatePeriod(BRelTime bRelTime) {
|
||||
this.set(updatePeriod, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public final void update() {
|
||||
this.invoke(update, null, null);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BCategoryService getService() {
|
||||
return (BCategoryService)Sys.getService(TYPE);
|
||||
}
|
||||
|
||||
public final BCategory[] getCategories() {
|
||||
Class clazz = class$javax$baja$category$BCategory;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategory = BCategoryService.class("[Ljavax.baja.category.BCategory;", false);
|
||||
}
|
||||
return (BCategory[])this.getChildren(clazz);
|
||||
}
|
||||
|
||||
public final int getMaxCategoryIndex() {
|
||||
if (!this.isRunning()) {
|
||||
throw new NotRunningException();
|
||||
}
|
||||
int n = this.lookup.length - 1;
|
||||
while (n > 0) {
|
||||
if (this.lookup[n] != null) {
|
||||
return n;
|
||||
}
|
||||
--n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final BCategory getCategory(int n) {
|
||||
if (!this.isRunning()) {
|
||||
throw new NotRunningException();
|
||||
}
|
||||
if (n >= this.lookup.length) {
|
||||
return null;
|
||||
}
|
||||
return this.lookup[n];
|
||||
}
|
||||
|
||||
public final BCategory[] getCategories(BCategoryMask bCategoryMask) {
|
||||
if (!this.isRunning()) {
|
||||
throw new NotRunningException();
|
||||
}
|
||||
int n = Math.min(bCategoryMask.size(), this.lookup.length) + 1;
|
||||
Class clazz = class$javax$baja$category$BCategory;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategory = BCategoryService.class("[Ljavax.baja.category.BCategory;", false);
|
||||
}
|
||||
Array array = new Array(clazz, n);
|
||||
int n2 = 1;
|
||||
while (n2 < n) {
|
||||
if (bCategoryMask.get(n2) && this.lookup[n2] != null) {
|
||||
array.add((Object)this.lookup[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return (BCategory[])array.trim();
|
||||
}
|
||||
|
||||
public final BCategoryMask getCategoryMask(BOrd bOrd) {
|
||||
BCategoryMask bCategoryMask;
|
||||
if (bOrd != null && !bOrd.isNull() && (bCategoryMask = this.getOrdMap().getCategoryMask(bOrd)) != null) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
return DEFAULT_MASK;
|
||||
}
|
||||
|
||||
public final BCategoryMask getAppliedCategoryMask(BOrd bOrd) {
|
||||
BCategoryMask bCategoryMask;
|
||||
if (bOrd != null && !bOrd.isNull() && (bCategoryMask = this.getOrdMap().getAppliedCategoryMask(bOrd)) != null) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
return DEFAULT_MASK;
|
||||
}
|
||||
|
||||
public final Type[] getServiceTypes() {
|
||||
return serviceTypes;
|
||||
}
|
||||
|
||||
public final void serviceStarted() throws Exception {
|
||||
}
|
||||
|
||||
public final void serviceStopped() throws Exception {
|
||||
}
|
||||
|
||||
public final void started() throws Exception {
|
||||
this.rebuildLookup();
|
||||
this.thread = new UpdateThread();
|
||||
this.thread.start();
|
||||
}
|
||||
|
||||
public final void stopped() throws Exception {
|
||||
this.lookup = null;
|
||||
if (this.thread != null) {
|
||||
this.thread.kill();
|
||||
}
|
||||
this.thread = null;
|
||||
}
|
||||
|
||||
public final void added(Property property, Context context) {
|
||||
super.added(property, context);
|
||||
if (this.isRunning()) {
|
||||
this.rebuildLookup();
|
||||
}
|
||||
}
|
||||
|
||||
public final void removed(Property property, BValue bValue, Context context) {
|
||||
super.removed(property, bValue, context);
|
||||
if (this.isRunning()) {
|
||||
this.rebuildLookup();
|
||||
}
|
||||
}
|
||||
|
||||
final void rebuildLookup() {
|
||||
BCategory[] bCategoryArray = new BCategory[16];
|
||||
SlotCursor slotCursor = this.getProperties();
|
||||
while (slotCursor.nextComponent()) {
|
||||
BObject bObject = slotCursor.get();
|
||||
if (!(bObject instanceof BCategory)) continue;
|
||||
BCategory bCategory = (BCategory)bObject;
|
||||
int n = bCategory.getIndex();
|
||||
if (n <= 0) {
|
||||
bCategory.setStatus(BStatus.disabled);
|
||||
bCategory.setFaultCause("");
|
||||
continue;
|
||||
}
|
||||
if (bCategoryArray.length <= n) {
|
||||
int n2 = Math.max(bCategoryArray.length * 2, n + 1);
|
||||
if (n2 < 10) {
|
||||
n2 = 10;
|
||||
}
|
||||
BCategory[] bCategoryArray2 = new BCategory[n2];
|
||||
System.arraycopy(bCategoryArray, 0, bCategoryArray2, 0, bCategoryArray.length);
|
||||
bCategoryArray = bCategoryArray2;
|
||||
}
|
||||
if (bCategoryArray[n] != null) {
|
||||
bCategory.setStatus(BStatus.fault);
|
||||
bCategory.setFaultCause("Duplicate index with " + bCategoryArray[n].getName());
|
||||
continue;
|
||||
}
|
||||
bCategory.setStatus(BStatus.ok);
|
||||
bCategory.setFaultCause("");
|
||||
bCategoryArray[n] = bCategory;
|
||||
}
|
||||
this.lookup = bCategoryArray;
|
||||
}
|
||||
|
||||
public final void doUpdate() {
|
||||
long l;
|
||||
long l2 = Clock.ticks();
|
||||
BCategoryMask[] bCategoryMaskArray = new BCategoryMask[256];
|
||||
int n = 0;
|
||||
while (n < bCategoryMaskArray.length) {
|
||||
bCategoryMaskArray[n] = BCategoryMask.NULL;
|
||||
++n;
|
||||
}
|
||||
ComponentSlotMap componentSlotMap = (ComponentSlotMap)Sys.getStation().fw(1);
|
||||
componentSlotMap.updateDeepOr(bCategoryMaskArray, 0);
|
||||
this.lastUpdateTicks = l = Clock.ticks();
|
||||
this.lastUpdateDuration = l - l2;
|
||||
}
|
||||
|
||||
public final BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public final void spy(SpyWriter spyWriter) throws Exception {
|
||||
if (this.lookup != null) {
|
||||
spyWriter.startProps("CategoryService");
|
||||
spyWriter.prop((Object)"lastUpdateTicks", BRelTime.toString(Clock.ticks() - this.lastUpdateTicks));
|
||||
spyWriter.prop((Object)"lastUpdateDuration", BRelTime.toString(this.lastUpdateDuration));
|
||||
spyWriter.endProps();
|
||||
spyWriter.startTable(true);
|
||||
spyWriter.trTitle("Lookup Table [" + this.lookup.length + ']', 2);
|
||||
int n = 0;
|
||||
while (n < this.lookup.length) {
|
||||
if (this.lookup[n] != null) {
|
||||
spyWriter.tr("" + n, this.lookup[n].getName());
|
||||
}
|
||||
++n;
|
||||
}
|
||||
spyWriter.endTable();
|
||||
}
|
||||
super.spy(spyWriter);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$category$BCategoryService;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BCategoryService = BCategoryService.class("[Ljavax.baja.category.BCategoryService;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
serviceTypes = new Type[]{TYPE};
|
||||
icon = BIcon.std("category.png");
|
||||
DEFAULT_MASK = BCategoryMask.make("1");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class UpdateThread
|
||||
extends Thread {
|
||||
boolean alive;
|
||||
|
||||
public void kill() {
|
||||
this.alive = false;
|
||||
this.interrupt();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (this.alive) {
|
||||
try {
|
||||
Thread.sleep(5000L);
|
||||
long l = BCategoryService.this.getUpdatePeriod().getMillis();
|
||||
if (l == 0L) continue;
|
||||
if (l < 1000L) {
|
||||
l = 1000L;
|
||||
}
|
||||
if (Clock.ticks() - BCategoryService.this.lastUpdateTicks < l) continue;
|
||||
BCategoryService.this.doUpdate();
|
||||
}
|
||||
catch (InterruptedException interruptedException) {
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.alive = true;
|
||||
}
|
||||
|
||||
UpdateThread() {
|
||||
super("CategoryService:Update");
|
||||
this.this();
|
||||
this.setDaemon(true);
|
||||
this.setPriority(this.getPriority() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BICategorizable
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BCategoryMask getAppliedCategoryMask();
|
||||
|
||||
public BCategoryMask getCategoryMask();
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$category$BICategorizable;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$category$BICategorizable = 1.class("[Ljavax.baja.category.BICategorizable;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package javax.baja.category;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.NullOrdException;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BOrdToCategoryMap
|
||||
extends BSimple {
|
||||
static final Comparator comparator = new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
int n;
|
||||
int n2 = object.toString().length();
|
||||
if (n2 == (n = object2.toString().length())) {
|
||||
return 0;
|
||||
}
|
||||
if (n2 < n) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
public static final BOrdToCategoryMap NULL;
|
||||
public static final BOrdToCategoryMap DEFAULT;
|
||||
public static final Type TYPE;
|
||||
private BOrd[] ords;
|
||||
private String[] ordStrings;
|
||||
private String[] ordSlashes;
|
||||
private BCategoryMask[] cats;
|
||||
private String string;
|
||||
private int hashCode;
|
||||
static /* synthetic */ Class class$javax$baja$category$BOrdToCategoryMap;
|
||||
|
||||
public static final BOrdToCategoryMap make(BOrd[] bOrdArray, BCategoryMask[] bCategoryMaskArray) {
|
||||
if (bOrdArray.length != bCategoryMaskArray.length) {
|
||||
throw new IllegalArgumentException("ords.length != masks.length");
|
||||
}
|
||||
if (bOrdArray.length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
bOrdArray = (BOrd[])bOrdArray.clone();
|
||||
bCategoryMaskArray = (BCategoryMask[])bCategoryMaskArray.clone();
|
||||
int n = 0;
|
||||
while (n < bOrdArray.length) {
|
||||
BOrd bOrd = bOrdArray[n];
|
||||
if (bOrd.isNull()) {
|
||||
throw new NullOrdException();
|
||||
}
|
||||
OrdQuery ordQuery = bOrd.parse()[0];
|
||||
if (ordQuery.isHost()) {
|
||||
throw new IllegalArgumentException("Cannot use host absolute ord: " + bOrd);
|
||||
}
|
||||
if (ordQuery.isSession()) {
|
||||
throw new IllegalArgumentException("Cannot use session absolute ord: " + bOrd);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
SortUtil.sort((Object[])bOrdArray, (Object[])bCategoryMaskArray, (Comparator)comparator);
|
||||
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, null).intern();
|
||||
}
|
||||
|
||||
public final BOrdToCategoryMap setCategoryMask(BOrd bOrd, BCategoryMask bCategoryMask) {
|
||||
int n = -1;
|
||||
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
|
||||
int n2 = this.ordStrings.length;
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
if (string.equals(this.ordStrings[n3])) {
|
||||
n = n3;
|
||||
break;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
BOrd[] bOrdArray = null;
|
||||
BCategoryMask[] bCategoryMaskArray = null;
|
||||
if (n != -1) {
|
||||
if (bCategoryMask == null || bCategoryMask.isNull()) {
|
||||
bOrdArray = (BOrd[])this.removeElement(this.ords, new BOrd[this.ords.length - 1], n);
|
||||
bCategoryMaskArray = (BCategoryMask[])this.removeElement(this.cats, new BCategoryMask[this.cats.length - 1], n);
|
||||
} else {
|
||||
if (this.cats[n].equals(bCategoryMask)) {
|
||||
return this;
|
||||
}
|
||||
bOrdArray = new BOrd[this.ords.length];
|
||||
System.arraycopy(this.ords, 0, bOrdArray, 0, this.ords.length);
|
||||
bOrdArray[n] = bOrd;
|
||||
bCategoryMaskArray = new BCategoryMask[this.cats.length];
|
||||
System.arraycopy(this.cats, 0, bCategoryMaskArray, 0, this.cats.length);
|
||||
bCategoryMaskArray[n] = bCategoryMask;
|
||||
}
|
||||
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, null).intern();
|
||||
}
|
||||
if (bCategoryMask != null && !bCategoryMask.isNull()) {
|
||||
bOrdArray = new BOrd[this.ords.length + 1];
|
||||
System.arraycopy(this.ords, 0, bOrdArray, 0, this.ords.length);
|
||||
bOrdArray[this.ords.length] = bOrd;
|
||||
bCategoryMaskArray = new BCategoryMask[this.cats.length + 1];
|
||||
System.arraycopy(this.cats, 0, bCategoryMaskArray, 0, this.cats.length);
|
||||
bCategoryMaskArray[this.cats.length] = bCategoryMask;
|
||||
return BOrdToCategoryMap.make(bOrdArray, bCategoryMaskArray);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final Object[] removeElement(Object[] objectArray, Object[] objectArray2, int n) {
|
||||
if (n == -1) {
|
||||
throw new ArrayIndexOutOfBoundsException("-1 is not a valid array index");
|
||||
}
|
||||
if (n == 0) {
|
||||
System.arraycopy(objectArray, 1, objectArray2, 0, objectArray.length - 1);
|
||||
} else if (n == objectArray.length - 1) {
|
||||
System.arraycopy(objectArray, 0, objectArray2, 0, objectArray.length - 1);
|
||||
} else {
|
||||
System.arraycopy(objectArray, 0, objectArray2, 0, n);
|
||||
System.arraycopy(objectArray, n + 1, objectArray2, n, objectArray.length - (n + 1));
|
||||
}
|
||||
return objectArray2;
|
||||
}
|
||||
|
||||
public final boolean isNull() {
|
||||
boolean bl = false;
|
||||
if (this == NULL) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final int size() {
|
||||
return this.ords.length;
|
||||
}
|
||||
|
||||
public final BOrd getOrd(int n) {
|
||||
return this.ords[n];
|
||||
}
|
||||
|
||||
public final BCategoryMask getCategoryMask(int n) {
|
||||
return this.cats[n];
|
||||
}
|
||||
|
||||
public final BCategoryMask getCategoryMask(BOrd bOrd) {
|
||||
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
|
||||
int n = this.ordStrings.length;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (string.equals(this.ordStrings[n2])) {
|
||||
return this.cats[n2];
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BCategoryMask getAppliedCategoryMask(BOrd bOrd) {
|
||||
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
|
||||
int n = this.ordSlashes.length;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (string.equals(this.ordStrings[n2])) {
|
||||
return this.cats[n2];
|
||||
}
|
||||
if (string.startsWith(this.ordSlashes[n2])) {
|
||||
return this.cats[n2];
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
try {
|
||||
if (this.hashCode == -1) {
|
||||
this.hashCode = this.encodeToString().hashCode();
|
||||
}
|
||||
return this.hashCode;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return System.identityHashCode(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean equals(Object object) {
|
||||
if (object instanceof BOrdToCategoryMap) {
|
||||
BOrdToCategoryMap bOrdToCategoryMap = (BOrdToCategoryMap)object;
|
||||
if (this.ords.length != bOrdToCategoryMap.ords.length) {
|
||||
return false;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < this.ords.length) {
|
||||
if (!this.ords[n].equals(bOrdToCategoryMap.ords[n])) {
|
||||
return false;
|
||||
}
|
||||
if (!this.cats[n].equals(bOrdToCategoryMap.cats[n])) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeUTF(this.encodeToString());
|
||||
}
|
||||
|
||||
public final BObject decode(DataInput dataInput) throws IOException {
|
||||
return this.decodeFromString(dataInput.readUTF());
|
||||
}
|
||||
|
||||
public final String encodeToString() {
|
||||
if (this.string == null) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < this.ords.length) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append('\n');
|
||||
}
|
||||
stringBuffer.append(this.ords[n].encodeToString()).append('=').append(this.cats[n]);
|
||||
++n;
|
||||
}
|
||||
this.string = stringBuffer.toString();
|
||||
}
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public final BObject decodeFromString(String string) throws IOException {
|
||||
String[] stringArray = TextUtil.split((String)string, (char)'\n');
|
||||
int n = stringArray.length;
|
||||
if (n == 0) {
|
||||
return NULL;
|
||||
}
|
||||
BOrd[] bOrdArray = new BOrd[n];
|
||||
BCategoryMask[] bCategoryMaskArray = new BCategoryMask[n];
|
||||
int n2 = 0;
|
||||
while (n2 < stringArray.length) {
|
||||
String string2 = stringArray[n2];
|
||||
int n3 = string2.lastIndexOf(61);
|
||||
bOrdArray[n2] = BOrd.make(string2.substring(0, n3));
|
||||
bCategoryMaskArray[n2] = BCategoryMask.make(string2.substring(n3 + 1));
|
||||
++n2;
|
||||
}
|
||||
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, string).intern();
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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.hashCode = -1;
|
||||
}
|
||||
|
||||
BOrdToCategoryMap(BOrd[] bOrdArray, BCategoryMask[] bCategoryMaskArray, String string) {
|
||||
this.this();
|
||||
this.ords = bOrdArray;
|
||||
this.cats = bCategoryMaskArray;
|
||||
this.string = string;
|
||||
int n = Integer.MAX_VALUE;
|
||||
this.ordStrings = new String[bOrdArray.length];
|
||||
this.ordSlashes = new String[bOrdArray.length];
|
||||
int n2 = 0;
|
||||
while (n2 < bOrdArray.length) {
|
||||
String string2;
|
||||
this.ordStrings[n2] = string2 = TextUtil.toLowerCase((String)bOrdArray[n2].encodeToString());
|
||||
this.ordSlashes[n2] = string2.endsWith("/") || string2.endsWith("^") || string2.endsWith("!") ? string2 : string2 + '/';
|
||||
int n3 = string2.length();
|
||||
if (n3 > n) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
n = n3;
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
DEFAULT = NULL = new BOrdToCategoryMap(new BOrd[0], new BCategoryMask[0], null);
|
||||
Class clazz = class$javax$baja$category$BOrdToCategoryMap;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$category$BOrdToCategoryMap = BOrdToCategoryMap.class("[Ljavax.baja.category.BOrdToCategoryMap;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user