alexandroid/decompiled/jadx/sources/com/google/protobuf/TextFormatParseInfoTree.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

100 lines
4.5 KiB
Java

package com.google.protobuf;
import com.amazon.alexa.mobilytics.configuration.DefaultRecordChecker;
import com.google.protobuf.Descriptors;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes8.dex */
public class TextFormatParseInfoTree {
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> locationsFromField;
Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree>> subtreesFromField;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class Builder {
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> locationsFromField;
private Map<Descriptors.FieldDescriptor, List<Builder>> subtreeBuildersFromField;
private Builder() {
this.locationsFromField = new HashMap();
this.subtreeBuildersFromField = new HashMap();
}
public TextFormatParseInfoTree build() {
return new TextFormatParseInfoTree(this.locationsFromField, this.subtreeBuildersFromField);
}
public Builder getBuilderForSubMessageField(Descriptors.FieldDescriptor fieldDescriptor) {
List<Builder> list = this.subtreeBuildersFromField.get(fieldDescriptor);
if (list == null) {
list = new ArrayList<>();
this.subtreeBuildersFromField.put(fieldDescriptor, list);
}
Builder builder = new Builder();
list.add(builder);
return builder;
}
public Builder setLocation(Descriptors.FieldDescriptor fieldDescriptor, TextFormatParseLocation textFormatParseLocation) {
List<TextFormatParseLocation> list = this.locationsFromField.get(fieldDescriptor);
if (list == null) {
list = new ArrayList<>();
this.locationsFromField.put(fieldDescriptor, list);
}
list.add(textFormatParseLocation);
return this;
}
}
private TextFormatParseInfoTree(Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> map, Map<Descriptors.FieldDescriptor, List<Builder>> map2) {
HashMap hashMap = new HashMap();
for (Map.Entry<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> entry : map.entrySet()) {
hashMap.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
}
this.locationsFromField = Collections.unmodifiableMap(hashMap);
HashMap hashMap2 = new HashMap();
for (Map.Entry<Descriptors.FieldDescriptor, List<Builder>> entry2 : map2.entrySet()) {
ArrayList arrayList = new ArrayList();
Iterator<Builder> it2 = entry2.getValue().iterator();
while (it2.hasNext()) {
arrayList.add(it2.next().build());
}
hashMap2.put(entry2.getKey(), Collections.unmodifiableList(arrayList));
}
this.subtreesFromField = Collections.unmodifiableMap(hashMap2);
}
public static Builder builder() {
return new Builder();
}
private static <T> T getFromList(List<T> list, int i, Descriptors.FieldDescriptor fieldDescriptor) {
if (i >= list.size() || i < 0) {
throw new IllegalArgumentException(String.format("Illegal index field: %s, index %d", fieldDescriptor == null ? DefaultRecordChecker.Regex.EMPTY : fieldDescriptor.getName(), Integer.valueOf(i)));
}
return list.get(i);
}
public TextFormatParseLocation getLocation(Descriptors.FieldDescriptor fieldDescriptor, int i) {
return (TextFormatParseLocation) getFromList(getLocations(fieldDescriptor), i, fieldDescriptor);
}
public List<TextFormatParseLocation> getLocations(Descriptors.FieldDescriptor fieldDescriptor) {
List<TextFormatParseLocation> list = this.locationsFromField.get(fieldDescriptor);
return list == null ? Collections.EMPTY_LIST : list;
}
public TextFormatParseInfoTree getNestedTree(Descriptors.FieldDescriptor fieldDescriptor, int i) {
return (TextFormatParseInfoTree) getFromList(getNestedTrees(fieldDescriptor), i, fieldDescriptor);
}
public List<TextFormatParseInfoTree> getNestedTrees(Descriptors.FieldDescriptor fieldDescriptor) {
List<TextFormatParseInfoTree> list = this.subtreesFromField.get(fieldDescriptor);
return list == null ? Collections.EMPTY_LIST : list;
}
}