ChildReln.java 1.8 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa;

import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.ResId;

public class ChildReln {
    public static final int oneOfChild = 4;
    public static final int oneOrMore = 3;
    public static final int UNLIMITED = -1;
    public static final int zeroOrMore = 2;
    public static final int zeroOrOne = 1;
    private static final ChildReln goOneOfChild = new ChildReln(4, 1);
    private static final ChildReln goOneOrMore = new ChildReln(3, 1);
    private static final ChildReln goZeroOrMore = new ChildReln(2, 1);
    private static final ChildReln goZeroOrOne = new ChildReln(1, 1);
    private final int meOccurrence;
    private final int mnMaxOccurrence;

    public static ChildReln getOneOfChild() {
        return goOneOfChild;
    }

    public static ChildReln getOneOrMore() {
        return goOneOrMore;
    }

    public static ChildReln getZeroOrMore() {
        return goZeroOrMore;
    }

    public static ChildReln getZeroOrOne() {
        return goZeroOrOne;
    }

    public ChildReln(int count, int nMax) {
        this.meOccurrence = count;
        assert (nMax != 0);
        if ((this.meOccurrence == 3 || this.meOccurrence == 2) && nMax == 1) {
            nMax = -1;
        }
        this.mnMaxOccurrence = nMax;
    }

    public int getMax() {
        return this.mnMaxOccurrence;
    }

    public int getMin() {
        switch (this.meOccurrence) {
            case 1: 
            case 2: 
            case 4: {
                return 0;
            }
        }
        return 1;
    }

    public int getOccurrence() {
        return this.meOccurrence;
    }

    public void init(int count, int nMax) {
        throw new ExFull(ResId.UNSUPPORTED_OPERATION, "ChildReln#init");
    }

    public boolean isBaseClass() {
        return true;
    }
}