Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 36 |  | Methods: | 2
| NCLOC: | 28 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
LanguageFactory.java | 80% | 83.3% | 100% | 83.3% |

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 CPP_KEY = "cpp";
12 |  | public static final String C_KEY = "c";
13 |  | public static final String PHP_KEY = "php";
14 |  | public static final String RUBY_KEY = "ruby";
15 |  | public static final String EXTENSION = "extension";
16 |  | public static final String BY_EXTENSION = "by_extension";
17 |  |
18 | 5 | public Language createLanguage(String language) {
19 | 5 | return createLanguage(language, new Properties());
20 |  | }
21 |  |
22 | 5 | public Language createLanguage(String language, Properties properties) {
23 | 5 | if (language.equals(CPP_KEY) || language.equals(C_KEY)) {
24 | 2 | return new CPPLanguage();
25 | 3 | } else if (language.equals(JAVA_KEY)) {
26 | 1 | return new JavaLanguage(properties);
27 | 2 | } else if (language.equals(BY_EXTENSION)) {
28 | 0 | return new AnyLanguage(properties.getProperty(EXTENSION));
29 | 2 | } else if (language.equals(PHP_KEY)) {
30 | 1 | return new PHPLanguage();
31 | 1 | } else if (language.equals(RUBY_KEY)) {
32 | 0 | return new RubyLanguage();
33 |  | }
34 | 1 | return new AnyLanguage(language);
35 |  | }
36 |  | }