Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 39 |  | Methods: | 2
| NCLOC: | 31 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
LanguageFactory.java | 75% | 78.6% | 100% | 78.6% |

1 |  | /**
2 |  | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 |  | */
4 |  | package net.sourceforge.pmd.cpd;
5 |  |
6 |  | import java.util.Properties;
7 |  |
8 |  | public class LanguageFactory {
9 |  |
10 |  | public static final String JAVA_KEY = "java";
11 |  | public static final String JSP_KEY = "jsp";
12 |  | public static final String CPP_KEY = "cpp";
13 |  | public static final String C_KEY = "c";
14 |  | public static final String PHP_KEY = "php";
15 |  | public static final String RUBY_KEY = "ruby";
16 |  | public static final String EXTENSION = "extension";
17 |  | public static final String BY_EXTENSION = "by_extension";
18 |  |
19 | 5 | public Language createLanguage(String language) {
20 | 5 | return createLanguage(language, new Properties());
21 |  | }
22 |  |
23 | 5 | public Language createLanguage(String language, Properties properties) {
24 | 5 | if (language.equals(CPP_KEY) || language.equals(C_KEY)) {
25 | 2 | return new CPPLanguage();
26 | 3 | } else if (language.equals(JAVA_KEY)) {
27 | 1 | return new JavaLanguage(properties);
28 | 2 | } else if (language.equals(JSP_KEY)) {
29 | 0 | return new JSPLanguage();
30 | 2 | } else if (language.equals(BY_EXTENSION)) {
31 | 0 | return new AnyLanguage(properties.getProperty(EXTENSION));
32 | 2 | } else if (language.equals(PHP_KEY)) {
33 | 1 | return new PHPLanguage();
34 | 1 | } else if (language.equals(RUBY_KEY)) {
35 | 0 | return new RubyLanguage();
36 |  | }
37 | 1 | return new AnyLanguage(language);
38 |  | }
39 |  | }