Statisticspublic final class Statistics extends Object Statistics about the contents of a file. |
Fields Summary |
---|
private final HashMap | dataMapnon-null; data about each type of item |
Constructors Summary |
---|
public Statistics()Constructs an instance.
dataMap = new HashMap<String, Data>(50);
|
Methods Summary |
---|
public void | add(Item item)Adds the given item to the statistics.
String typeName = item.typeName();
Data data = dataMap.get(typeName);
if (data == null) {
dataMap.put(typeName, new Data(item, typeName));
} else {
data.add(item);
}
| public void | addAll(Section list)Adds the given list of items to the statistics.
Collection<? extends Item> items = list.items();
for (Item item : items) {
add(item);
}
| public java.lang.String | toHuman()
StringBuilder sb = new StringBuilder();
sb.append("Statistics:\n");
TreeMap<String, Data> sortedData = new TreeMap<String, Data>();
for (Data data : dataMap.values()) {
sortedData.put(data.name, data);
}
for (Data data : sortedData.values()) {
sb.append(data.toHuman());
}
return sb.toString();
| public final void | writeAnnotation(com.android.dx.util.AnnotatedOutput out)Writes the statistics as an annotation.
if (dataMap.size() == 0) {
return;
}
out.annotate(0, "\nstatistics:\n");
TreeMap<String, Data> sortedData = new TreeMap<String, Data>();
for (Data data : dataMap.values()) {
sortedData.put(data.name, data);
}
for (Data data : sortedData.values()) {
data.writeAnnotation(out);
}
|
|