- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Solvers/SAT/ValidSAT/VSATVariable.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include "VSATVariable.h"
    00015
    00016 #include <Mers/Models/Base/BaseModelDomain.h>
    00017
    00019
    00020 using namespace Mers::Solvers::SAT::ValidSAT;
    00021 using Mers::Models::Base::BaseModelAssignment;
    00022 using Mers::Models::Base::BaseModelAssignmentArray;
    00023 using Mers::Models::Base::BaseModelVariable;
    00024 using Mers::Models::Base::BaseModelDomain;
    00025 using std::ostream;
    00026
    00028 // Construction/Destruction
    00030
    00031 VSATVariable::VSATVariable(BaseModelVariable const * myVariable, bool myIsDesignVariable)
    00032 : assignments(true)
    00033 {
    00034         variable = myVariable;
    00035         isDesignVar = myIsDesignVariable;
    00036
    00037         BaseModelDomain const &domain = *(variable->getDomain());
    00038         for(unsigned int x = 0; x < domain.getLength(); x++){
    00039                 assignments.pushBack(new BaseModelAssignment(variable, domain[x]));
    00040         }
    00041 }
    00042
    00044
    00045 VSATVariable::VSATVariable(VSATVariable const &other)
    00046 : variable(other.variable), assignments(other.assignments), isDesignVar(other.isDesignVar)
    00047 {
    00048
    00049 }
    00050
    00052
    00053 VSATVariable::~VSATVariable()
    00054 {
    00055
    00056 }
    00057
    00059
    00060 BaseModelAssignmentArray & VSATVariable::getAssignments()
    00061 {
    00062         return assignments;
    00063 }
    00064
    00066
    00067 VSATVariable * VSATVariable::duplicate() const
    00068 {
    00069         return new VSATVariable(variable, isDesignVar);
    00070 }
    00071
    00073
    00074 bool VSATVariable::operator ==(VSATVariable const &other) const
    00075 {
    00076         return (variable == other.variable) && (isDesignVar == other.isDesignVar);
    00077 }
    00078
    00080
    00081 #ifndef EMBEDDED
    00082
    00083 void VSATVariable::print(ostream &out) const
    00084 {
    00085         out << variable;
    00086         if(isDesignVar)
    00087                 out << ":Design:";
    00088 }
    00089
    00090 #endif
    00091
    00093
    00094