/* * Decompiled with CFR 0.152. * * Could not load the following classes: * javax.baja.sys.BObject * javax.baja.sys.BSimple * javax.baja.sys.Context * javax.baja.sys.Sys * javax.baja.sys.Type * javax.baja.util.BFormat */ package javax.baja.alarm; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; import java.util.StringTokenizer; 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; import javax.baja.util.BFormat; /* * Illegal identifiers - consider using --renameillegalidents true */ public final class BAlarmInstructions extends BSimple { public static final BAlarmInstructions NULL; public static final BAlarmInstructions DEFAULT; public static final Type TYPE; private int hashCode; private BFormat[] instructions; private String string; static /* synthetic */ Class class$javax$baja$alarm$BAlarmInstructions; public static final BAlarmInstructions make(BFormat bFormat) throws IOException { return new BAlarmInstructions(new BFormat[]{bFormat}, bFormat.encodeToString()); } public static final BAlarmInstructions make(BFormat[] bFormatArray) { if (bFormatArray.length == 0) { return NULL; } return new BAlarmInstructions((BFormat[])bFormatArray.clone(), null); } public static final BAlarmInstructions add(BAlarmInstructions bAlarmInstructions, BFormat bFormat) { BFormat[] bFormatArray = new BFormat[bAlarmInstructions.instructions.length + 1]; System.arraycopy(bAlarmInstructions.instructions, 0, bFormatArray, 0, bAlarmInstructions.instructions.length); bFormatArray[bFormatArray.length - 1] = bFormat; return new BAlarmInstructions(bFormatArray, null); } public static final BAlarmInstructions remove(BAlarmInstructions bAlarmInstructions, int n) { BFormat[] bFormatArray = new BFormat[bAlarmInstructions.instructions.length - 1]; System.arraycopy(bAlarmInstructions.instructions, 0, bFormatArray, 0, n); if (n < bAlarmInstructions.instructions.length) { System.arraycopy(bAlarmInstructions.instructions, n + 1, bFormatArray, n, bAlarmInstructions.instructions.length - n - 1); } return new BAlarmInstructions(bFormatArray, null); } public static final BAlarmInstructions make(String string) { return (BAlarmInstructions)DEFAULT.decodeFromString(string); } public final BFormat get(int n) { return this.instructions[n]; } public final int size() { return this.instructions.length; } public final boolean isNull() { boolean bl = false; if (this.instructions.length == 0) { bl = true; } return bl; } public final BFormat[] toArray() { return (BFormat[])this.instructions.clone(); } public final int hashCode() { if (this.hashCode == -1) { int n = 11; int n2 = 0; while (n2 < this.instructions.length) { n ^= this.instructions[n2].hashCode(); ++n2; } this.hashCode = n; } return this.hashCode; } public final boolean equals(Object object) { if (object instanceof BAlarmInstructions) { BFormat[] bFormatArray = this.instructions; BFormat[] bFormatArray2 = ((BAlarmInstructions)((Object)object)).instructions; if (bFormatArray.length != bFormatArray2.length) { return false; } int n = 0; while (n < bFormatArray.length) { if (!bFormatArray[n].equals((Object)bFormatArray2[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() throws IOException { if (this.string == null) { if (this.instructions.length == 1) { this.string = this.instructions[0].encodeToString(); } else { StringBuffer stringBuffer = new StringBuffer(); int n = 0; while (n < this.instructions.length) { if (n > 0) { stringBuffer.append('\n'); } stringBuffer.append(this.instructions[n].encodeToString()); ++n; } this.string = stringBuffer.toString(); } } return this.string; } public final BObject decodeFromString(String string) { if (string.length() == 0) { return DEFAULT; } int n = string.indexOf(10); if (n < 0) { return new BAlarmInstructions(new BFormat[]{BFormat.make((String)string)}, string); } ArrayList arrayList = new ArrayList(); StringTokenizer stringTokenizer = new StringTokenizer(string, "\n"); while (stringTokenizer.hasMoreTokens()) { arrayList.add(BFormat.make((String)stringTokenizer.nextToken())); } BFormat[] bFormatArray = arrayList.toArray(new BFormat[arrayList.size()]); return new BAlarmInstructions(bFormatArray, string); } public final String toString(Context context) { if (this.instructions.length == 1) { return this.instructions[0].toString(context); } StringBuffer stringBuffer = new StringBuffer(); int n = 0; while (n < this.instructions.length) { if (n > 0) { stringBuffer.append("; "); } stringBuffer.append(this.instructions[n].toString(context)); ++n; } return stringBuffer.toString(); } 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; } private BAlarmInstructions(BFormat[] bFormatArray, String string) { this.this(); this.instructions = bFormatArray; this.string = string; } static { DEFAULT = NULL = new BAlarmInstructions(new BFormat[0], ""); Class clazz = class$javax$baja$alarm$BAlarmInstructions; if (clazz == null) { clazz = class$javax$baja$alarm$BAlarmInstructions = BAlarmInstructions.class("[Ljavax.baja.alarm.BAlarmInstructions;", false); } TYPE = Sys.loadType((Class)clazz); } }