//
// 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 this file was inspired in part by the PDDL4J library:
// http://www.math-info.univ-paris5.fr/~pellier/software/software.php 
//
// Implementation: Daniel Castonguay
// Project Manager: Froduald Kabanza
//
#include "stdafx.h"
#include "ProgressionValue.h"

#include "Logical/TrueExp.h"
#include "Logical/FalseExp.h"

using namespace planning;

ProgressionValue::ProgressionValue(const ITemporalExp* exp)
  : m_exp(exp)
{
  //m_exp->acquire(this);
}

ProgressionValue::ProgressionValue(bool result)
  : m_exp(result ? (const ITemporalExp*)TrueExp::getInstance() : (const ITemporalExp*)FalseExp::getInstance())
{
  //m_exp->acquire(this);
}

ProgressionValue::ProgressionValue(const ProgressionValue &p)
  : m_exp(p.m_exp)
{
 // m_exp->acquire(this);
}

ProgressionValue::~ProgressionValue()
{
  //m_exp->release(this);
}

bool ProgressionValue::isTrue() const
{
  return m_exp == TrueExp::getInstance();
}

bool ProgressionValue::isFalse() const
{
  return m_exp == FalseExp::getInstance();
}

const ITemporalExp* ProgressionValue::getExp() const
{
  return m_exp;
}

void ProgressionValue::_output(std::ostream& out) const
{
  out << "ProgressionValue: " << *m_exp;
}