test_class.file: api/src/test/java/edu/wpi/first/shuffleboard/api/data/DataTypesTest.java
test_class.identifier: DataTypesTest
test_case.body: @Test
    public void testClosestTo() {
      final List<Class<?>> classes = Lists.newArrayList(C.class, B.class, D.class, A.class);
  
      classes.sort(closestTo(Object.class));
      assertEquals(Lists.newArrayList(D.class, C.class, B.class, A.class), classes);
  
      classes.sort(closestTo(D.class));
      assertEquals(Lists.newArrayList(A.class, B.class, C.class, D.class), classes);
    }
test_case.class_method_signature: DataTypesTest.testClosestTo()
test_case.full_signature: @Test public void testClosestTo()
test_case.identifier: testClosestTo
test_case.invocations: newArrayList sort closestTo assertEquals newArrayList sort closestTo assertEquals newArrayList
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testClosestTo()
focal_class.declarator: defaultInstance = null
focal_class.modifier: private static
focal_class.original_string: private static DataTypes defaultInstance = null;
focal_class.type: DataTypes
focal_class.var_name: defaultInstance
focal_class.declarator: None = NoneType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType None = NoneType.Instance;
focal_class.type: DataType
focal_class.var_name: None
focal_class.declarator: All = AllType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType All = AllType.Instance;
focal_class.type: DataType
focal_class.var_name: All
focal_class.declarator: Unknown = UnknownType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType Unknown = UnknownType.Instance;
focal_class.type: DataType
focal_class.var_name: Unknown
focal_class.declarator: Map = MapType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final ComplexDataType<MapData> Map = MapType.Instance;
focal_class.type: ComplexDataType<MapData>
focal_class.var_name: Map
focal_class.declarator: Boolean = BooleanType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<Boolean> Boolean = BooleanType.Instance;
focal_class.type: DataType<Boolean>
focal_class.var_name: Boolean
focal_class.declarator: BooleanArray = BooleanArrayType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<boolean[]> BooleanArray = BooleanArrayType.Instance;
focal_class.type: DataType<boolean[]>
focal_class.var_name: BooleanArray
focal_class.declarator: Number = NumberType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<Number> Number = NumberType.Instance;
focal_class.type: DataType<Number>
focal_class.var_name: Number
focal_class.declarator: NumberArray = NumberArrayType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<double[]> NumberArray = NumberArrayType.Instance;
focal_class.type: DataType<double[]>
focal_class.var_name: NumberArray
focal_class.declarator: String = StringType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<String> String = StringType.Instance;
focal_class.type: DataType<String>
focal_class.var_name: String
focal_class.declarator: StringArray = StringArrayType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<String[]> StringArray = StringArrayType.Instance;
focal_class.type: DataType<String[]>
focal_class.var_name: StringArray
focal_class.declarator: ByteArray = RawByteType.Instance
focal_class.modifier: public static final
focal_class.original_string: public static final DataType<byte[]> ByteArray = RawByteType.Instance;
focal_class.type: DataType<byte[]>
focal_class.var_name: ByteArray
focal_class.declarator: defaultTypes = ImmutableSet.of(
        // catchall
        None,
        All,
        Unknown,
        Map,
        // primitives
        Boolean,
        BooleanArray,
        Number,
        NumberArray,
        String,
        StringArray,
        ByteArray
    )
focal_class.modifier: private static final
focal_class.original_string: private static final ImmutableCollection<DataType<?>> defaultTypes = ImmutableSet.of(
        // catchall
        None,
        All,
        Unknown,
        Map,
        // primitives
        Boolean,
        BooleanArray,
        Number,
        NumberArray,
        String,
        StringArray,
        ByteArray
    );
