280 lines
8.9 KiB
Java
280 lines
8.9 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.nre.util.Array
|
|
*/
|
|
package javax.baja.util;
|
|
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import javax.baja.nre.util.Array;
|
|
import javax.baja.sys.BFacets;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.BSimple;
|
|
import javax.baja.sys.BajaRuntimeException;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public final class BFacetsMap
|
|
extends BSimple {
|
|
public static final BFacetsMap NULL;
|
|
public static final BFacetsMap DEFAULT;
|
|
public static final Type TYPE;
|
|
private String string;
|
|
private HashMap map;
|
|
private int hashCode;
|
|
static /* synthetic */ Class class$javax$baja$util$BFacetsMap;
|
|
static /* synthetic */ Class class$java$lang$String;
|
|
|
|
public static final BFacetsMap make(HashMap hashMap) {
|
|
if (hashMap.size() == 0) {
|
|
return NULL;
|
|
}
|
|
String string = (String)hashMap.keySet().iterator().next();
|
|
if (!(hashMap.get(string) instanceof BFacets)) {
|
|
throw new IllegalStateException("map entry is not a BFacets");
|
|
}
|
|
return (BFacetsMap)new BFacetsMap((HashMap)hashMap.clone()).intern();
|
|
}
|
|
|
|
public static final BFacetsMap make(BFacetsMap bFacetsMap, String string, String string2) throws IOException {
|
|
return BFacetsMap.make(bFacetsMap, string, BFacets.make(string2));
|
|
}
|
|
|
|
public static final BFacetsMap make(BFacetsMap bFacetsMap, String string, BFacets bFacets) {
|
|
HashMap hashMap = (HashMap)bFacetsMap.map.clone();
|
|
hashMap.put(string, bFacets);
|
|
return (BFacetsMap)new BFacetsMap(hashMap).intern();
|
|
}
|
|
|
|
public static final BFacetsMap make(BFacetsMap bFacetsMap, BFacetsMap bFacetsMap2) {
|
|
HashMap hashMap = (HashMap)bFacetsMap.map.clone();
|
|
String[] stringArray = bFacetsMap2.list();
|
|
int n = 0;
|
|
while (n < stringArray.length) {
|
|
hashMap.put(stringArray[n], bFacetsMap2.get(stringArray[n]));
|
|
++n;
|
|
}
|
|
return (BFacetsMap)new BFacetsMap(hashMap).intern();
|
|
}
|
|
|
|
public static final BFacetsMap remove(BFacetsMap bFacetsMap, String string) {
|
|
HashMap hashMap = (HashMap)bFacetsMap.map.clone();
|
|
hashMap.remove(string);
|
|
return (BFacetsMap)new BFacetsMap(hashMap).intern();
|
|
}
|
|
|
|
public final String[] list() {
|
|
return this.map.keySet().toArray(new String[this.map.size()]);
|
|
}
|
|
|
|
public final BFacets get(String string) {
|
|
BFacets bFacets = (BFacets)this.map.get(string);
|
|
return bFacets == null ? BFacets.NULL : bFacets;
|
|
}
|
|
|
|
public final boolean isNull() {
|
|
boolean bl = false;
|
|
if (this.map.size() == 0) {
|
|
bl = true;
|
|
}
|
|
return bl;
|
|
}
|
|
|
|
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 BFacetsMap) {
|
|
BFacetsMap bFacetsMap = (BFacetsMap)object;
|
|
if (this.map.size() != bFacetsMap.map.size()) {
|
|
return false;
|
|
}
|
|
Iterator iterator = this.map.keySet().iterator();
|
|
while (iterator.hasNext()) {
|
|
String string = (String)iterator.next();
|
|
BFacets bFacets = (BFacets)this.map.get(string);
|
|
if (bFacets.equals(bFacetsMap.map.get(string))) continue;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final String toString(Context context) {
|
|
try {
|
|
return this.encodeToString();
|
|
}
|
|
catch (IOException iOException) {
|
|
throw new BajaRuntimeException(iOException);
|
|
}
|
|
}
|
|
|
|
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) {
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
stringBuffer.append('{');
|
|
Iterator iterator = this.map.keySet().iterator();
|
|
while (iterator.hasNext()) {
|
|
String string = (String)iterator.next();
|
|
BFacets bFacets = (BFacets)this.map.get(string);
|
|
this.escape(stringBuffer, string);
|
|
stringBuffer.append('=');
|
|
this.escape(stringBuffer, bFacets.encodeToString());
|
|
stringBuffer.append(';');
|
|
}
|
|
stringBuffer.append('}');
|
|
this.string = stringBuffer.toString();
|
|
}
|
|
return this.string;
|
|
}
|
|
|
|
public final BObject decodeFromString(String string) throws IOException {
|
|
try {
|
|
int n;
|
|
int n2 = string.indexOf(123);
|
|
int n3 = string.lastIndexOf(125);
|
|
if (n2 + 1 == n3) {
|
|
return NULL;
|
|
}
|
|
String string2 = string.substring(n2 + 1, n3);
|
|
Class clazz = class$java$lang$String;
|
|
if (clazz == null) {
|
|
clazz = class$java$lang$String = BFacetsMap.class("[Ljava.lang.String;", false);
|
|
}
|
|
Array array = new Array(clazz);
|
|
int n4 = string2.length();
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
int n5 = -1;
|
|
int n6 = 0;
|
|
while (n6 < n4) {
|
|
n = string2.charAt(n6);
|
|
if (n == 92) {
|
|
stringBuffer.append(string2.charAt(++n6));
|
|
} else if (n != 61 && n != 59) {
|
|
stringBuffer.append((char)n);
|
|
} else {
|
|
if (n == n5) {
|
|
throw new Exception();
|
|
}
|
|
n5 = n;
|
|
array.add((Object)stringBuffer.toString());
|
|
stringBuffer.setLength(0);
|
|
}
|
|
++n6;
|
|
}
|
|
HashMap<String, BFacets> hashMap = new HashMap<String, BFacets>();
|
|
n = 0;
|
|
while (n < array.size()) {
|
|
String string3 = (String)array.get(n);
|
|
BFacets bFacets = BFacets.make((String)array.get(n + '\u0001'));
|
|
hashMap.put(string3, bFacets);
|
|
n += 2;
|
|
}
|
|
BFacetsMap bFacetsMap = (BFacetsMap)new BFacetsMap(hashMap).intern();
|
|
bFacetsMap.string = string;
|
|
return bFacetsMap;
|
|
}
|
|
catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
throw new IOException("Invalid BFacetsMap: " + string);
|
|
}
|
|
}
|
|
|
|
private final void escape(StringBuffer stringBuffer, String string) {
|
|
int n = string.length();
|
|
int n2 = 0;
|
|
while (n2 < n) {
|
|
char c = string.charAt(n2);
|
|
switch (c) {
|
|
case '\\': {
|
|
stringBuffer.append("\\\\");
|
|
break;
|
|
}
|
|
case '{': {
|
|
stringBuffer.append("\\{");
|
|
break;
|
|
}
|
|
case '}': {
|
|
stringBuffer.append("\\}");
|
|
break;
|
|
}
|
|
case '=': {
|
|
stringBuffer.append("\\=");
|
|
break;
|
|
}
|
|
case ';': {
|
|
stringBuffer.append("\\;");
|
|
break;
|
|
}
|
|
default: {
|
|
stringBuffer.append(c);
|
|
}
|
|
}
|
|
++n2;
|
|
}
|
|
}
|
|
|
|
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 BFacetsMap(HashMap hashMap) {
|
|
this.this();
|
|
this.map = hashMap;
|
|
}
|
|
|
|
static {
|
|
DEFAULT = NULL = new BFacetsMap(new HashMap());
|
|
Class clazz = class$javax$baja$util$BFacetsMap;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$util$BFacetsMap = BFacetsMap.class("[Ljavax.baja.util.BFacetsMap;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
}
|
|
}
|
|
|