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.phoenix6.signals; 008 009import java.util.HashMap; 010 011/** 012 * Invert state of the device as seen from the front of the motor. 013 */ 014public enum InvertedValue 015{ 016 /** 017 * Positive motor output results in counter-clockwise motion. 018 */ 019 CounterClockwise_Positive(0), 020 /** 021 * Positive motor output results in clockwise motion. 022 */ 023 Clockwise_Positive(1),; 024 025 public final int value; 026 027 InvertedValue(int initValue) 028 { 029 this.value = initValue; 030 } 031 032 private static HashMap<Integer, InvertedValue> _map = null; 033 static 034 { 035 _map = new HashMap<Integer, InvertedValue>(); 036 for (InvertedValue type : InvertedValue.values()) 037 { 038 _map.put(type.value, type); 039 } 040 } 041 042 /** 043 * Gets InvertedValue from specified value 044 * @param value Value of InvertedValue 045 * @return InvertedValue of specified value 046 */ 047 public static InvertedValue valueOf(int value) 048 { 049 InvertedValue retval = _map.get(value); 050 if (retval != null) return retval; 051 return InvertedValue.values()[0]; 052 } 053}