focal_class.type: ImmutableCollection<DataType<?>>
focal_class.var_name: defaultTypes
focal_class.declarator: dataTypes = new TreeMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, DataType> dataTypes = new TreeMap<>();
focal_class.type: Map<String, DataType>
focal_class.var_name: dataTypes
focal_class.declarator: typeCache = new HashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<Class, Optional<DataType>> typeCache = new HashMap<>();
focal_class.type: Map<Class, Optional<DataType>>
focal_class.var_name: typeCache
focal_class.file: api/src/main/java/edu/wpi/first/shuffleboard/api/data/DataTypes.java
focal_class.identifier: DataTypes
focal_class.class_method_signature: DataTypes.getDefault()
focal_class.full_signature: public static DataTypes getDefault()
focal_class.identifier: getDefault
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: DataTypes
focal_class.signature: DataTypes getDefault()
focal_class.class_method_signature: DataTypes.DataTypes()
focal_class.full_signature: public  DataTypes()
focal_class.identifier: DataTypes
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  DataTypes()
focal_class.class_method_signature: DataTypes.setDefault(DataTypes instance)
focal_class.full_signature: @VisibleForTesting public static void setDefault(DataTypes instance)
focal_class.identifier: setDefault
focal_class.modifiers: @VisibleForTesting public static
focal_class.parameters: (DataTypes instance)
focal_class.return: void
focal_class.signature: void setDefault(DataTypes instance)
focal_class.class_method_signature: DataTypes.register(DataType dataType)
focal_class.full_signature: @Override public void register(DataType dataType)
focal_class.identifier: register
focal_class.modifiers: @Override public
focal_class.parameters: (DataType dataType)
focal_class.return: void
focal_class.signature: void register(DataType dataType)
focal_class.class_method_signature: DataTypes.unregister(DataType dataType)
focal_class.full_signature: @Override public void unregister(DataType dataType)
focal_class.identifier: unregister
focal_class.modifiers: @Override public
focal_class.parameters: (DataType dataType)
focal_class.return: void
focal_class.signature: void unregister(DataType dataType)
focal_class.class_method_signature: DataTypes.forName(String name)
focal_class.full_signature: public Optional<DataType> forName(String name)
focal_class.identifier: forName
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: Optional<DataType>
focal_class.signature: Optional<DataType> forName(String name)
focal_class.class_method_signature: DataTypes.forJavaType(Class<T> type)
focal_class.full_signature: @SuppressWarnings("unchecked") public Optional<DataType<T>> forJavaType(Class<T> type)
focal_class.identifier: forJavaType
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (Class<T> type)
focal_class.return: Optional<DataType<T>>
focal_class.signature: Optional<DataType<T>> forJavaType(Class<T> type)
focal_class.class_method_signature: DataTypes.forJavaTypes(Class<?>... types)
focal_class.full_signature: public Set<DataType> forJavaTypes(Class<?>... types)
focal_class.identifier: forJavaTypes
focal_class.modifiers: public
focal_class.parameters: (Class<?>... types)
focal_class.return: Set<DataType>
focal_class.signature: Set<DataType> forJavaTypes(Class<?>... types)
focal_class.class_method_signature: DataTypes.closestTo(Class<?> target)
focal_class.full_signature: @VisibleForTesting static Comparator<Class<?>> closestTo(Class<?> target)
focal_class.identifier: closestTo
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (Class<?> target)
focal_class.return: Comparator<Class<?>>
focal_class.signature: Comparator<Class<?>> closestTo(Class<?> target)
focal_class.class_method_signature: DataTypes.distance(Class<?> first, Class<?> other)
focal_class.full_signature: private static int distance(Class<?> first, Class<?> other)
focal_class.identifier: distance
focal_class.modifiers: private static
focal_class.parameters: (Class<?> first, Class<?> other)
focal_class.return: int
focal_class.signature: int distance(Class<?> first, Class<?> other)
focal_class.class_method_signature: DataTypes.forType(Class<D> clazz)
focal_class.full_signature: @SuppressWarnings("unchecked") public Optional<D> forType(Class<D> clazz)
focal_class.identifier: forType
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (Class<D> clazz)
focal_class.return: Optional<D>
focal_class.signature: Optional<D> forType(Class<D> clazz)
focal_class.class_method_signature: DataTypes.forTypes(Class<? extends DataType>... types)
focal_class.full_signature: public Set<DataType> forTypes(Class<? extends DataType>... types)
focal_class.identifier: forTypes
focal_class.modifiers: public
focal_class.parameters: (Class<? extends DataType>... types)
focal_class.return: Set<DataType>
focal_class.signature: Set<DataType> forTypes(Class<? extends DataType>... types)
focal_class.class_method_signature: DataTypes.isCompatible(DataType type, Collection<? extends DataType> types)
focal_class.full_signature: public static boolean isCompatible(DataType type, Collection<? extends DataType> types)
focal_class.identifier: isCompatible
focal_class.modifiers: public static
focal_class.parameters: (DataType type, Collection<? extends DataType> types)
focal_class.return: boolean
focal_class.signature: boolean isCompatible(DataType type, Collection<? extends DataType> types)
focal_class.superclass: extends Registry<DataType>
focal_method.body: @VisibleForTesting
    static Comparator<Class<?>> closestTo(Class<?> target) {
      return (o1, o2) -> {
        if (o1 == o2) {
          return 0;
        }
        if (o1 == null) {
          return -1;
        } else if (o2 == null) {
          return 1;
        }
        if (o1 == target) {
          return 1;
        } else if (o2 == target) {
          return -1;
        }
        return Integer.compare(distance(o2, target), distance(o1, target));
      };
    }
focal_method.class_method_signature: DataTypes.closestTo(Class<?> target)
focal_method.full_signature: @VisibleForTesting static Comparator<Class<?>> closestTo(Class<?> target)
focal_method.identifier: closestTo
focal_method.invocations: compare distance distance
focal_method.modifiers: @VisibleForTesting static
focal_method.parameters: (Class<?> target)
focal_method.return: Comparator<Class<?>>
focal_method.signature: Comparator<Class<?>> closestTo(Class<?> target)