Class MapFact<K,V>

java.lang.Object
pascal.taie.analysis.dataflow.fact.MapFact<K,V>
Type Parameters:
K - type of keys
V - type of values
All Implemented Interfaces:
Copyable<MapFact<K,V>>
Direct Known Subclasses:
CPFact

public class MapFact<K,V> extends Object implements Copyable<MapFact<K,V>>
Represents map-like data-flow facts.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Map<K,V>
    The map holding the mappings of this MapFact.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapFact(Map<K,V> map)
    Constructs a new MapFact with the same mappings as specified Map.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all content in this fact.
    Creates and returns a copy of this fact.
    boolean
    Copies the content from given fact to this fact.
     
    boolean
     
    void
    forEach(BiConsumer<K,V> action)
    Performs the given action for each entry(key-value mapping) in this fact until all entries have been processed or the action throws an exception.
    get(K key)
     
    int
     
     
    remove(K key)
    Removes the key-value mapping for given key.
     
    boolean
    update(K key, V value)
    Updates the key-value mapping in this fact.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • map

      protected final Map<K,V> map
      The map holding the mappings of this MapFact.
  • Constructor Details

    • MapFact

      public MapFact(Map<K,V> map)
      Constructs a new MapFact with the same mappings as specified Map.
      Parameters:
      map - the map whose mappings are to be placed in this map.
  • Method Details

    • get

      public V get(K key)
      Returns:
      the value to which the specified key is mapped, or null if this map contains no mapping for the key.
    • update

      public boolean update(K key, V value)
      Updates the key-value mapping in this fact.
      Returns:
      if the update changes this fact.
    • remove

      public V remove(K key)
      Removes the key-value mapping for given key.
      Returns:
      the previous value associated with key, or null if there was no mapping for key.
    • copyFrom

      public boolean copyFrom(MapFact<K,V> fact)
      Copies the content from given fact to this fact.
      Returns:
      true if this fact changed as a result of the call, otherwise false.
    • copy

      public MapFact<K,V> copy()
      Creates and returns a copy of this fact.
      Specified by:
      copy in interface Copyable<K>
      Returns:
      a copy of this object.
    • clear

      public void clear()
      Clears all content in this fact.
    • keySet

      public Set<K> keySet()
      Returns:
      a Set view of the keys contained in this fact.
    • entries

      public Stream<Map.Entry<K,V>> entries()
      Returns:
      all entries (key-value mappings) in this fact.
    • forEach

      public void forEach(BiConsumer<K,V> action)
      Performs the given action for each entry(key-value mapping) in this fact until all entries have been processed or the action throws an exception.
      Parameters:
      action - the action to be performed for each entry.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object