00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Universidad Nacional de Colombia * 00003 * http://www.unal.edu.co * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #include "NodeWeight.h" 00021 00022 NodeWeight::NodeWeight() 00023 { 00024 root = false ; 00025 keyroot = false ; 00026 externalId = -1 ; 00027 potentialValue = INFINITY ; 00028 weightValue = INFINITY ; 00029 leftmost = -1 ; 00030 deepestNoNodes = -1 ; 00031 } 00032 00033 // NodeWeight::NodeWeight( const NodeWeight& nw ) 00034 // { 00035 // this->keyroot = nw.isKeyroot() ; 00036 // this->externalId = nw.getExternalId() ; 00037 // this->weightValue = nw.getWeightValue() ; 00038 // this->leftmost = nw.getLeftmost() ; 00039 // } 00040 00041 NodeWeight::NodeWeight( double weightValue, bool root ) 00042 { 00043 this->root = root ; 00044 keyroot = false ; 00045 externalId = -1 ; 00046 potentialValue = INFINITY ; 00047 this->weightValue = weightValue ; 00048 leftmost = -1 ; 00049 deepestNoNodes = -1 ; 00050 } 00051 00052 NodeWeight::NodeWeight( double weightValue, bool root, int deepestNoNodes ) 00053 { 00054 this->root = root ; 00055 keyroot = false ; 00056 externalId = -1 ; 00057 potentialValue = INFINITY ; 00058 this->weightValue = weightValue ; 00059 leftmost = -1 ; 00060 this->deepestNoNodes = deepestNoNodes ; 00061 } 00062 00063 NodeWeight::NodeWeight( double potentialValue, double weightValue ){ 00064 this->root = false ; 00065 keyroot = false ; 00066 externalId = -1 ; 00067 this->potentialValue = potentialValue ; 00068 this->weightValue = weightValue ; 00069 leftmost = -1 ; 00070 deepestNoNodes = -1 ; 00071 } 00072 00073 NodeWeight::NodeWeight( double potentialValue, double weightValue, bool root, int deepestNoNodes ){ 00074 this->root = root ; 00075 keyroot = false ; 00076 externalId = -1 ; 00077 this->potentialValue = potentialValue ; 00078 this->weightValue = weightValue ; 00079 leftmost = -1 ; 00080 this->deepestNoNodes = deepestNoNodes ; 00081 } 00082 00083 // bool operator == ( const NodeWeight& nw1, const NodeWeight& nw2 ) 00084 // { 00085 // if ( ( nw1.keyroot == nw2.keyroot ) && ( nw1.externalId == nw2.externalId ) && 00086 // (nw1.weightValue == nw2.weightValue ) && ( nw1.leftmost == nw2.leftmost ) ) 00087 // return true ; 00088 // else 00089 // return false ; 00090 // } 00091 // 00092 // bool operator < (const NodeWeight& nw1, const NodeWeight& nw2) 00093 // { 00094 // if( nw1.getExternalId() < nw2.getExternalId() ) 00095 // return true ; 00096 // else 00097 // return false ; 00098 // } 00099 00100 NodeWeight::~NodeWeight() 00101 { 00102 } 00103 00104 int NodeWeight::getExternalId() const 00105 { 00106 return externalId; 00107 } 00108 00109 void NodeWeight::setExternalId(const int& value) 00110 { 00111 externalId = value; 00112 } 00113 00114 bool NodeWeight::isKeyroot() const 00115 { 00116 return keyroot; 00117 } 00118 00119 void NodeWeight::setKeyroot(bool value) 00120 { 00121 keyroot = value; 00122 } 00123 00124 int NodeWeight::getLeftmost() const 00125 { 00126 return leftmost; 00127 } 00128 00129 void NodeWeight::setLeftmost(const int& value) 00130 { 00131 leftmost = value; 00132 } 00133 00134 double NodeWeight::getPotentialValue() const 00135 { 00136 return potentialValue; 00137 } 00138 00139 void NodeWeight::setPotentialValue( const double& potentialValue) 00140 { 00141 this->potentialValue = potentialValue ; 00142 } 00143 00144 double NodeWeight::getWeightValue() const 00145 { 00146 return weightValue; 00147 } 00148 00149 void NodeWeight::setWeightValue( const double& weightValue) 00150 { 00151 this->weightValue = weightValue ; 00152 } 00153 00154 void NodeWeight::setRoot( bool root ) 00155 { 00156 this->root = root ; 00157 } 00158 00159 bool NodeWeight::isRoot() const 00160 { 00161 return root ; 00162 } 00163 00164 int NodeWeight::getDeepestNoNodes() const 00165 { 00166 return deepestNoNodes ; 00167 } 00168 00169 void NodeWeight::setDeepestNoNodes( const int& value ) 00170 { 00171 deepestNoNodes = value; 00172 }