home *** CD-ROM | disk | FTP | other *** search
- package netscape.util;
-
- public class ClassInfo {
- String className;
- int classCount;
- String[] classNames;
- int[] classVersions;
- int fieldCount;
- String[] fieldNames;
- byte[] fieldTypes;
-
- public ClassInfo(String var1) {
- this.className = var1;
- this.classNames = new String[8];
- this.classVersions = new int[8];
- this.fieldNames = new String[24];
- this.fieldTypes = new byte[24];
- }
-
- public void addClass(String var1, int var2) {
- this.ensureClassCapacity(this.classCount);
- this.classNames[this.classCount] = var1;
- this.classVersions[this.classCount] = var2;
- ++this.classCount;
- }
-
- public void addField(String var1, byte var2) {
- this.ensureFieldCapacity(this.fieldCount);
- this.fieldNames[this.fieldCount] = var1;
- this.fieldTypes[this.fieldCount] = var2;
- ++this.fieldCount;
- }
-
- public String className() {
- return this.className;
- }
-
- public int classCount() {
- return this.classCount;
- }
-
- public String[] classNames() {
- String[] var1 = new String[this.classCount];
- System.arraycopy(this.classNames, 0, var1, 0, this.classCount);
- return var1;
- }
-
- public int[] classVersions() {
- int[] var1 = new int[this.classCount];
- System.arraycopy(this.classVersions, 0, var1, 0, this.classCount);
- return var1;
- }
-
- public int fieldCount() {
- return this.fieldCount;
- }
-
- public String[] fieldNames() {
- String[] var1 = new String[this.fieldCount];
- System.arraycopy(this.fieldNames, 0, var1, 0, this.fieldCount);
- return var1;
- }
-
- public byte[] fieldTypes() {
- byte[] var1 = new byte[this.fieldCount];
- System.arraycopy(this.fieldTypes, 0, var1, 0, this.fieldCount);
- return var1;
- }
-
- protected void ensureClassCapacity(int var1) {
- if (var1 >= this.classNames.length) {
- int var2;
- if (this.classNames.length == 0) {
- var2 = 8;
- } else {
- var2 = 2 * this.classNames.length;
- }
-
- while(var2 < var1) {
- var2 = 2 * var2;
- }
-
- int var3 = this.classNames.length;
- String[] var4 = new String[var2];
- int[] var5 = new int[var2];
- System.arraycopy(this.classNames, 0, var4, 0, var3);
- System.arraycopy(this.classVersions, 0, var5, 0, var3);
- this.classNames = var4;
- this.classVersions = var5;
- }
- }
-
- protected void ensureFieldCapacity(int var1) {
- int var3 = this.fieldCapacityFor(var1);
- if (var3 >= 0) {
- int var4 = this.fieldNames.length;
- String[] var2 = new String[var3];
- byte[] var5 = new byte[var3];
- System.arraycopy(this.fieldNames, 0, var2, 0, var4);
- System.arraycopy(this.fieldTypes, 0, var5, 0, var4);
- this.fieldNames = var2;
- this.fieldTypes = var5;
- }
- }
-
- public int fieldCapacityFor(int var1) {
- int var2 = 0;
- if (var1 < this.fieldNames.length) {
- return -1;
- } else {
- if (this.fieldNames.length == 0) {
- var2 = 24;
- } else {
- var2 = 2 * this.fieldNames.length;
- }
-
- while(var2 < var1) {
- var2 = 2 * var2;
- }
-
- return var2;
- }
- }
- }
-