Package: DefaultConsolePrinter
DefaultConsolePrinter
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error(String) |
|
|
|
|
|
||||||||||||||||||||
errorln(String) |
|
|
|
|
|
||||||||||||||||||||
getDefaultLogger() |
|
|
|
|
|
||||||||||||||||||||
print(String) |
|
|
|
|
|
||||||||||||||||||||
println(String) |
|
|
|
|
|
Coverage
1: /*
2: * #%~
3: * VDM Code Generator
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.codegen.printer;
23:
24: public class DefaultConsolePrinter extends AbstractPrinter
25: {
26:
27:         private static DefaultConsolePrinter log;
28:
29:         public static DefaultConsolePrinter getDefaultLogger()
30:         {
31:•                if (log == null)
32:                 {
33:                         log = new DefaultConsolePrinter();
34:                 }
35:
36:                 return log;
37:         }
38:
39:         protected boolean silent;
40:
41:         private DefaultConsolePrinter()
42:         {
43:                 super();
44:         }
45:         
46:         @Override
47:         public void println(String msg)
48:         {
49:•                if (silent)
50:                 {
51:                         return;
52:                 }
53:
54:                 System.out.println(msg);
55:         }
56:
57:         @Override
58:         public void print(String msg)
59:         {
60:•                if (silent)
61:                 {
62:                         return;
63:                 }
64:
65:                 System.out.print(msg);
66:         }
67:
68:         @Override
69:         public void errorln(String msg)
70:         {
71:•                if (silent)
72:                 {
73:                         return;
74:                 }
75:
76:                 System.err.println(msg);
77:         }
78:
79:         @Override
80:         public void error(String msg)
81:         {
82:•                if (silent)
83:                 {
84:                         return;
85:                 }
86:
87:                 System.err.print(msg);
88:         }
89:
90: }