/*
 * @(#)ArchiveCompressedEvent.java
 *
 * Copyright (c) JSCAPE LLC.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
package com.jscape.zip;

import java.io.File;
import java.util.EventObject;

/**
 * Fired when a file is compressed.
 */
public class ArchiveCompressedEvent
        extends EventObject {

    /**
     * The serial version.
     */
    private static final long serialVersionUID = -2519273170492992626L;
    /**
     * The instance of the compressed file.
     */
    private File file;

    /**
     * Creates <code>ArchiveCompressedEvent</code>.
     *
     * @param source the source of the event
     * @param file   the compressed file.
     */
    public ArchiveCompressedEvent(final Object source, final File file) {
        super(source);
        this.file = file;
    }

    /**
     * Gets the compressed file.
     *
     * @return File the current instance of the compressed file.
     */
    public File getFile() {
        return this.file;
    }

    /**
     * Method accept.
     *
     * @param listener listener
     */
    public void accept(final ArchiveListener listener) {
        if (listener != null) {
            listener.compressed(this);
        }
    }

}
