Class ExtEnvUtils

java.lang.Object
fr.inria.rules.integraal.api.external.ExtEnvUtils

@Deprecated public final class ExtEnvUtils extends Object
Deprecated.
Utility methods for manipulating externally visible environment registries.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> boolean
    contains(Map<String,T> map, String name)
    Deprecated.
    Checks if a specified key exists in the given map.
    static <T> T
    discard(Map<String,T> map, String name)
    Deprecated.
    Removes the key-value pair associated with the specified key from the map.
    static <T> T
    getByName(Map<String,T> map, String name)
    Deprecated.
    Retrieves the value associated with the specified key from the given map.
    static <T> Set<String>
    list(Map<String,T> map)
    Deprecated.
    Lists all the keys in the given map.
    static <T> String
    newName(Map<String,T> map, String prefix)
    Deprecated.
    Generates a new name with the given prefix that does not already exist in the map.
    static <T> T
    rename(Map<String,T> map, String oldName, String newName)
    Deprecated.
    Renames a key in the map to a new name.
    static <T> T
    replace(Map<String,T> map, String name, T container)
    Deprecated.
    Replaces the value associated with the specified key in the map.
    static <T> T
    store(Map<String,T> map, String name, T container)
    Deprecated.
    Stores a new key-value pair in the map if the key does not already exist.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • list

      public static <T> Set<String> list(Map<String,T> map)
      Deprecated.
      Lists all the keys in the given map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map from which to list keys.
      Returns:
      A set of all keys in the map.
    • contains

      public static <T> boolean contains(Map<String,T> map, String name)
      Deprecated.
      Checks if a specified key exists in the given map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map in which to check the key.
      name - The key to check for.
      Returns:
      True if the key exists in the map, otherwise false.
    • getByName

      public static <T> T getByName(Map<String,T> map, String name)
      Deprecated.
      Retrieves the value associated with the specified key from the given map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map from which to get the value.
      name - The key whose associated value is to be returned.
      Returns:
      The value associated with the specified key, or null if the key is not found.
    • newName

      public static <T> String newName(Map<String,T> map, String prefix) throws IllegalStateException
      Deprecated.
      Generates a new name with the given prefix that does not already exist in the map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map against which uniqueness is checked.
      prefix - The prefix to use for the generated name.
      Returns:
      A new unique name.
      Throws:
      IllegalStateException - If a unique name could not be generated after several attempts.
    • store

      public static <T> T store(Map<String,T> map, String name, T container) throws IllegalStateException
      Deprecated.
      Stores a new key-value pair in the map if the key does not already exist.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map in which to store the key-value pair.
      name - The key to store.
      container - The value to associate with the key.
      Returns:
      The previous value associated with the key, or null if there was no previous value.
      Throws:
      IllegalStateException - If the key already exists in the map.
    • replace

      public static <T> T replace(Map<String,T> map, String name, T container)
      Deprecated.
      Replaces the value associated with the specified key in the map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map in which to replace the value.
      name - The key whose value is to be replaced.
      container - The new value to associate with the key.
      Returns:
      The previous value associated with the key, or null if there was no previous value.
    • discard

      public static <T> T discard(Map<String,T> map, String name) throws NoSuchElementException
      Deprecated.
      Removes the key-value pair associated with the specified key from the map.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map from which to remove the key-value pair.
      name - The key whose associated key-value pair is to be removed.
      Returns:
      The value that was associated with the key, or null if the key was not found.
      Throws:
      NoSuchElementException - If the key does not exist in the map.
    • rename

      public static <T> T rename(Map<String,T> map, String oldName, String newName) throws IllegalStateException, NoSuchElementException
      Deprecated.
      Renames a key in the map to a new name.
      Type Parameters:
      T - The type of values in the map.
      Parameters:
      map - The map in which to rename the key.
      oldName - The old key name.
      newName - The new key name.
      Returns:
      The value associated with the new key name.
      Throws:
      IllegalStateException - If the new key already exists in the map.
      NoSuchElementException - If the old key does not exist in the map.