package com.google.android.gms.vision; import android.util.SparseArray; import com.google.android.gms.vision.Detector; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* loaded from: classes2.dex */ public class MultiDetector extends Detector { private List> zzax; @Override // com.google.android.gms.vision.Detector public void release() { Iterator> it = this.zzax.iterator(); while (it.hasNext()) { it.next().release(); } this.zzax.clear(); } /* loaded from: classes2.dex */ public static class Builder { private MultiDetector zzay = new MultiDetector(); public Builder add(Detector detector) { this.zzay.zzax.add(detector); return this; } public MultiDetector build() { if (this.zzay.zzax.size() != 0) { return this.zzay; } throw new RuntimeException("No underlying detectors added to MultiDetector."); } } @Override // com.google.android.gms.vision.Detector public SparseArray detect(Frame frame) { SparseArray sparseArray = new SparseArray<>(); Iterator> it = this.zzax.iterator(); while (it.hasNext()) { SparseArray detect = it.next().detect(frame); for (int i = 0; i < detect.size(); i++) { int keyAt = detect.keyAt(i); if (sparseArray.get(keyAt) != null) { StringBuilder sb = new StringBuilder(104); sb.append("Detection ID overlap for id = "); sb.append(keyAt); sb.append(" This means that one of the detectors is not using global IDs."); throw new IllegalStateException(sb.toString()); } sparseArray.append(keyAt, detect.valueAt(i)); } } return sparseArray; } @Override // com.google.android.gms.vision.Detector public void receiveFrame(Frame frame) { Iterator> it = this.zzax.iterator(); while (it.hasNext()) { it.next().receiveFrame(frame); } } @Override // com.google.android.gms.vision.Detector public void setProcessor(Detector.Processor processor) { throw new UnsupportedOperationException("MultiDetector.setProcessor is not supported. You should set a processor instance on each underlying detector instead."); } @Override // com.google.android.gms.vision.Detector public boolean isOperational() { Iterator> it = this.zzax.iterator(); while (it.hasNext()) { if (!it.next().isOperational()) { return false; } } return true; } private MultiDetector() { this.zzax = new ArrayList(); } }