// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.olio.data.object.assistant.rule; import android.content.ContentResolver; import android.net.Uri; import android.os.Parcel; import com.olio.communication.messages.MessagePayload; import com.olio.data.object.context.PersonalAssistantContext; import com.olio.olios.model.SerializedUserRecordMessagePayload; import com.olio.olios.model.record.DatabaseRecord; import com.olio.olios.model.record.SerializedRecord; import com.olio.util.ALog; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Objects; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; // Referenced classes of package com.olio.data.object.assistant.rule: // AutomaticReplyRule, RemindMeLaterRule, SilenceNotificationsRule, ContextContainer public abstract class Rule extends SerializedUserRecordMessagePayload { public static final android.os.Parcelable.Creator CREATOR = new android.os.Parcelable.Creator() { public MessagePayload createFromParcel(Parcel parcel) { return MessagePayload.unpackParcel(parcel); } public volatile Object createFromParcel(Parcel parcel) { return createFromParcel(parcel); } public MessagePayload[] newArray(int i) { return new Rule[i]; } public volatile Object[] newArray(int i) { return newArray(i); } }; public static final List ruleClasses; private static final long serialVersionUID = 0x25d4ac087b8ff211L; private boolean active; private List context; private boolean deletedKey; private boolean enabled; private long expiration; private String objectId; public Rule() { } public static List activeRulesMatchingContexts(List list, List list1) { ArrayList arraylist = new ArrayList(list.size()); list = list.iterator(); do { if (!list.hasNext()) { break; } Rule rule = (Rule)list.next(); if (rule.isEnabled() && doesRuleMatchContext(rule, list1)) { arraylist.add(rule); } } while (true); return arraylist; } private static boolean doesRuleMatchContext(Rule rule, List list) { rule = rule.getContext(); if (rule == null) { return false; } rule = rule.iterator(); ContextContainer contextcontainer; boolean flag; label0: do { if (rule.hasNext()) { contextcontainer = (ContextContainer)rule.next(); String s = contextcontainer.name; flag = false; Iterator iterator = list.iterator(); PersonalAssistantContext personalassistantcontext; do { do { if (!iterator.hasNext()) { continue label0; } personalassistantcontext = (PersonalAssistantContext)iterator.next(); } while (!Objects.equals(personalassistantcontext.getContextName(), s)); flag = true; } while (Objects.equals(personalassistantcontext.getContextValue(), contextcontainer.value)); return false; } else { return true; } } while (flag || Objects.equals(contextcontainer.value, "unknown")); return false; } public static List getAllRules(ContentResolver contentresolver) { contentresolver = SerializedRecord.allRecords(contentresolver); ArrayList arraylist = new ArrayList(); for (int i = 0; i < contentresolver.size(); i++) { SerializedRecord serializedrecord = (SerializedRecord)contentresolver.get(i); if (serializedrecord.getObject() instanceof Rule) { arraylist.add((Rule)serializedrecord.getObject()); } } return arraylist; } public static boolean isRuleType(String s) { return ruleClasses.contains(s); } public static void removeAllRules(ContentResolver contentresolver) { ALog.d("RemoveAllRules called", new Object[0]); for (Iterator iterator = ruleClasses.iterator(); iterator.hasNext(); SerializedRecord.deleteByType((String)iterator.next(), contentresolver)) { } } public static Uri tableUri() { return SerializedRecord.staticFactory().getRecordInstance().tableUri(); } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } else { Rule rule = (Rule)obj; return (new EqualsBuilder()).appendSuper(super.equals(obj)).append(enabled, rule.enabled).append(deletedKey, rule.deletedKey).append(active, rule.active).append(expiration, rule.expiration).append(context, rule.context).append(objectId, rule.objectId).isEquals(); } } public List getContext() { return context; } public int getEndPointsFlags() { return 5; } public long getExpiration() { return expiration; } public String getObjectId() { return objectId; } public int getSourcePointsFlags() { return 2; } public boolean hasVersionNumberControl() { return false; } public int hashCode() { return (new HashCodeBuilder(17, 37)).appendSuper(super.hashCode()).append(context).append(enabled).append(objectId).append(deletedKey).append(active).append(expiration).toHashCode(); } public boolean isActive() { return active; } public boolean isDeletedKey() { return deletedKey; } public boolean isEnabled() { return enabled; } public void setActive(boolean flag) { active = flag; } public void setContext(List list) { context = list; } public void setDeletedKey(boolean flag) { deletedKey = flag; } public void setEnabled(boolean flag) { enabled = flag; } public void setExpiration(long l) { expiration = l; } public void setObjectId(String s) { objectId = s; } public String toString() { return (new StringBuilder()).append("Rule{context=").append(context).append(", enabled=").append(enabled).append(", objectId='").append(objectId).append('\'').append(", deletedKey=").append(deletedKey).append(", active=").append(active).append(", expiration=").append(expiration).append('}').toString(); } public String typeName() { return getClass().getSimpleName(); } static { ruleClasses = Arrays.asList(new String[] { AutomaticReplyRule.TYPE_NAME, RemindMeLaterRule.TYPE_NAME, SilenceNotificationsRule.TYPE_NAME }); } }