/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.EntityManager
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.PersistentEntity
 */
package com.l7tech.server;

import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.EntityManager;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.server.EntityVersionChecker;
import com.l7tech.server.PeriodicVersionCheck;
import com.l7tech.server.event.EntityInvalidationEvent;
import java.util.ArrayList;
import java.util.List;

class b7
extends PeriodicVersionCheck {
    private final Class<? extends Entity> e;
    private List<Goid> f;
    private List<Character> g;
    final EntityVersionChecker this$0;
    private static final String i = b7.b(120, b7.b("\u0010ic=/q4\u001b h>|07\nssnmuz\u001aqr/c03\u0011 t'uu"));

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    private b7(EntityVersionChecker entityVersionChecker, EntityManager entityManager) throws FindException {
        this.this$0 = entityVersionChecker;
        super(entityManager);
        this.e = entityManager.getInterfaceClass();
    }

    boolean a(Entity entity) {
        return this.e.isInstance(entity);
    }

    boolean a(PersistentEntity persistentEntity, char c10) {
        boolean bl2 = c10 == 'D' ? this.notifyDelete(persistentEntity.getGoid()) : this.notifyUpdate(persistentEntity.getGoid(), persistentEntity.getVersion());
        return bl2;
    }

    @Override
    public void run() {
        this.f = new ArrayList<Goid>();
        this.g = new ArrayList<Character>();
        super.run();
        this.a(this.e, this.f, this.g);
        this.f = null;
        this.g = null;
    }

    @Override
    protected void onDelete(Goid goid) {
        try {
            if (this.f != null) {
                this.f.add(goid);
                this.g.add(Character.valueOf('D'));
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw b7.a(illegalArgumentException);
        }
    }

    @Override
    protected void onUpdate(PersistentEntity persistentEntity) {
        try {
            if (this.f != null) {
                this.f.add(persistentEntity.getGoid());
                this.g.add(Character.valueOf('U'));
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw b7.a(illegalArgumentException);
        }
    }

    @Override
    protected void onCreate(PersistentEntity persistentEntity) {
        try {
            if (this.f != null) {
                this.f.add(persistentEntity.getGoid());
                this.g.add(Character.valueOf('C'));
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw b7.a(illegalArgumentException);
        }
    }

    private void a(Class<? extends Entity> clazz, List<Goid> list, List<Character> list2) {
        block7: {
            block8: {
                try {
                    try {
                        if (list.isEmpty()) break block7;
                        if (list.size() == list2.size()) break block8;
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw b7.a(illegalArgumentException);
                    }
                    throw new IllegalArgumentException(i);
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw b7.a(illegalArgumentException);
                }
            }
            Goid[] goidArray = new Goid[list.size()];
            char[] cArray = new char[list.size()];
            try {
                for (int i2 = 0; i2 < goidArray.length; ++i2) {
                    goidArray[i2] = list.get(i2);
                    cArray[i2] = list2.get(i2).charValue();
                }
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw b7.a(illegalArgumentException);
            }
            this.this$0.a(new EntityInvalidationEvent(this, clazz, goidArray, cArray));
        }
    }

    private static IllegalArgumentException a(IllegalArgumentException illegalArgumentException) {
        return illegalArgumentException;
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x22);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 7;
                    case 1 -> 120;
                    case 2 -> 127;
                    case 3 -> 54;
                    case 4 -> 119;
                    case 5 -> 104;
                    default -> 34;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

