Update to Worldwind release 0.4.0
[worldwind-tracker.git] / gov / nasa / worldwind / util / PerformanceStatistic.java
blob28b3bec1deb7e8a1c892f48eecc34ebe61307cd2
1 /*
2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
5 All Rights Reserved.
6 */
7 package gov.nasa.worldwind.util;
9 import java.util.*;
11 public class PerformanceStatistic implements Comparable<PerformanceStatistic>
13 public static final String ALL = "gov.nasa.worldwind.perfstat.All";
14 public static final String FRAME_RATE = "gov.nasa.worldwind.perfstat.FrameRate";
15 public static final String FRAME_TIME = "gov.nasa.worldwind.perfstat.FrameTime";
16 public static final String IMAGE_TILE_COUNT = "gov.nasa.worldwind.perfstat.ImageTileCount";
17 public static final String TERRAIN_TILE_COUNT = "gov.nasa.worldwind.perfstat.TerrainTileCount";
18 public static final String MEMORY_CACHE = "gov.nasa.worldwind.perfstat.MemoryCache";
19 public static final String PICK_TIME = "gov.nasa.worldwind.perfstat.PickTime";
20 public static final String TEXTURE_CACHE = "gov.nasa.worldwind.perfstat.TextureCache";
22 public static final Set<String> ALL_STATISTICS_SET = new HashSet<String>(1);
23 static
25 ALL_STATISTICS_SET.add(PerformanceStatistic.ALL);
28 private final String key;
29 private final String displayString;
30 private final Object value;
32 public PerformanceStatistic(String key, String displayString, Object value)
34 this.key = key;
35 this.displayString = displayString;
36 this.value = value;
39 public String getKey()
41 return key;
44 public String getDisplayString()
46 return displayString;
49 public Object getValue()
51 return value;
54 public int compareTo(PerformanceStatistic that)
56 //noinspection StringEquality
57 if (this.displayString == that.displayString)
58 return 0;
60 if (this.displayString != null && that.displayString != null)
61 return this.displayString.compareTo(that.displayString);
63 return this.displayString == null ? -1 : 1;
66 public boolean equals(Object o)
68 if (this == o)
69 return true;
70 if (o == null || getClass() != o.getClass())
71 return false;
73 PerformanceStatistic that = (PerformanceStatistic) o;
75 if (displayString != null ? !displayString.equals(that.displayString) : that.displayString != null)
76 return false;
77 if (key != null ? !key.equals(that.key) : that.key != null)
78 return false;
79 //noinspection RedundantIfStatement
80 if (value != null ? !value.equals(that.value) : that.value != null)
81 return false;
83 return true;
86 public int hashCode()
88 int result;
89 result = (key != null ? key.hashCode() : 0);
90 result = 31 * result + (displayString != null ? displayString.hashCode() : 0);
91 result = 31 * result + (value != null ? value.hashCode() : 0);
92 return result;
95 public String toString()
97 return this.displayString + " " + this.value.toString();