1 /*
2 * #%L
3 * Mojo's Maven plugin for Cobertura
4 * %%
5 * Copyright (C) 2005 - 2013 Codehaus
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package org.codehaus.mojo.cobertura.configuration;
21
22 import java.util.HashSet;
23 import java.util.Set;
24
25 /**
26 * The Configuration for Check Settings.
27 *
28 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
29 */
30 public class ConfigCheck
31 {
32 private String branchRate;
33
34 private boolean haltOnFailure = true;
35
36 private String lineRate;
37
38 private Set<Regex> regexes = new HashSet<Regex>();
39
40 private String totalBranchRate;
41
42 private String totalLineRate;
43
44 private String packageBranchRate;
45
46 private String packageLineRate;
47
48 /**
49 * The maximum heap size to use for the check phase.
50 */
51 private String maxmem;
52
53 /**
54 * add a regex to the set used to scan the reports.
55 *
56 * @param regex the regex to add.
57 */
58 public void addRegex( Regex regex )
59 {
60 this.regexes.add( regex );
61 }
62
63 /**
64 * Create a regex object for eventual inclusion.
65 *
66 * @return the regex
67 */
68 public Regex createRegex()
69 {
70 Regex regex = new Regex();
71 this.regexes.add( regex );
72 return regex;
73 }
74
75 /**
76 * @return Returns the branchRate.
77 */
78 public String getBranchRate()
79 {
80 return branchRate;
81 }
82
83 /**
84 * @return Returns the lineRate.
85 */
86 public String getLineRate()
87 {
88 return lineRate;
89 }
90
91 /**
92 * @return Returns the regexes.
93 */
94 public Set<Regex> getRegexes()
95 {
96 return regexes;
97 }
98
99 /**
100 * @return Returns the totalBranchRate.
101 */
102 public String getTotalBranchRate()
103 {
104 return totalBranchRate;
105 }
106
107 /**
108 * @return Returns the totalLineRate.
109 */
110 public String getTotalLineRate()
111 {
112 return totalLineRate;
113 }
114
115 /**
116 * @return Returns the haltOnFailure.
117 */
118 public boolean isHaltOnFailure()
119 {
120 return haltOnFailure;
121 }
122
123 /**
124 * @param branchRate The branchRate to set.
125 */
126 public void setBranchRate( String branchRate )
127 {
128 this.branchRate = branchRate;
129 }
130
131 /**
132 * @param haltOnFailure The haltOnFailure to set.
133 */
134 public void setHaltOnFailure( boolean haltOnFailure )
135 {
136 this.haltOnFailure = haltOnFailure;
137 }
138
139 /**
140 * @param lineRate The lineRate to set.
141 */
142 public void setLineRate( String lineRate )
143 {
144 this.lineRate = lineRate;
145 }
146
147 /**
148 * @param regexes The regexes to set.
149 */
150 public void setRegexes( Set<Regex> regexes )
151 {
152 this.regexes = new HashSet<Regex>( regexes );
153 }
154
155 /**
156 * @param totalBranchRate The totalBranchRate to set.
157 */
158 public void setTotalBranchRate( String totalBranchRate )
159 {
160 this.totalBranchRate = totalBranchRate;
161 }
162
163 /**
164 * @param totalLineRate The totalLineRate to set.
165 */
166 public void setTotalLineRate( String totalLineRate )
167 {
168 this.totalLineRate = totalLineRate;
169 }
170
171 /**
172 * @return the package branch rate.
173 */
174 public String getPackageBranchRate()
175 {
176 return packageBranchRate;
177 }
178
179 /**
180 * @return the package line rate.
181 */
182 public String getPackageLineRate()
183 {
184 return packageLineRate;
185 }
186
187 /**
188 * Get the maxmem setting.
189 *
190 * @return the maxmem setting.
191 */
192 public String getMaxmem()
193 {
194 return maxmem;
195 }
196
197 /**
198 * Sets the max memory for the JVM used to run the <code>CheckTask</code> task.
199 * <p/>
200 * The format is "<value><size>". Ex: "64m" where 64 is the value, and "m" denotes megabytes.
201 *
202 * @param maxmem the value to which maxmem will be set
203 */
204 public void setMaxmem( String maxmem )
205 {
206 this.maxmem = maxmem;
207 }
208 }