Updated to worldwind release 20070817
[worldwind-tracker.git] / gov / nasa / worldwind / util / PerformanceStatistic.java
blob07b9921bdd765f5f085aa030628745f78371153a
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";
20 public static final Set<String> ALL_STATISTICS_SET = new HashSet<String>(1);
21 static
23 ALL_STATISTICS_SET.add(PerformanceStatistic.ALL);
26 private final String key;
27 private final String displayString;
28 private final Object value;
30 public PerformanceStatistic(String key, String displayString, Object value)
32 this.key = key;
33 this.displayString = displayString;
34 this.value = value;
37 public String getKey()
39 return key;
42 public String getDisplayString()
44 return displayString;
47 public Object getValue()
49 return value;
52 public int compareTo(PerformanceStatistic that)
54 //noinspection StringEquality
55 if (this.displayString == that.displayString)
56 return 0;
58 if (this.displayString != null && that.displayString != null)
59 return this.displayString.compareTo(that.displayString);
61 return this.displayString == null ? -1 : 1;
64 public boolean equals(Object o)
66 if (this == o)
67 return true;
68 if (o == null || getClass() != o.getClass())
69 return false;
71 PerformanceStatistic that = (PerformanceStatistic) o;
73 if (displayString != null ? !displayString.equals(that.displayString) : that.displayString != null)
74 return false;
75 if (key != null ? !key.equals(that.key) : that.key != null)
76 return false;
77 //noinspection RedundantIfStatement
78 if (value != null ? !value.equals(that.value) : that.value != null)
79 return false;
81 return true;
84 public int hashCode()
86 int result;
87 result = (key != null ? key.hashCode() : 0);
88 result = 31 * result + (displayString != null ? displayString.hashCode() : 0);
89 result = 31 * result + (value != null ? value.hashCode() : 0);
90 return result;
93 public String toString()
95 return this.displayString + " " + this.value.toString();