GStateStack.java 862 Bytes
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.internal.pdftoolkit.pdf.content.processor;

import com.adobe.internal.pdftoolkit.pdf.content.processor.GState;
import java.util.ArrayList;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public class GStateStack<T extends GState> {
    private ArrayList<T> stack = new ArrayList();

    public GStateStack(T gState) {
        this.push(gState);
    }

    public void push(T gState) {
        this.stack.add(gState);
    }

    public T pop() {
        return (T)((GState)this.stack.remove(this.stack.size() - 1));
    }

    public T peek() {
        if (!this.isEmpty()) {
            return (T)((GState)this.stack.get(this.stack.size() - 1));
        }
        return null;
    }

    boolean isEmpty() {
        return this.stack.isEmpty();
    }
}