gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
refactor - packages
[mjc2wsl.git] / src / com / qumaster / transformations / TransMessages.java
1 package com.qumaster.transformations;
2 /*
3 Copyright (C) 2014 Doni Pracner
5 This file is part of mjc2wsl.
7 mjc2wsl is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 mjc2wsl 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.
17 You should have received a copy of the GNU General Public License
18 along with mjc2wsl. If not, see <http://www.gnu.org/licenses/>.
19 */
20 import java.io.PrintStream;
22 /**
23 * Handle the messages that the translator (or someone else) will
24 * give to this class depending on the print level.
25 *
26 */
27 public class TransMessages {
28 private int printLevel;
29 public int[] messageCounters;
30 public static final int M_DEB = 0;
31 public static final int M_WAR = 1;
32 public static final int M_ERR = 2;
33 public static final int M_QUIET = 3;
34 private PrintStream outStream = System.out;
36 public TransMessages() {
37 this.setPrintLevel(M_ERR);
38 this.messageCounters = new int[TransMessages.M_QUIET];
39 }
41 public void message(String mes, int level){
42 if (level>=getPrintLevel()) {
43 outStream.println(mes);
44 }
45 messageCounters[level]++;
46 }
48 public void printMessageCounters(PrintStream out){
49 out.println("total errors:"+messageCounters[TransMessages.M_ERR]+" warnings:"+messageCounters[TransMessages.M_WAR]);
50 }
52 public void printMessageCounters(){
53 printMessageCounters(outStream);
54 }
56 public int getPrintLevel() {
57 return printLevel;
58 }
60 public void setPrintLevel(int printLevel) {
61 this.printLevel = printLevel;
62 }
63 }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner