1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  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,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package convwatch;
25 
26 public class StatusHelper
27 {
28     final static public int DIFF_NOT_REALLY_INITIALISED =            1;
29     final static public int DIFF_NO_DIFFERENCES =                    2;
30     final static public int DIFF_DIFFERENCES_FOUND =                 3;
31     final static public int DIFF_AFTER_MOVE_DONE_NO_PROBLEMS =       4;
32     final static public int DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND = 5;
33 
34     // public String m_sOutputPath;
35     public String m_sMainName;
36 
37     public String m_sOldGfx;
38     public String m_sNewGfx;
39     public String m_sDiffGfx;
40     public int nDiffStatus = DIFF_NOT_REALLY_INITIALISED;
41     public int nPercent = 0;
42 
43     // BorderMove Values
44     public int nPercent2 = 0;
45     public String m_sOld_BM_Gfx;
46     public String m_sNew_BM_Gfx;
47     public String m_sDiff_BM_Gfx;
48 
StatusHelper(String _sOldGfx, String _sNewGfx, String _sDiffGfx)49     public StatusHelper(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
50         {
51             m_sOldGfx = _sOldGfx;
52             m_sNewGfx = _sNewGfx;
53             m_sDiffGfx = _sDiffGfx;
54         }
setFilesForBorderMove(String _sOldGfx, String _sNewGfx, String _sDiffGfx)55     public void setFilesForBorderMove(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
56         {
57             m_sOld_BM_Gfx = _sOldGfx;
58             m_sNew_BM_Gfx = _sNewGfx;
59             m_sDiff_BM_Gfx = _sDiffGfx;
60 
61         }
62 
printStatus()63     public void printStatus()
64         {
65             GlobalLogWriter.get().println("  Original file: " + m_sOldGfx);
66             GlobalLogWriter.get().println("       New file: " + m_sNewGfx);
67             GlobalLogWriter.get().println("Difference file: " + m_sDiffGfx);
68             if (nDiffStatus == DIFF_NOT_REALLY_INITIALISED)
69             {
70                 GlobalLogWriter.get().println("Early problem, may be the files doesn't exist.");
71             }
72             else if (nDiffStatus == DIFF_NO_DIFFERENCES)
73             {
74                 GlobalLogWriter.get().println("No differences found, ok.");
75             }
76             else if (nDiffStatus == DIFF_DIFFERENCES_FOUND)
77             {
78                 GlobalLogWriter.get().println("Files differ by " + String.valueOf(nPercent) + "%");
79             }
80             else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_NO_PROBLEMS)
81             {
82                 GlobalLogWriter.get().println("No differences found, after move picture.");
83             }
84             else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND)
85             {
86                 GlobalLogWriter.get().println("A picture move is done, the files differ by " + String.valueOf(nPercent2) + " old was " + String.valueOf(nPercent) + "%");
87             }
88             else
89             {
90                 GlobalLogWriter.get().println("Unknown DIFF_ values used, not handles yet.");
91             }
92         }
93 
94 
95 
96 
97 
98 //  TODO: stream output
99 //     public stream& statusline(stream)
100 //         {
101 //             stream << name << "PASS" << nDiff==0?"PASS":"FAIL" << endl;
102 //             return stream;
103 //         }
104 }
105