litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
package org.litesoft.codegen;
import java.util.*;
public class GenerationReport
{
public enum Action
{
Created, Updated, NoChange
}
private Map<String, TypeReport> mTypes = new HashMap<String, TypeReport>();
public TypeReport getReportFor( String pType )
{
return mTypes.get( pType );
}
@Override
public String toString()
{
String[] zTypes = mTypes.keySet().toArray( new String[mTypes.size()] );
Arrays.sort( zTypes );
int zMaxLength = 0;
for ( String zType : zTypes )
{
zMaxLength = Math.max( zMaxLength, zType.length() );
}
StringBuilder sb = new StringBuilder();
for ( String zType : zTypes )
{
for ( int i = zMaxLength - zType.length(); i > 0; i-- )
{
sb.append( ' ' );
}
sb.append( zType ).append( ": " ).append( mTypes.get( zType ) ).append( '\n' );
}
return sb.toString();
}
public void add( String pReportingType, Action pAction )
{
TypeReport zTypeReport = mTypes.get( pReportingType );
if ( zTypeReport == null )
{
mTypes.put( pReportingType, zTypeReport = new TypeReport() );
}
zTypeReport.add( pAction );
}
public class TypeReport
{
private int mGenerated, mCreated, mUpdated;
public int getGenerated()
{
return mGenerated;
}
public int getCreated()
{
return mCreated;
}
public int getUpdated()
{
return mUpdated;
}
public int getWrote()
{
return mUpdated + mCreated;
}
private void add( Action pAction )
{
if ( pAction != null )
{
switch ( pAction )
{
case NoChange:
break;
case Created:
mCreated++;
break;
case Updated:
mUpdated++;
break;
default:
break;
}
mGenerated++;
}
}
@Override
public String toString()
{
return "" + mGenerated + " Generated, " + mUpdated + " Updated, " + mCreated + " Created -> " + getWrote();
}
}
}
|
Revision |
Author |
Commited |
Message |
2
|
GeorgeS
|
Sun 07 Feb, 2010 12:50:58 +0000 |
|