212 lines
6.2 KiB
Java
212 lines
6.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.schema;
|
|
|
|
import com.tridium.sys.schema.NProperty;
|
|
import javax.baja.sys.Property;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
final class DynamicTable {
|
|
static final NProperty[] EMPTY = new NProperty[0];
|
|
final int baseIndex;
|
|
NProperty[] slots;
|
|
NProperty[] alpha;
|
|
int count;
|
|
|
|
final NProperty get(String string) {
|
|
NProperty[] nPropertyArray = this.alpha;
|
|
int n = -1;
|
|
int n2 = this.count;
|
|
while (n2 - n > 1) {
|
|
int n3 = (n2 + n) / 2;
|
|
int n4 = string.compareTo(nPropertyArray[n3].name);
|
|
if (n4 < 0) {
|
|
n2 = n3;
|
|
continue;
|
|
}
|
|
if (n4 > 0) {
|
|
n = n3;
|
|
continue;
|
|
}
|
|
return nPropertyArray[n3];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
final void put(NProperty nProperty) {
|
|
NProperty nProperty2;
|
|
if (this.slots.length <= this.count) {
|
|
this.ensureCapacity(Math.max(8, this.count * 2));
|
|
}
|
|
if ((nProperty2 = this.insert(nProperty)) != null) {
|
|
int n = nProperty2.index - this.baseIndex;
|
|
System.arraycopy(this.slots, n + 1, this.slots, n, this.count - n - 1);
|
|
--this.count;
|
|
}
|
|
this.slots[this.count] = nProperty;
|
|
++this.count;
|
|
this.updateIndices();
|
|
}
|
|
|
|
private final NProperty insert(NProperty nProperty) {
|
|
NProperty[] nPropertyArray = this.alpha;
|
|
String string = nProperty.name;
|
|
if (this.count == 0) {
|
|
nPropertyArray[0] = nProperty;
|
|
return null;
|
|
}
|
|
if (this.count == 1) {
|
|
int n = string.compareTo(nPropertyArray[0].name);
|
|
if (n == 0) {
|
|
NProperty nProperty2 = nPropertyArray[0];
|
|
nPropertyArray[0] = nProperty;
|
|
return nProperty2;
|
|
}
|
|
if (n < 0) {
|
|
nPropertyArray[1] = nPropertyArray[0];
|
|
nPropertyArray[0] = nProperty;
|
|
} else {
|
|
nPropertyArray[1] = nProperty;
|
|
}
|
|
return null;
|
|
}
|
|
int n = 0;
|
|
int n2 = this.count - 1;
|
|
int n3 = (n2 - n) / 2;
|
|
while (n <= n2) {
|
|
int n4 = string.compareTo(nPropertyArray[n3].name);
|
|
if (n4 == 0) {
|
|
NProperty nProperty3 = nPropertyArray[n3];
|
|
nPropertyArray[n3] = nProperty;
|
|
return nProperty3;
|
|
}
|
|
if (n4 < 0) {
|
|
n4 = string.compareTo(nPropertyArray[n].name);
|
|
if (n4 == 0) {
|
|
NProperty nProperty4 = nPropertyArray[n];
|
|
nPropertyArray[n] = nProperty;
|
|
return nProperty4;
|
|
}
|
|
if (n4 < 0) {
|
|
n3 = n;
|
|
break;
|
|
}
|
|
n2 = n3 - 1;
|
|
} else {
|
|
n4 = string.compareTo(nPropertyArray[n2].name);
|
|
if (n4 == 0) {
|
|
NProperty nProperty5 = nPropertyArray[n2];
|
|
nPropertyArray[n2] = nProperty;
|
|
return nProperty5;
|
|
}
|
|
if (n4 > 0) {
|
|
n3 = n2 + 1;
|
|
break;
|
|
}
|
|
n = n3 + 1;
|
|
}
|
|
n3 = n + (n2 - n) / 2;
|
|
}
|
|
System.arraycopy(nPropertyArray, n3, nPropertyArray, n3 + 1, this.count - n3);
|
|
nPropertyArray[n3] = nProperty;
|
|
return null;
|
|
}
|
|
|
|
final void remove(NProperty nProperty) {
|
|
this.remove(nProperty.name);
|
|
int n = nProperty.index - this.baseIndex;
|
|
System.arraycopy(this.slots, n + 1, this.slots, n, this.count - n - 1);
|
|
this.slots[this.count - 1] = null;
|
|
--this.count;
|
|
this.updateIndices();
|
|
}
|
|
|
|
final void reorder(Property[] propertyArray) {
|
|
System.arraycopy(propertyArray, 0, this.slots, 0, this.count);
|
|
this.updateIndices();
|
|
}
|
|
|
|
private final void remove(String string) {
|
|
NProperty[] nPropertyArray = this.alpha;
|
|
int n = -1;
|
|
int n2 = this.count;
|
|
while (n2 - n > 1) {
|
|
int n3 = (n2 + n) / 2;
|
|
int n4 = string.compareTo(nPropertyArray[n3].name);
|
|
if (n4 < 0) {
|
|
n2 = n3;
|
|
continue;
|
|
}
|
|
if (n4 > 0) {
|
|
n = n3;
|
|
continue;
|
|
}
|
|
System.arraycopy(nPropertyArray, n3 + 1, nPropertyArray, n3, this.count - n3 - 1);
|
|
nPropertyArray[this.count - 1] = null;
|
|
return;
|
|
}
|
|
throw new IllegalStateException(string);
|
|
}
|
|
|
|
final void copyInto(Object[] objectArray, int n) {
|
|
System.arraycopy(this.slots, 0, objectArray, n, this.count);
|
|
}
|
|
|
|
final void ensureCapacity(int n) {
|
|
if (this.alpha.length < n) {
|
|
NProperty[] nPropertyArray = new NProperty[n];
|
|
System.arraycopy(this.slots, 0, nPropertyArray, 0, this.count);
|
|
this.slots = nPropertyArray;
|
|
nPropertyArray = new NProperty[n];
|
|
System.arraycopy(this.alpha, 0, nPropertyArray, 0, this.count);
|
|
this.alpha = nPropertyArray;
|
|
}
|
|
}
|
|
|
|
final void clear() {
|
|
this.slots = EMPTY;
|
|
this.alpha = EMPTY;
|
|
this.count = 0;
|
|
}
|
|
|
|
final boolean equivalent(DynamicTable dynamicTable) {
|
|
if (dynamicTable == null) {
|
|
return false;
|
|
}
|
|
if (this.count != dynamicTable.count) {
|
|
return false;
|
|
}
|
|
int n = 0;
|
|
while (n < this.count) {
|
|
if (!this.alpha[n].equivalent(dynamicTable.alpha[n])) {
|
|
return false;
|
|
}
|
|
++n;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private final void updateIndices() {
|
|
int n = 0;
|
|
while (n < this.count) {
|
|
this.slots[n].index = this.baseIndex + n;
|
|
++n;
|
|
}
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.slots = EMPTY;
|
|
this.alpha = EMPTY;
|
|
this.count = 0;
|
|
}
|
|
|
|
DynamicTable(int n) {
|
|
this.this();
|
|
this.baseIndex = n;
|
|
}
|
|
}
|
|
|