jimu-decompiled/sources/com/ubt/jimu/controller/data/action/ActionSequence.java
2025-05-13 19:24:51 +02:00

211 lines
5.6 KiB
Java

package com.ubt.jimu.controller.data.action;
import android.text.TextUtils;
import android.util.SparseArray;
import com.ubt.jimu.base.data.Engine;
import com.ubt.jimu.base.data.Motor;
import com.ubt.jimu.base.data.Servo;
import com.ubt.jimu.base.data.ServoMode;
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/* loaded from: classes.dex */
public class ActionSequence {
private static final HashMap<String, Integer> k = new HashMap<>();
private String a;
private String b;
private String c;
private List<Action> d;
private String e;
private SparseArray<String> f;
private long g;
private boolean h = false;
private int i;
private String j;
static {
k.put(Locale.CHINESE.getLanguage(), 0);
k.put("zh-hans", 0);
k.put(Locale.ENGLISH.getLanguage(), 1);
k.put(Locale.JAPANESE.getLanguage(), 2);
k.put(Locale.KOREAN.getLanguage(), 3);
k.put(Locale.GERMAN.getLanguage(), 4);
k.put(Locale.ITALIAN.getLanguage(), 5);
k.put(Locale.FRENCH.getLanguage(), 6);
k.put("es", 7);
k.put("pt", 8);
k.put("zh-hant", 9);
k.put("ar", 10);
k.put("ru", 11);
k.put("pl", 12);
k.put("tr", 13);
k.put("da", 14);
k.put("th", 15);
k.put(JockstickDataConverter.ID, 16);
}
public void a(int i) {
this.i = i;
}
public void b(String str) {
this.e = str;
}
public void c(String str) {
this.c = str;
}
public int d() {
return this.i;
}
public void e(String str) {
this.a = str;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ActionSequence)) {
return false;
}
ActionSequence actionSequence = (ActionSequence) obj;
String str = this.a;
if (str == null ? actionSequence.a != null : !str.equals(actionSequence.a)) {
return false;
}
String str2 = this.c;
String str3 = actionSequence.c;
return str2 != null ? str2.equals(str3) : str3 == null;
}
public void f(String str) {
this.b = str;
}
public String g() {
return this.j;
}
public String h() {
return this.a;
}
public int hashCode() {
String str = this.a;
int hashCode = (str != null ? str.hashCode() : 0) * 31;
String str2 = this.c;
return hashCode + (str2 != null ? str2.hashCode() : 0);
}
public List<Servo> i() {
List<Action> list = this.d;
if (list == null || list.size() <= 0) {
return null;
}
HashMap hashMap = new HashMap();
Iterator<Action> it = this.d.iterator();
while (it.hasNext()) {
Map<Integer, TurnData> e = it.next().e();
if (e != null && e.size() > 0) {
Iterator<Integer> it2 = e.keySet().iterator();
while (it2.hasNext()) {
int intValue = it2.next().intValue();
hashMap.put(Integer.valueOf(intValue), new Servo(intValue, ServoMode.SERVO_MODE_TURN));
}
}
}
if (hashMap.size() > 0) {
return new ArrayList(hashMap.values());
}
return null;
}
public boolean j() {
return this.h;
}
public String toString() {
return "ActionSequence{name='" + this.a + "', robotID='" + this.b + "', id='" + this.c + "', actions=" + this.d + ", icon='" + this.e + "', showName=" + this.f + ", createTime=" + this.g + ", isOfficial=" + this.h + ", iconResID=" + this.i + ", musicPath='" + this.j + "'}";
}
public List<Action> a() {
return this.d;
}
public long b() {
return this.g;
}
public String c() {
return this.e;
}
public void d(String str) {
this.j = str;
}
public String e() {
return this.c;
}
public List<Engine> f() {
List<Action> list = this.d;
if (list == null || list.size() <= 0) {
return null;
}
HashMap hashMap = new HashMap();
Iterator<Action> it = this.d.iterator();
while (it.hasNext()) {
Map<Integer, MotorData> b = it.next().b();
if (b != null && b.size() > 0) {
Iterator<Integer> it2 = b.keySet().iterator();
while (it2.hasNext()) {
int intValue = it2.next().intValue();
hashMap.put(Integer.valueOf(intValue), new Motor(intValue));
}
}
}
if (hashMap.size() > 0) {
return new ArrayList(hashMap.values());
}
return null;
}
public void a(Action action) {
if (this.d == null) {
this.d = new ArrayList();
}
this.d.add(action);
}
public void a(long j) {
this.g = j;
}
public void a(boolean z) {
this.h = z;
}
public void a(SparseArray<String> sparseArray) {
this.f = sparseArray;
}
public String a(String str) {
SparseArray<String> sparseArray;
Integer num = k.get(str);
if (num == null || (sparseArray = this.f) == null) {
return null;
}
String str2 = sparseArray.get(num.intValue());
return TextUtils.isEmpty(str2) ? this.f.get(k.get(Locale.ENGLISH.getLanguage()).intValue()) : str2;
}
}