|
MASA-Core
|
00001 /******************************************************************************* 00002 * 00003 * Copyright (c) 2010-2015 Edans Sandes 00004 * 00005 * This file is part of MASA-Core. 00006 * 00007 * MASA-Core is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * MASA-Core is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with MASA-Core. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 ******************************************************************************/ 00021 00022 #include "Partition.hpp" 00023 00024 /* 00025 * @see definition on header file 00026 */ 00027 Partition::Partition() { 00028 this->i0 = 0; 00029 this->j0 = 0; 00030 this->i1 = 0; 00031 this->j1 = 0; 00032 } 00033 00034 /* 00035 * @see definition on header file 00036 */ 00037 Partition::Partition(int i0, int j0, int i1, int j1) { 00038 this->i0 = i0; 00039 this->j0 = j0; 00040 this->i1 = i1; 00041 this->j1 = j1; 00042 } 00043 00044 /* 00045 * @see definition on header file 00046 */ 00047 Partition::Partition(const Partition& partition, int i_offset, int j_offset) { 00048 this->i0 = partition.i0 + i_offset; 00049 this->j0 = partition.j0 + j_offset; 00050 this->i1 = partition.i1 + i_offset; 00051 this->j1 = partition.j1 + j_offset; 00052 00053 } 00054 00055 /* 00056 * @see definition on header file 00057 */ 00058 Partition::~Partition() { 00059 // TODO Auto-generated destructor stub 00060 } 00061 00062 /* 00063 * @see definition on header file 00064 */ 00065 int Partition::getI0() const { 00066 return i0; 00067 } 00068 00069 /* 00070 * @see definition on header file 00071 */ 00072 void Partition::setI0(int i0) { 00073 this->i0 = i0; 00074 } 00075 00076 /* 00077 * @see definition on header file 00078 */ 00079 int Partition::getI1() const { 00080 return i1; 00081 } 00082 00083 /* 00084 * @see definition on header file 00085 */ 00086 void Partition::setI1(int i1) { 00087 this->i1 = i1; 00088 } 00089 00090 /* 00091 * @see definition on header file 00092 */ 00093 int Partition::getJ0() const { 00094 return j0; 00095 } 00096 00097 /* 00098 * @see definition on header file 00099 */ 00100 void Partition::setJ0(int j0) { 00101 this->j0 = j0; 00102 } 00103 00104 /* 00105 * @see definition on header file 00106 */ 00107 int Partition::getJ1() const { 00108 return j1; 00109 } 00110 00111 /* 00112 * @see definition on header file 00113 */ 00114 void Partition::setJ1(int j1) { 00115 this->j1 = j1; 00116 } 00117 00118 /* 00119 * @see definition on header file 00120 */ 00121 int Partition::getHeight() const { 00122 return i1-i0; 00123 } 00124 00125 /* 00126 * @see definition on header file 00127 */ 00128 int Partition::getWidth() const { 00129 return j1-j0; 00130 } 00131 00132 bool Partition::hasZeroArea() const { 00133 return getWidth() == 0 || getHeight() == 0; 00134 } 00135 00136
1.7.6.1