package com.twitter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; /* loaded from: classes.dex */ public class Extractor { protected boolean a = true; public List a(String str) { if (str != null && str.length() != 0) { if (str.indexOf(this.a ? 46 : 58) != -1) { ArrayList arrayList = new ArrayList(); Matcher matcher = Regex.f.matcher(str); while (matcher.find()) { if (matcher.group(4) != null || (this.a && !Regex.h.matcher(matcher.group(2)).matches())) { String group = matcher.group(3); int start = matcher.start(3); int end = matcher.end(3); Matcher matcher2 = Regex.g.matcher(group); if (matcher2.find()) { group = matcher2.group(); end = group.length() + start; } arrayList.add(new Entity(start, end, group, Entity.Type.URL)); } } return arrayList; } } return Collections.emptyList(); } public static class Entity { protected int a; protected int b; protected final String c; protected final Type d; public enum Type { URL, HASHTAG, MENTION, CASHTAG } public Entity(int i, int i2, String str, String str2, Type type) { this.a = i; this.b = i2; this.c = str; this.d = type; } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Entity)) { return false; } Entity entity = (Entity) obj; return this.d.equals(entity.d) && this.a == entity.a && this.b == entity.b && this.c.equals(entity.c); } public int hashCode() { return this.d.hashCode() + this.c.hashCode() + this.a + this.b; } public String toString() { return this.c + "(" + this.d + ") [" + this.a + "," + this.b + "]"; } public Entity(int i, int i2, String str, Type type) { this(i, i2, str, null, type); } } }