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 applied rotor polarity.  This typically is determined by the Inverted
013 *  config, but can be overridden if using Follower features.
014 *
015 * @deprecated Classes in the phoenixpro package will be removed in 2024.
016 *             Users should instead use classes from the phoenix6 package.
017 */
018@Deprecated(forRemoval = true)
019public enum AppliedRotorPolarityValue
020{
021    PositiveIsCounterClockwise(0),
022    PositiveIsClockwise(1),;
023
024    public final int value;
025
026    AppliedRotorPolarityValue(int initValue)
027    {
028        this.value = initValue;
029    }
030
031    private static HashMap<Integer, AppliedRotorPolarityValue> _map = null;
032    static
033    {
034        _map = new HashMap<Integer, AppliedRotorPolarityValue>();
035        for (AppliedRotorPolarityValue type : AppliedRotorPolarityValue.values())
036        {
037            _map.put(type.value, type);
038        }
039    }
040
041    /**
042     * Gets AppliedRotorPolarityValue from specified value
043     * @param value Value of AppliedRotorPolarityValue
044     * @return AppliedRotorPolarityValue of specified value
045     */
046    public static AppliedRotorPolarityValue valueOf(int value)
047    {
048        AppliedRotorPolarityValue retval = _map.get(value);
049        if(retval != null) return retval;
050        return AppliedRotorPolarityValue.values()[0];
051    }
052}