/*******************************************************************************
* Copyright (c) 2015-2016 ONERA.
 * Ce logiciel est la propriété de l’ONERA (the French Aerospace Lab).
 * Tous droits réservés.
 *
 * Ce programme et les éléments qui l'accompagnent sont mis à disposition
 * aux conditions définies par le contrat de licence logiciel CeCILL-C soumise
 * au droit français et respectant les principes de diffusion des logiciels libres.
 * Vous pouvez utiliser, modifier et/ou redistribuer ce programme
 * sous les conditions de la licence CeCILL-C (http://www.cecill.info).

 * This software is property of ONERA (the French Aerospace Lab).
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under
 * the terms of the CeCILL-C license under French law and
 * abiding by the rules of distribution of free software.
 * You can  use, modify and/ or redistribute the software under the terms of
 * the CeCILL-C license (http://www.cecill.info).
 *
 * Contributeurs/contributors:
*     Guillaume Infantes (ONERA - Centre de Toulouse) - initial API and implementation
*     
 *******************************************************************************/

#ifndef ALTA_VALUE_SYMBOL_H
#define ALTA_VALUE_SYMBOL_H

#include "../domains/Domains.hh"
#include "Value.hh"
#include <set>

namespace epoch {
    namespace altarica {

	class ValueInt;
	class ValueBool;
	

	class ValueSymbol : public Value {

	protected:
	    std::vector<std::string> s_;
	    const EnumDomain * d_;

	    bool stringIn(const std::string s, const std::vector<std::string> &sv) const;

	public:

	    virtual ~ValueSymbol();
	    virtual bool isSymbol()  const {return true;}
	    ValueSymbol(const std::string s);
	    ValueSymbol(const std::vector<std::string> &vs, const EnumDomain *d);
	    ValueSymbol(const std::string s, const EnumDomain *d);
	    ValueSymbol(const EnumDomain *d);

	    virtual ValueSymbol * clone() const;

	    virtual void inverse();

	    virtual std::string toSymbol() const;
	    const std::vector<std::string>* toSymbols() const {return &s_;}
	    virtual int toHash() const;


	    const EnumDomain * getDomain() const;
	    virtual void setDomain(const Domain * d);
	    
	    virtual bool equals(const ValueSymbol*v) const;

	    virtual void merge(const ValueSymbol*v);
	    virtual bool contains(const ValueSymbol*fs) const;

	    virtual void intersectValue(const ValueSymbol* v);

	    virtual ValueSymbol * getComplement() const;

	    bool includes(const ValueSymbol *s) const;
	    bool includes(const std::string s) const;
	    virtual std::vector<Value*> * getSingletons() const;

	    virtual bool hasIntersection(const ValueSymbol*v) const;

	    virtual void removeValue(const ValueSymbol *v);

	    void removeSymbol(std::string s);
    
	    virtual bool less(const ValueSymbol *v) const;
	    
	    void add(std::string s);
	    virtual int card() const {return s_.size();}

    virtual std::string toString() const;
    std::string toString(bool humanreadable) const;
    

	    virtual bool pDifferent(const ValueSymbol *v) const;

	};



    }
}


#endif
