package com.kofax.kmc.ken.engines.ocr; import android.graphics.Rect; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import java.util.ArrayList; import java.util.Iterator; /* loaded from: classes3.dex */ public class OcrResultData { String hS; private ArrayList hT; String imageID; ErrorInfo resultCode; public String getText() { ae(); if (this.hT == null) { return null; } StringBuffer stringBuffer = new StringBuffer(); Iterator it = this.hT.iterator(); while (it.hasNext()) { OcrWord next = it.next(); StringBuilder sb = new StringBuilder(); sb.append(next.getText()); sb.append(" "); stringBuffer.append(sb.toString()); } return stringBuffer.toString(); } public OcrWord getWordAtPoint(int i, int i2) { ae(); ArrayList arrayList = this.hT; if (arrayList == null) { return null; } Iterator it = arrayList.iterator(); while (it.hasNext()) { OcrWord next = it.next(); if (new Rect(next.getX(), next.getY(), next.getX() + next.getWidth(), next.getY() + next.getHeight()).contains(i, i2)) { return next; } } return null; } public ArrayList getWordsinRect(int i, int i2, int i3, int i4) { ae(); if (this.hT == null) { return null; } ArrayList arrayList = new ArrayList<>(); Iterator it = this.hT.iterator(); while (it.hasNext()) { OcrWord next = it.next(); if (new Rect(i, i2, i3, i4).intersect(new Rect(next.getX(), next.getY(), next.getWidth() + next.getX(), next.getHeight() + next.getY()))) { arrayList.add(next); } } return arrayList; } public ArrayList getWords() { ae(); return (ArrayList) this.hT.clone(); } private void ae() { if (this.hT == null) { this.hT = (ArrayList) OcrEngine.ocrWords().clone(); } } }