001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenixpro.signals; 008 009import java.util.HashMap; 010 011/** 012 * The range of the absolute sensor, either [0, 1) or [-0.5, 0.5). 013 * 014 * @deprecated Classes in the phoenixpro package will be removed in 2024. 015 * Users should instead use classes from the phoenix6 package. 016 */ 017@Deprecated(forRemoval = true) 018public enum AbsoluteSensorRangeValue 019{ 020 Unsigned_0To1(0), 021 Signed_PlusMinusHalf(1),; 022 023 public final int value; 024 025 AbsoluteSensorRangeValue(int initValue) 026 { 027 this.value = initValue; 028 } 029 030 private static HashMap<Integer, AbsoluteSensorRangeValue> _map = null; 031 static 032 { 033 _map = new HashMap<Integer, AbsoluteSensorRangeValue>(); 034 for (AbsoluteSensorRangeValue type : AbsoluteSensorRangeValue.values()) 035 { 036 _map.put(type.value, type); 037 } 038 } 039 040 /** 041 * Gets AbsoluteSensorRangeValue from specified value 042 * @param value Value of AbsoluteSensorRangeValue 043 * @return AbsoluteSensorRangeValue of specified value 044 */ 045 public static AbsoluteSensorRangeValue valueOf(int value) 046 { 047 AbsoluteSensorRangeValue retval = _map.get(value); 048 if(retval != null) return retval; 049 return AbsoluteSensorRangeValue.values()[0]; 050 } 051}