//
// Copyright (c) 2009 Froduald Kabanza and the Université de Sherbrooke.
// Use of this software is permitted for non-commercial research purposes, and
// it may be copied or applied only for that use. All copies must include this
// copyright message.
// 
// This is a research prototype that has not gone through intensive tests and
// is delivered as is. It may still contain bugs. Froduald Kabanza and the
// Université de Sherbrooke disclaim any responsibility for damage that may be
// caused by using it.
//
// Please note that some files were inspired in part by the PDDL4J library:
// http://www.math-info.univ-paris5.fr/~pellier/software/software.php 
//
// Implementation: Simon Chamberland
// Project Manager: Froduald Kabanza
//

#ifndef _SCALE_DOWN_H
#define _SCALE_DOWN_H

#include "NumericOperationAssignEffect.h"
#include "../../../Exception/NumericException.h"

namespace planning
{
  /// <summary>
  /// This class represents a fluent increase operation.
  /// </summary>
  class ScaleDown : public NumericOperationAssignEffect<std::divides<double> >
  {
  public:
    /// <summary>
    /// Creates a new fluent scale-up operation.
    /// </summary>
    /// <param name="head">The numeric fluent whose value is to be scaled up.</param>
    /// <param name="body">The numeric value to scale up the fluent by.</param>
    ScaleDown(const NumericFluentApplication* head, const INumericExp* body)
      : NumericOperationAssignEffect<std::divides<double> >(s_image, head, body)
    {
      INITIALIZE_HASH_CODE();
    }

  protected:
    virtual size_t _calculateHashCode() const
    {
      return CALCULATE_HASH_CODE(NumericOperationAssignEffect)
           + 48205693;
    }

    virtual const IExp* _internalApply(const Bindings* bindings) const
    {
      return new ScaleDown(m_head->apply(bindings), m_body->apply(bindings));
    }

  private:
    static const std::string s_image;
  };
}

#endif