EMMA Coverage Report (generated Sat Apr 29 12:52:00 BST 2006)
[all classes][net.sourceforge.pseudoq.solver]

COVERAGE SUMMARY FOR SOURCE FILE [RegionValueCounter.java]

nameclass, %method, %block, %line, %
RegionValueCounter.java100% (1/1)71%  (5/7)79%  (52/66)76%  (15.3/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RegionValueCounter100% (1/1)71%  (5/7)79%  (52/66)76%  (15.3/20)
reset (): void 0%   (0/1)0%   (0/4)0%   (0/2)
setCount (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
place (Coordinate, int): void 100% (1/1)83%  (20/24)92%  (5.6/6)
RegionValueCounter (Region): void 100% (1/1)100% (16/16)100% (6/6)
getCount (): int 100% (1/1)100% (3/3)100% (1/1)
increment (): void 100% (1/1)100% (7/7)100% (2/2)

1/*
2 * Copyright (c) 2005 The PseudoQ Project.
3 *
4 * This file is part of PseudoQ.
5 *
6 * PseudoQ is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * PseudoQ is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with PseudoQ; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 */
20 
21package net.sourceforge.pseudoq.solver;
22 
23import net.sourceforge.pseudoq.model.Coordinate;
24import net.sourceforge.pseudoq.model.Region;
25 
26/**
27 * Counts the number of values that have been placed within a region.
28 * @author <a href="http://sourceforge.net/users/stevensa">Andrew Stevens</a>
29 */
30public class RegionValueCounter implements Counter {
31    private int count = 0;
32    private Region region;
33 
34    /**
35     * Creates a new instance of RegionValueCounter.
36     * @param region The region to monitor.
37     */
38    public RegionValueCounter(Region region) {
39        if (region == null) {
40            throw new IllegalArgumentException("Can't create counter for null region");
41        }
42 
43        this.region = region;
44    }
45 
46    public void increment() {
47        count++;
48    }
49 
50    public void reset() {
51        count = 0;
52    }
53 
54    public int getCount() {
55        return count;
56    }
57 
58    public void place(Coordinate coord, int value) {
59        if (coord == null) {
60            throw new IllegalArgumentException("Can't place a value with null coordinate");
61        }
62        assert (region != null);
63 
64        if (region.contains(coord)) {
65            // don't care what the value is
66            increment();
67        }
68    }
69 
70    /**
71     * Setter for property count.
72     * @param count New value of property count.
73     */
74    public void setCount(int count) {
75        this.count = count;
76    }
77 
78}

[all classes][net.sourceforge.pseudoq.solver]
EMMA 2.0.5312 (C) Vladimir Roubtsov