Frobby  0.9.5
Partition.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef PARTITION_GUARD
18 #define PARTITION_GUARD
19 
20 class Partition {
21  public:
22  Partition();
23  Partition(const Partition& partition);
24  ~Partition();
25 
26  void reset(size_t size);
27 
28  bool join(size_t i, size_t j);
29 
30  size_t getSize() const;
31 
32  size_t getSetCount() const;
33 
34  size_t getSetSize(size_t set) const;
35 
36  size_t getRoot(size_t i) const;
37 
38  void addToSet(size_t i);
39 
40  size_t getSizeOfClassOf(size_t i) const;
41 
42  void print(FILE* file) const;
43 
44  private:
45  // Made private since it is not implemented.
47 
49  size_t _size;
50  size_t _capacity;
51 
52  size_t _setCount;
53 };
54 
55 #endif
int * _partitions
Definition: Partition.h:48
Partition & operator=(const Partition &)
size_t getSetCount() const
Definition: Partition.cpp:72
size_t _setCount
Definition: Partition.h:52
size_t _size
Definition: Partition.h:49
size_t getSetSize(size_t set) const
Definition: Partition.cpp:88
void print(FILE *file) const
Definition: Partition.cpp:121
size_t getSizeOfClassOf(size_t i) const
Definition: Partition.cpp:84
bool join(size_t i, size_t j)
Definition: Partition.cpp:51
void reset(size_t size)
Definition: Partition.cpp:39
size_t getSize() const
Definition: Partition.cpp:117
void addToSet(size_t i)
Definition: Partition.cpp:111
size_t _capacity
Definition: Partition.h:50
size_t getRoot(size_t i) const
Definition: Partition.cpp:102