All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.gov.nasa.worldwind.util.PerformanceStatistic Maven / Gradle / Ivy

Go to download

World Wind is a collection of components that interactively display 3D geographic information within Java applications or applets.

There is a newer version: 2.0.0-986
Show newest version
/*
 * Copyright (C) 2012 United States Government as represented by the Administrator of the
 * National Aeronautics and Space Administration.
 * All Rights Reserved.
 */
package gov.nasa.worldwind.util;

import java.util.*;

public class PerformanceStatistic implements Comparable
{
    public static final String ALL = "gov.nasa.worldwind.perfstat.All";
    public static final String AIRSPACE_GEOMETRY_COUNT = "gov.nasa.worldwind.perfstat.AirspaceGeometryCount";
    public static final String AIRSPACE_VERTEX_COUNT = "gov.nasa.worldwind.perfstat.AirspaceVertexCount";
    public static final String FRAME_RATE = "gov.nasa.worldwind.perfstat.FrameRate";
    public static final String FRAME_TIME = "gov.nasa.worldwind.perfstat.FrameTime";
    public static final String IMAGE_TILE_COUNT = "gov.nasa.worldwind.perfstat.ImageTileCount";
    public static final String TERRAIN_TILE_COUNT = "gov.nasa.worldwind.perfstat.TerrainTileCount";
    public static final String MEMORY_CACHE = "gov.nasa.worldwind.perfstat.MemoryCache";
    public static final String PICK_TIME = "gov.nasa.worldwind.perfstat.PickTime";
    public static final String JVM_HEAP = "gov.nasa.worldwind.perfstat.JvmHeap";
    public static final String JVM_HEAP_USED = "gov.nasa.worldwind.perfstat.JvmHeapUsed";
    public static final String TEXTURE_CACHE = "gov.nasa.worldwind.perfstat.TextureCache";

    public static final Set ALL_STATISTICS_SET = new HashSet(1);
    static
    {
        ALL_STATISTICS_SET.add(PerformanceStatistic.ALL);
    }

    private final String key;
    private final String displayString;
    private final Object value;

    public PerformanceStatistic(String key, String displayString, Object value)
    {
        this.key = key;
        this.displayString = displayString;
        this.value = value;
    }

    public String getKey()
    {
        return key;
    }

    public String getDisplayString()
    {
        return displayString;
    }

    public Object getValue()
    {
        return value;
    }

    public int compareTo(PerformanceStatistic that)
    {
        //noinspection StringEquality
        if (this.displayString == that.displayString)
            return 0;

        if (this.displayString != null && that.displayString != null)
            return this.displayString.compareTo(that.displayString);

        return this.displayString == null ? -1 : 1;
    }

    public boolean equals(Object o)
    {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        PerformanceStatistic that = (PerformanceStatistic) o;

        if (displayString != null ? !displayString.equals(that.displayString) : that.displayString != null)
            return false;
        if (key != null ? !key.equals(that.key) : that.key != null)
            return false;
        //noinspection RedundantIfStatement
        if (value != null ? !value.equals(that.value) : that.value != null)
            return false;

        return true;
    }

    public int hashCode()
    {
        int result;
        result = (key != null ? key.hashCode() : 0);
        result = 31 * result + (displayString != null ? displayString.hashCode() : 0);
        result = 31 * result + (value != null ? value.hashCode() : 0);
        return result;
    }

    public String toString()
    {
        return this.displayString + " " + this.value.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy