providertypeenum.java

来自「270的linux说明」· Java 代码 · 共 203 行

JAVA
203
字号
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/package com.intel.mobile.base;/** * Present the status types for a specific protocol. */public final class ProviderTypeEnum{    private static int nextValue = 1;        public static final ProviderTypeEnum Battery = new ProviderTypeEnum("Battery");    public static final ProviderTypeEnum Processor    = new ProviderTypeEnum("Processor");    public static final ProviderTypeEnum LinkProtocol     = new ProviderTypeEnum("LinkProtocol");    public static final ProviderTypeEnum Protocol802_11 = new ProviderTypeEnum("Protocol802_11");    public static final ProviderTypeEnum Protocol802_3 = new ProviderTypeEnum("Protocol802_3");    public static final ProviderTypeEnum ProtocolCdma    = new ProviderTypeEnum("ProtocolCdma");    public static final ProviderTypeEnum ProtocolGprs     = new ProviderTypeEnum("ProtocolGprs");    public static final ProviderTypeEnum ProtocolWwan = new ProviderTypeEnum("ProtocolWwan");    public static final ProviderTypeEnum NetworkAdapter = new ProviderTypeEnum("NetworkAdapter");    public static final ProviderTypeEnum RadioAdapter    = new ProviderTypeEnum("RadioAdapter");    public static final ProviderTypeEnum WiredAdapter     = new ProviderTypeEnum("WiredAdapter");    public static final ProviderTypeEnum Context = new ProviderTypeEnum("Context");    public static final ProviderTypeEnum Platform = new ProviderTypeEnum("Platform");    public static final ProviderTypeEnum PhysicalDisk    = new ProviderTypeEnum("PhysicalDisk");    public static final ProviderTypeEnum LogicalDisk     = new ProviderTypeEnum("LogicalDisk");    public static final ProviderTypeEnum Memory = new ProviderTypeEnum("Memory");    public static final ProviderTypeEnum ProtocolBluetoothPan = new ProviderTypeEnum("ProtocolBluetoothPan");    public static final ProviderTypeEnum DisplayAdapter    = new ProviderTypeEnum("DisplayAdapter");        private int value;    private String desc;        // Constructor    private ProviderTypeEnum(String desc)    {        this.value = nextValue;        nextValue++;                this.desc = desc;    }        /**     * Get int value of the ModulationTypeEnum     * @return int     */    public int GetValue()    {        return value;    }        /**     * Override method     * @param obj     * @return boolean     */    public boolean equals(java.lang.Object obj)    {        if (obj instanceof ProviderTypeEnum)        {            return value == ((ProviderTypeEnum)obj).value;        }        return false;    }        /**     * Override method     * @return int     */    public int hashCode()    {        return value;    }        /**     * Override method     * @return java.lang.String     */    public String toString()    {        return desc;    }        /**     * Get protocol status type according to the int value.     * @param type int     * @return The pre-defined object     */    public static ProviderTypeEnum getProviderTypeEnum(int type)    {        if (type == Battery.value)        {            return Battery;        }        else if (type == Processor.value)        {            return Processor;        }        else if (type == LinkProtocol.value)        {            return LinkProtocol;        }        else if (type == Protocol802_11.value)        {            return Protocol802_11;        }        if (type == Protocol802_3.value)        {            return Protocol802_3;        }        else if (type == ProtocolCdma.value)        {            return ProtocolCdma;        }        else if (type == ProtocolGprs.value)        {            return ProtocolGprs;        }        else if (type == ProtocolWwan.value)        {            return ProtocolWwan;        }        if (type == NetworkAdapter.value)        {            return NetworkAdapter;        }        else if (type == RadioAdapter.value)        {            return RadioAdapter;        }        else if (type == WiredAdapter.value)        {            return WiredAdapter;        }        else if (type == Context.value)        {            return Context;        }        if (type == Platform.value)        {            return Platform;        }        else if (type == PhysicalDisk.value)        {            return PhysicalDisk;        }        else if (type == LogicalDisk.value)        {            return LogicalDisk;        }        else if (type == Memory.value)        {            return Memory;        }        if (type == ProtocolBluetoothPan.value)        {            return ProtocolBluetoothPan;        }        else if (type == DisplayAdapter.value)        {            return DisplayAdapter;        }        else        		return null;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?