AFEAttrSet.java 1.92 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.fontengine.inlineformatting.ElementAttribute
 *  com.adobe.fontengine.inlineformatting.InterElementAttribute
 */
package com.adobe.xfa.text;

import com.adobe.fontengine.inlineformatting.ElementAttribute;
import com.adobe.fontengine.inlineformatting.InterElementAttribute;
import com.adobe.xfa.text.AFEAttrMap;

abstract class AFEAttrSet
implements Comparable<AFEAttrSet> {
    static final int CMP_EQUAL = 0;
    static final int CMP_LT = 1;
    static final int CMP_GT = 2;
    static final int CMP_UNKNOWN = 3;
    private final AFEAttrMap mAFEAttrMap;

    AFEAttrSet(AFEAttrMap afeAttrMap) {
        this.mAFEAttrMap = afeAttrMap;
    }

    abstract Object getAttr(Object var1);

    boolean matchAttr(AFEAttrSet compare, Object attribute) {
        Object o2;
        Object o1 = this.getAttr(attribute);
        return AFEAttrSet.nullCompare(o1, o2 = compare.getAttr(attribute)) == 0;
    }

    AFEAttrMap getAFEAttrMap() {
        return this.mAFEAttrMap;
    }

    static final boolean isFixedAttr(Object key) {
        return key == ElementAttribute.CSS20Attribute || key == ElementAttribute.font || key == ElementAttribute.pointSize || key == ElementAttribute.bidiLevel || key == InterElementAttribute.ligatureLevel || key == ElementAttribute.locale;
    }

    static int nullCompare(Object o1, Object o2) {
        if (o1 == o2) {
            return 0;
        }
        if (o1 == null) {
            return 1;
        }
        if (o2 == null) {
            return 2;
        }
        if (o1.equals(o2)) {
            return 0;
        }
        return 3;
    }

    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (object == null) {
            return false;
        }
        if (object.getClass() != this.getClass()) {
            return false;
        }
        return true;
    }
}