CrackMe.apk
Download file
package kotlin.reflect.jvm.internal.impl.protobuf;
import java.lang.Comparable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import kotlin.reflect.jvm.internal.impl.protobuf.FieldSet;
class SmallSortedMap<K extends Comparable<K>, V> extends AbstractMap<K, V> {
/* access modifiers changed from: private */
public List<SmallSortedMap<K, V>.Entry> entryList;
private boolean isImmutable;
private volatile SmallSortedMap<K, V>.EntrySet lazyEntrySet;
private final int maxArraySize;
/* access modifiers changed from: private */
public Map<K, V> overflowEntries;
static <FieldDescriptorType extends FieldSet.FieldDescriptorLite<FieldDescriptorType>> SmallSortedMap<FieldDescriptorType, Object> newFieldMap(int i) {
return new SmallSortedMap<FieldDescriptorType, Object>(i) {
public /* bridge */ /* synthetic */ Object put(Object obj, Object obj2) {
return SmallSortedMap.super.put((FieldSet.FieldDescriptorLite) obj, obj2);
}
public void makeImmutable() {
if (!isImmutable()) {
for (int i = 0; i < getNumArrayEntries(); i++) {
Map.Entry arrayEntryAt = getArrayEntryAt(i);
if (((FieldSet.FieldDescriptorLite) arrayEntryAt.getKey()).isRepeated()) {
arrayEntryAt.setValue(Collections.unmodifiableList((List) arrayEntryAt.getValue()));
}
}
for (Map.Entry entry : getOverflowEntries()) {
if (((FieldSet.FieldDescriptorLite) entry.getKey()).isRepeated()) {
entry.setValue(Collections.unmodifiableList((List) entry.getValue()));
}
}
}
SmallSortedMap.super.makeImmutable();
}
};
}
private SmallSortedMap(int i) {
this.maxArraySize = i;
this.entryList = Collections.emptyList();
this.overflowEntries = Collections.emptyMap();
}
public void makeImmutable() {
if (!this.isImmutable) {
this.overflowEntries = this.overflowEntries.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(this.overflowEntries);
this.isImmutable = true;
}
}
public boolean isImmutable() {
return this.isImmutable;
}
public int getNumArrayEntries() {
return this.entryList.size();
}
public Map.Entry<K, V> getArrayEntryAt(int i) {
return this.entryList.get(i);
}
public Iterable<Map.Entry<K, V>> getOverflowEntries() {
return this.overflowEntries.isEmpty() ? EmptySet.iterable() : this.overflowEntries.entrySet();
}
public int size() {
return this.entryList.size() + this.overflowEntries.size();
}
public boolean containsKey(Object obj) {
Comparable comparable = (Comparable) obj;
return binarySearchInArray(comparable) >= 0 || this.overflowEntries.containsKey(comparable);
}
public V get(Object obj) {
Comparable comparable = (Comparable) obj;
int binarySearchInArray = binarySearchInArray(comparable);
if (binarySearchInArray >= 0) {
return this.entryList.get(binarySearchInArray).getValue();
}
return this.overflowEntries.get(comparable);
}
public V put(K k, V v) {
checkMutable();
int binarySearchInArray = binarySearchInArray(k);
if (binarySearchInArray >= 0) {
return this.entryList.get(binarySearchInArray).setValue(v);
}
ensureEntryArrayMutable();
int i = -(binarySearchInArray + 1);
if (i >= this.maxArraySize) {
return getOverflowEntriesMutable().put(k, v);
}
int size = this.entryList.size();
int i2 = this.maxArraySize;
if (size == i2) {
Entry remove = this.entryList.remove(i2 - 1);
getOverflowEntriesMutable().put(remove.getKey(), remove.getValue());
}
this.entryList.add(i, new Entry(k, v));
return null;
}
public void clear() {
checkMutable();
if (!this.entryList.isEmpty()) {
this.entryList.clear();
}
if (!this.overflowEntries.isEmpty()) {
this.overflowEntries.clear();
}
}
public V remove(Object obj) {
checkMutable();
Comparable comparable = (Comparable) obj;
int binarySearchInArray = binarySearchInArray(comparable);
if (binarySearchInArray >= 0) {
return removeArrayEntryAt(binarySearchInArray);
}
if (this.overflowEntries.isEmpty()) {
return null;
}
return this.overflowEntries.remove(comparable);
}
/* access modifiers changed from: private */
public V removeArrayEntryAt(int i) {
checkMutable();
V value = this.entryList.remove(i).getValue();
if (!this.overflowEntries.isEmpty()) {
Iterator it = getOverflowEntriesMutable().entrySet().iterator();
this.entryList.add(new Entry(this, (Map.Entry) it.next()));
it.remove();
}
return value;
}
private int binarySearchInArray(K k) {
int size = this.entryList.size() - 1;
if (size >= 0) {
int compareTo = k.compareTo(this.entryList.get(size).getKey());
if (compareTo > 0) {
return -(size + 2);
}
if (compareTo == 0) {
return size;
}
}
int i = 0;
while (i <= size) {
int i2 = (i + size) / 2;
int compareTo2 = k.compareTo(this.entryList.get(i2).getKey());
if (compareTo2 < 0) {
size = i2 - 1;
} else if (compareTo2 <= 0) {
return i2;
} else {
i = i2 + 1;
}
}
return -(i + 1);
}
public Set<Map.Entry<K, V>> entrySet() {
if (this.lazyEntrySet == null) {
this.lazyEntrySet = new EntrySet();
}
return this.lazyEntrySet;
}
/* access modifiers changed from: private */
public void checkMutable() {
if (this.isImmutable) {
throw new UnsupportedOperationException();
}
}
private SortedMap<K, V> getOverflowEntriesMutable() {
checkMutable();
if (this.overflowEntries.isEmpty() && !(this.overflowEntries instanceof TreeMap)) {
this.overflowEntries = new TreeMap();
}
return (SortedMap) this.overflowEntries;
}
private void ensureEntryArrayMutable() {
checkMutable();
if (this.entryList.isEmpty() && !(this.entryList instanceof ArrayList)) {
this.entryList = new ArrayList(this.maxArraySize);
}
}
private class Entry implements Comparable<SmallSortedMap<K, V>.Entry>, Map.Entry<K, V> {
private final K key;
private V value;
Entry(SmallSortedMap smallSortedMap, Map.Entry<K, V> entry) {
this((Comparable) entry.getKey(), entry.getValue());
}
Entry(K k, V v) {
this.key = k;
this.value = v;
}
public K getKey() {
return this.key;
}
public V getValue() {
return this.value;
}
public int compareTo(SmallSortedMap<K, V>.Entry entry) {
return getKey().compareTo(entry.getKey());
}
public V setValue(V v) {
SmallSortedMap.this.checkMutable();
V v2 = this.value;
this.value = v;
return v2;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
if (!equals(this.key, entry.getKey()) || !equals(this.value, entry.getValue())) {
return false;
}
return true;
}
public int hashCode() {
K k = this.key;
int i = 0;
int hashCode = k == null ? 0 : k.hashCode();
V v = this.value;
if (v != null) {
i = v.hashCode();
}
return hashCode ^ i;
}
public String toString() {
String valueOf = String.valueOf(String.valueOf(this.key));
String valueOf2 = String.valueOf(String.valueOf(this.value));
StringBuilder sb = new StringBuilder(valueOf.length() + 1 + valueOf2.length());
sb.append(valueOf);
sb.append("=");
sb.append(valueOf2);
return sb.toString();
}
private boolean equals(Object obj, Object obj2) {
if (obj == null) {
return obj2 == null;
}
return obj.equals(obj2);
}
}
private class EntrySet extends AbstractSet<Map.Entry<K, V>> {
private EntrySet() {
}
public Iterator<Map.Entry<K, V>> iterator() {
return new EntryIterator();
}
public int size() {
return SmallSortedMap.this.size();
}
public boolean contains(Object obj) {
Map.Entry entry = (Map.Entry) obj;
Object obj2 = SmallSortedMap.this.get(entry.getKey());
Object value = entry.getValue();
return obj2 == value || (obj2 != null && obj2.equals(value));
}
public boolean add(Map.Entry<K, V> entry) {
if (contains(entry)) {
return false;
}
SmallSortedMap.this.put((Comparable) entry.getKey(), entry.getValue());
return true;
}
public boolean remove(Object obj) {
Map.Entry entry = (Map.Entry) obj;
if (!contains(entry)) {
return false;
}
SmallSortedMap.this.remove(entry.getKey());
return true;
}
public void clear() {
SmallSortedMap.this.clear();
}
}
private class EntryIterator implements Iterator<Map.Entry<K, V>> {
private Iterator<Map.Entry<K, V>> lazyOverflowIterator;
private boolean nextCalledBeforeRemove;
private int pos;
private EntryIterator() {
this.pos = -1;
}
public boolean hasNext() {
return this.pos + 1 < SmallSortedMap.this.entryList.size() || getOverflowIterator().hasNext();
}
public Map.Entry<K, V> next() {
this.nextCalledBeforeRemove = true;
int i = this.pos + 1;
this.pos = i;
if (i < SmallSortedMap.this.entryList.size()) {
return (Map.Entry) SmallSortedMap.this.entryList.get(this.pos);
}
return (Map.Entry) getOverflowIterator().next();
}
public void remove() {
if (this.nextCalledBeforeRemove) {
this.nextCalledBeforeRemove = false;
SmallSortedMap.this.checkMutable();
if (this.pos < SmallSortedMap.this.entryList.size()) {
SmallSortedMap smallSortedMap = SmallSortedMap.this;
int i = this.pos;
this.pos = i - 1;
Object unused = smallSortedMap.removeArrayEntryAt(i);
return;
}
getOverflowIterator().remove();
return;
}
throw new IllegalStateException("remove() was called before next()");
}
private Iterator<Map.Entry<K, V>> getOverflowIterator() {
if (this.lazyOverflowIterator == null) {
this.lazyOverflowIterator = SmallSortedMap.this.overflowEntries.entrySet().iterator();
}
return this.lazyOverflowIterator;
}
}
private static class EmptySet {
private static final Iterable<Object> ITERABLE = new Iterable<Object>() {
public Iterator<Object> iterator() {
return EmptySet.ITERATOR;
}
};
/* access modifiers changed from: private */
public static final Iterator<Object> ITERATOR = new Iterator<Object>() {
public boolean hasNext() {
return false;
}
public Object next() {
throw new NoSuchElementException();
}
public void remove() {
throw new UnsupportedOperationException();
}
};
static <T> Iterable<T> iterable() {
return ITERABLE;
}
}
}
Download file