view src/main/java/org/icedrobot/ika/output/WorkerStatus.java @ 29:3b0d6002605a

Add patch to output commands names. Contributed by Giulio Franco.
author Mario Torre <neugens.limasoftware@gmail.com>
date Fri, 15 Apr 2011 17:13:03 +0200
parents
children
line wrap: on
line source

/*
 * IKA - IcedRobot Kiosk Application
 * Copyright (C) 2011  IcedRobot team
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.icedrobot.ika.output;

/**
 * Client interface for workers that want to notify their status
 * to the StatusKeeper.
 */
public interface WorkerStatus {

    /**
     * Retrieves the name of the worker this status is related to.
     * @return Name of the worker
     */
    public String getName();

    /**
     * Retrieves the completion percentage for the task.
     * @return Completion percentage.
     */
    public float getPercentage();

    /**
     * Checks if the task has been completed.
     * @return true, if the task is completed.
     */
    public boolean completed();


    /**
     * Retrieves the amount of work that has already been performed.
     * @return Units of performed work.
     * @throws UnsupportedOperationException if this datum is not available.
     *          If {@link #hasDetailedProgress()} returs true, this exception
     *          shall never be thrown.
     */
    public long getDoneWork() throws UnsupportedOperationException;

    /**
     * Retrieves the amount of work the worker was supposed to accomplish.
     * @return Total amount of work the worker is to perform.
     * @throws UnsupportedOperationException if this datum is not available.
     *          If {@link #hasDetailedProgress()} returs true, this exception
     *          shall never be thrown.
     */
    public long getTargetWork() throws UnsupportedOperationException;

    /**
     * Checks if this status report has detailed information about work units.
     * @return true, if {@link #getDoneWork()} and {@link #getTargetWork()}
     *          return a value. false, if they are unsupported.
     */
    public boolean hasDetailedProgress();


    /**
     * Returns textual information about the status of the task
     * @return status of the task
     */
    public String getStatus();


    /**
     * Gets the current extimated processing speed of the task (in KiB/s).
     * @return Processing speed
     * @throws UnsupportedOperationException if this datum is not available.
     *          If {@link #hasSpeed()} returs true, this exception
     *          shall never be thrown.
     */
    public float getSpeed() throws UnsupportedOperationException;

    /**
     * Checks if details about processing speed are present.
     * @return true, if {@link #getSpeed()} returns a value;
     *          false if it is unsupported.
     */
    public boolean hasSpeed();
}