00001 #include "variable.h" 00002 00003 #include <cassert> 00004 using namespace std; 00005 00006 Variable::Variable(istream &in) { 00007 in >> name >> range >> layer; 00008 level = -1; 00009 necessary = false; 00010 used_in_duration_condition = false; 00011 subterm = false; 00012 comparison = false; 00013 module = false; 00014 if (range == -1) 00015 functional = true; 00016 else 00017 functional = false; 00018 } 00019 00020 void Variable::set_level(int theLevel) { 00021 assert(level == -1); 00022 level = theLevel; 00023 } 00024 00025 int Variable::get_level() const { 00026 return level; 00027 } 00028 00029 void Variable::set_necessary() { 00030 //assert(necessary == false); 00031 necessary = true; 00032 } 00033 00034 int Variable::get_range() const { 00035 return range; 00036 } 00037 00038 string Variable::get_name() const { 00039 return name; 00040 } 00041 00042 bool Variable::is_necessary() const { 00043 return necessary; 00044 } 00045 00046 bool Variable::is_functional() const { 00047 return functional; 00048 } 00049 00050 bool Variable::is_used_in_duration_condition() const { 00051 return used_in_duration_condition; 00052 } 00053 00054 void Variable::set_used_in_duration_condition() { 00055 used_in_duration_condition = true; 00056 } 00057 00058 bool Variable::is_subterm() const { 00059 return subterm; 00060 } 00061 00062 void Variable::set_subterm() { 00063 subterm = true; 00064 } 00065 00066 bool Variable::is_comparison() const { 00067 return comparison; 00068 } 00069 00070 void Variable::set_comparison() { 00071 comparison = true; 00072 } 00073 00074 bool Variable::is_module() const { 00075 return module; 00076 } 00077 00078 void Variable::set_module() { 00079 module = true; 00080 } 00081 00082 void Variable::dump() const { 00083 cout << name << " [range " << range; 00084 if(level != -1) 00085 cout << "; level " << level; 00086 if(is_derived()) 00087 cout << "; derived; layer: " << layer; 00088 cout << "]" << endl; 00089 }