MASA-Core
Partition.hpp
Go to the documentation of this file.
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 #ifndef PARTITION_HPP_
00023 #define PARTITION_HPP_
00024 
00025 class Partition {
00026 private:
00027         /** First Row */
00028         int i0;
00029         /** First Column */
00030         int j0;
00031         /** Last Row */
00032         int i1;
00033         /** Last Column */
00034         int j1;
00035 
00036 public:
00037         /**
00038          * Default constructor.
00039          */
00040         Partition();
00041 
00042         /**
00043          * Creates a partition with the given coordinates.
00044          */
00045         Partition(int i0, int j0, int i1, int j1);
00046 
00047         /**
00048          * Creates a partition copying the coordinates from other partition
00049          * and applying a translation operation.
00050          * @param i_offset translate the $i$ coordinates
00051          * @param j_offset translate the $j$ coordinates
00052          */
00053         Partition(const Partition& partition, int i_offset, int j_offset);
00054 
00055         /**
00056          * Destructor.
00057          */
00058         virtual ~Partition();
00059 
00060         /**
00061          * @return the start row of the partition.
00062          */
00063         int getI0() const;
00064         void setI0(int i0);
00065 
00066         /**
00067          * @return the end row (exclusive) of the partition.
00068          */
00069         int getI1() const;
00070         void setI1(int i1);
00071 
00072         /**
00073          * @return the start column of the partition.
00074          */
00075         int getJ0() const;
00076         void setJ0(int j0);
00077 
00078         /**
00079          * @return the end column (exclusive) of the partition.
00080          */
00081         int getJ1() const;
00082         void setJ1(int j1);
00083 
00084         /**
00085          * @return the height of the partition \f$j1-j0\f$.
00086          */
00087         int getHeight() const;
00088 
00089         /**
00090          * @return the width of the partition \f$j1-j0\f$.
00091          */
00092         int getWidth() const;
00093 
00094         bool hasZeroArea() const;
00095 
00096 };
00097 
00098 #endif /* PARTITION_HPP_ */