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

COVERAGE SUMMARY FOR SOURCE FILE [PuzzleFactory.java]

nameclass, %method, %block, %line, %
PuzzleFactory.java100% (2/2)75%  (3/4)83%  (99/119)86%  (21.6/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PuzzleFactory100% (1/1)67%  (2/3)79%  (46/58)87%  (21.8/25)
PuzzleFactory (): void 0%   (0/1)0%   (0/3)0%   (0/2)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
newInstance (PuzzleTypeEnum): Puzzle 100% (1/1)85%  (40/47)95%  (21/22)
     
class PuzzleFactory$1100% (1/1)100% (1/1)87%  (53/61)86%  (0.9/1)
<static initializer> 100% (1/1)87%  (53/61)86%  (0.9/1)

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.model;
22 
23/**
24 * Factory class that creates Puzzle implementation instances.
25 * @author <a href="http://sourceforge.net/users/stevensa">Andrew Stevens</a>
26 */
27public class PuzzleFactory {
28 
29    /** Prevent creating instances as all methods are static */
30    private PuzzleFactory() {
31    }
32 
33    /**
34     * Factory method to create Puzzle instances according to the supplied
35     * type.
36     * @param type Desired puzzle type.
37     */
38    public static Puzzle newInstance(PuzzleTypeEnum type) {
39        Puzzle puzzle = null;
40 
41        if (type == null) {
42            throw new IllegalArgumentException("No puzzle type supplied");
43        }
44 
45        switch (type) {
46            case TINY:
47                puzzle = TinyPuzzle.create();
48                break;
49            case MINI:
50                puzzle = MiniPuzzle.create();
51                break;
52            case MINI_X:
53                puzzle = MiniXPuzzle.create();
54                break;
55            case SMALL_X:
56                puzzle = SmallXPuzzle.create();
57                break;
58            case STANDARD:
59                puzzle = StandardPuzzle.create();
60                break;
61            case SUPER:
62                puzzle = SuperPuzzle.create();
63                break;
64            case LARGE:
65                puzzle = LargePuzzle.create();
66                break;
67            case STANDARD_SAMURAI:
68                puzzle = SamuraiPuzzle.create();
69                break;
70            default:
71                assert false : "Should have covered all possibilities";
72                // return null
73                break;
74        }
75 
76        return puzzle;
77    }
78 
79}

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