C++ Source Code - Class CPL_Expression

This snippet of the header file for the class which is to represent propositional logic expressions (CPL_Expression.h) is just meant to give a first taste of how the software interface might look like.

#if !defined (CPL_EXPRESSION_INCLUDED)
#define CPL_EXPRESSION_INCLUDED
 
#include "CPL_Element.h"
 
#include <set>
#include <utility> // for pair
 
//=============================================================================
    class CPL_Expression
//=============================================================================
{
public:
 
    typedef enum Types
    {
        Tautology,
        Contradiction,
        Identity,
        Negation,
        Conjunction,
        Disjunction,
        Conditional,
        Biconditional,
        Exclusive_Disjunction,
        Other
    };
 
                            CPL_Expression ();
 
    void                    operator = (CPL_Element Element);
 
    void                    operator = (CPL_Expression Expression);
 
    //----  Tautology  ----
 
    static const CPL_Expression        True;
 
    //----  Contradiction  ----
 
    static const CPL_Expression        False;
 
    //----  Negation  ----
 
    friend CPL_Expression    Not (CPL_Element Element);
 
    static CPL_Expression    Not (CPL_Expression Expression);
 
    //----  Conjunctive  ----
 
    friend CPL_Expression    And (CPL_Element        Element_1,
                                 CPL_Element        Element_2);
 
    static CPL_Expression    And (CPL_Expression        Expression,
                                 CPL_Element        Element);
 
    static CPL_Expression    And (CPL_Element        Element,
                                 CPL_Expression        Expression);
 
    static CPL_Expression    And (CPL_Expression        Expression_1,
                                 CPL_Expression        Expression_2);
 
    //----  Disjunctive  ----
 
    static CPL_Expression    Or (CPL_Element        Element_1,
                                CPL_Element        Element_2);
 
    static CPL_Expression    Or (CPL_Expression    Expression,
                                CPL_Element        Element);
 
    static CPL_Expression    Or (CPL_Element        Element,
                                CPL_Expression    Expression);
 
    static CPL_Expression    Or (CPL_Expression    Expression_1,
                                CPL_Expression    Expression_2);
 
    //----  Conditional  ----
 
    static CPL_Expression    Implies (CPL_Element        Antecedent,
                                     CPL_Element        Consequent);
 
    static CPL_Expression    Implies (CPL_Expression        Antecedent,
                                     CPL_Element        Consequent);
 
    static CPL_Expression    Implies (CPL_Element        Antecedent,
                                     CPL_Expression        Consequent);
 
    static CPL_Expression    Implies (CPL_Expression        Antecedent,
                                     CPL_Expression        Consequent);
 
    //----  Biconditional  ----
 
    static CPL_Expression    Equivalent (CPL_Element        Element_1,
                                        CPL_Element        Element_2);
 
    static CPL_Expression    Equivalent (CPL_Expression    Expression,
                                        CPL_Element        Element);
 
    static CPL_Expression    Equivalent (CPL_Element        Element,
                                        CPL_Expression    Expression);
 
    static CPL_Expression    Equivalent (CPL_Expression    Expression_1,
                                        CPL_Expression    Expression_2);
 
    //----  Other  ----
 
    void                    Replace (CPL_Element    Element,
                                     CPL_Expression    Expression);
 
    //----  Selectors  ----
 
    Types                    Type ();
 
    unsigned int            Total_Elements ();
 
    std::set <CPL_Element>    Elements ();
 
    bool                    Contains (CPL_Element Element);
 
    bool                    Value (std::set <std::pair <CPL_Element, bool> >
                                                            Element_Values);
 
    virtual                    ~CPL_Expression ();
};
 
#endif // !defined (CPL_EXPRESSION_INCLUDED)
page_revision: 0, last_edited: 1186925873|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License