//
// 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 "FalseExp.h"

#include <assert.h>

using namespace planning;

FalseExp FalseExp::s_instance;

FalseExp::FalseExp()
{
  _markAsStatic();
  _setHashCode(_calculateHashCode());
}

/// <summary>
/// Evaluates this logical expression in the specified closed world.
/// The bindings should not be modified by this call.
/// </summary>
/// <param name="world">The evaluation world.</param>
/// <param name="bindings">A set of variable bindings.</param>
/// <returns>True, false, or undefined.</returns>
/// <exception cref="PDDLParser.Exception.BindingException">A BindingException is thrown if an attempt
/// is made to evaluate an unbound variable.</exception>
bool FalseExp::evaluate(const IClosedWorld* world, const Bindings* bindings) const
{
  return false;
}

/// <summary>
/// Enumerates all the worlds within which this logical expression evaluates to true.
/// This method is used to support the goal modality expressions.
/// </summary>
/// <returns>All the worlds satisfying this logical expression.</returns>
void FalseExp::enumerateSatisfyingWorlds(PartialWorldSet& worlds) const
{
  assert(worlds.size() == 0);

  // No worlds can satisfy this expression
}

void FalseExp::_output(std::ostream& out) const
{
  out << "false";
}

const IExp* FalseExp::_internalApply(const Bindings* bindings) const
{
  return this;
}

int FalseExp::_internalCompareTo(const IExp& other) const
{
  return 0;
}
