Package: Dialect$Filter

Dialect$Filter

nameinstructionbranchcomplexitylinemethod
Dialect.Filter(String)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
accept(File, String)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: *
3: *        Copyright (C) 2008 Fujitsu Services Ltd.
4: *
5: *        Author: Nick Battle
6: *
7: *        This file is part of VDMJ.
8: *
9: *        VDMJ is free software: you can redistribute it and/or modify
10: *        it under the terms of the GNU General Public License as published by
11: *        the Free Software Foundation, either version 3 of the License, or
12: *        (at your option) any later version.
13: *
14: *        VDMJ is distributed in the hope that it will be useful,
15: *        but WITHOUT ANY WARRANTY; without even the implied warranty of
16: *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: *        GNU General Public License for more details.
18: *
19: *        You should have received a copy of the GNU General Public License
20: *        along with VDMJ. If not, see <http://www.gnu.org/licenses/>.
21: *
22: ******************************************************************************/
23:
24: package org.overture.ast.lex;
25:
26: import java.io.File;
27: import java.io.FilenameFilter;
28: import java.io.Serializable;
29:
30: /**
31: * An enumeration to indicate the VDM dialect being parsed.
32: */
33:
34: public enum Dialect implements Serializable
35: {
36:         VDM_SL("-vdmsl", ".+\\.vdm|.+\\.vdmsl"), VDM_PP("-vdmpp",
37:                         ".+\\.vpp|.+\\.vdmpp"), VDM_RT("-vdmrt", ".+\\.vpp|.+\\.vdmrt"), CML(
38:                         "-cml", ".+\\.cml|.+\\.vdmcml");
39:
40:         private final String argstring;
41:         private final Filter filter;
42:
43:         Dialect(String arg, String pattern)
44:         {
45:                 argstring = arg;
46:                 filter = new Filter(pattern);
47:         }
48:
49:         private static class Filter implements FilenameFilter
50:         {
51:                 private String pattern;
52:
53:                 public Filter(String pattern)
54:                 {
55:                         this.pattern = pattern;
56:                 }
57:
58:                 public boolean accept(File dir, String filename)
59:                 {
60:                         return filename.matches(pattern);
61:                 }
62:         }
63:
64:         public FilenameFilter getFilter()
65:         {
66:                 return filter;
67:         }
68:
69:         public String getArgstring()
70:         {
71:                 return argstring;
72:         }
73: }