/* File:        $Id$
 * Revision:    $Revision$
 * Author:      $Author$
 * Date:        $Date$
 *
 * The Netarchive Suite - Software to harvest and preserve websites
 * Copyright 2004-2007 Det Kongelige Bibliotek and Statsbiblioteket, Denmark
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package dk.netarkivet.harvester.harvesting.distribute;

import dk.netarkivet.common.exceptions.ArgumentNotValid;
import dk.netarkivet.harvester.datamodel.StopReason;

import java.io.Serializable;

/** Tuple class to hold domain harvest statistics for a single domain. */

public class DomainStats implements Serializable {

    /** Count of how many objects have been harvested from this domain. */
    private long objectCount;
    /** Count of how many bytes have been harvested from this domain . */
    private long byteCount;
    /** The reason why we 'only' harvested byteCount bytes
     * or objectCount objects. */
    private StopReason stopReason;

    /**
     * Constructor for a DomainStats object.
     * @param initObjectCount Start counting objects from this number
     * @param initByteCount  Start counting bytes from this number
     * @param defaultStopReason The default StopReason for a given domain.
     * @throws ArgumentNotValid If initObjectCount < 0, initByteCount < 0, or
     *          defaultStopReason is null.
     */
    public DomainStats(long initObjectCount, long initByteCount, StopReason defaultStopReason) {
        ArgumentNotValid.checkNotNegative(initByteCount, "initByteCount");
        ArgumentNotValid.checkNotNegative(objectCount, "objectCount");
        ArgumentNotValid.checkNotNull(defaultStopReason, "defaultStopReason");
        this.objectCount = initObjectCount;
        this.byteCount = initByteCount;
        this.stopReason = defaultStopReason;
    }

    /**
     * @return the byteCount.
     */
    public long getByteCount() {
        return byteCount;
    }


    /**
     * @param byteCount The byteCount to set.
     * @throws ArgumentNotValid If byteCount is a negative number.
     */
    public void setByteCount(long byteCount) {
        ArgumentNotValid.checkNotNegative(byteCount, "byteCount");
        this.byteCount = byteCount;
    }


    /**
     * @return the objectCount.
     */
    public long getObjectCount() {
        return objectCount;
    }


    /**
     * @param objectCount The objectCount to set.
     * @throws ArgumentNotValid If objectCount is a negative number.
     */
    public void setObjectCount(long objectCount) {
        ArgumentNotValid.checkNotNegative(objectCount, "objectCount");
        this.objectCount = objectCount;
    }


    /**
     * @return the stopReason.
     */
    public StopReason getStopReason() {
        return stopReason;
    }


    /**
     * @param stopReason The stopReason to set.
     * @throws dk.netarkivet.common.exceptions.ArgumentNotValid If argument is null
     */
    public void setStopReason(StopReason stopReason) {
        ArgumentNotValid.checkNotNull(stopReason, "stopReason");
        this.stopReason = stopReason;
    }

}

@@ -2103,16 +2103,28 @@
 teCount,
+%0A           
  StopRea
@@ -2140,32 +2140,111 @@
 ltStopReason) %7B%0A
+        ArgumentNotValid.checkNotNegative(initObjectCount, %22initObjectCount%22);%0A
         Argument
@@ -2306,79 +2306,8 @@
 %22);%0A
-        ArgumentNotValid.checkNotNegative(objectCount, %22objectCount%22);%0A
     
@@ -2621,33 +2621,32 @@
 teCount;%0A    %7D%0A%0A
-%0A
     /**%0A     * @
@@ -2907,33 +2907,32 @@
 teCount;%0A    %7D%0A%0A
-%0A
     /**%0A     * @
@@ -3029,33 +3029,32 @@
 unt;%0A    %7D%0A%0A
-%0A
     /**%0A
      * @para
@@ -3033,32 +3033,73 @@
 %0A    %7D%0A%0A    /**%0A
+     * Set objectcount to something new.%0A
      * @param ob
@@ -3370,33 +3370,32 @@
 ctCount;%0A    %7D%0A%0A
-%0A
     /**%0A     * @
@@ -3499,25 +3499,24 @@
 %0A    %7D%0A%0A
-%0A
     /**%0A
      * @
@@ -3499,32 +3499,72 @@
 %0A    %7D%0A%0A    /**%0A
+     * Set stopreason to something new.%0A
      * @param st
@@ -3587,32 +3587,32 @@
 pReason to set.%0A
+
      * @throws d
@@ -3614,40 +3614,8 @@
 ows 
-dk.netarkivet.common.exceptions.
 Argu

Fix bug #1232