| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| NodePartitionVisitor |
|
| 1.0;1 |
| 1 | /* | |
| 2 | This file is part of Combean. | |
| 3 | ||
| 4 | Combean 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 | Combean 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 Combean; if not, write to the Free Software | |
| 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | */ | |
| 18 | /* | |
| 19 | * Created on 10.02.2005 | |
| 20 | * | |
| 21 | */ | |
| 22 | package net.sourceforge.combean.interfaces.graph.alg.partition; | |
| 23 | ||
| 24 | import net.sourceforge.combean.interfaces.graph.Graph; | |
| 25 | import net.sourceforge.combean.interfaces.graph.Node; | |
| 26 | ||
| 27 | /** | |
| 28 | * A Visitor which is used by partitioning algorithms to return the partitions | |
| 29 | * which were found. | |
| 30 | * @see net.sourceforge.combean.interfaces.graph.alg.partition.PartitioningAlg | |
| 31 | * | |
| 32 | * @author schickin | |
| 33 | * | |
| 34 | */ | |
| 35 | public interface NodePartitionVisitor { | |
| 36 | ||
| 37 | /** | |
| 38 | * Has to be invoked before the actual processing of the PartitioningAlg | |
| 39 | * starts. | |
| 40 | * | |
| 41 | * @param g the graph which shall be processed. | |
| 42 | */ | |
| 43 | public void init(Graph g); | |
| 44 | ||
| 45 | /** | |
| 46 | * Has to be invoked before all calls to addNode of a partition. | |
| 47 | */ | |
| 48 | public void startPartition(); | |
| 49 | ||
| 50 | /** | |
| 51 | * Has to be invoked exactly once for all nodes of the graph, | |
| 52 | * properly enclosed by calls to start/endPartition(). | |
| 53 | * | |
| 54 | * @param v a node which belongs to the current partition, started with | |
| 55 | * a call to startPartition(). | |
| 56 | */ | |
| 57 | public void addNode(Node v); | |
| 58 | ||
| 59 | /** | |
| 60 | * Has to be invoked after all calls to addNode of a partition. | |
| 61 | */ | |
| 62 | public void endPartition(); | |
| 63 | ||
| 64 | /** | |
| 65 | * Has to be invoked after processing of the ParititioningAlg is complete. | |
| 66 | */ | |
| 67 | public void finish(); | |
| 68 | ||
| 69 | /** | |
| 70 | * Get the number of partitions found. May only be called after finish(). | |
| 71 | * | |
| 72 | * @return the number of partitions found. | |
| 73 | */ | |
| 74 | int getNumPartitions(); | |
| 75 | } |