Class UsageKnowledge<U>

  • Type Parameters:
    U - The type of a single usage occurrence.

    public class UsageKnowledge<U>
    extends Object
    Tracks, per type name, the list of recorded usage occurrences of a given kind — e.g. which ConsistsOf/IsRelatedTo relations a type participates in, or which types embed a given generic property type.
    Author:
    Luca Frosini (ISTI - CNR)
    • Constructor Detail

      • UsageKnowledge

        public UsageKnowledge​(AccessType accessType)
        Creates a new instance.
        Parameters:
        accessType - The access type.
    • Method Detail

      • add

        public void add​(String typeName,
                        U u)
        Adds a usage for a type.
        Parameters:
        typeName - The type name.
        u - The usage.
      • remove

        public void remove​(String typeName,
                           U u)
        Removes a previously recorded usage for a type, e.g. when a fallback usage is superseded by an authoritative one.
        Parameters:
        typeName - The type name.
        u - The usage to remove.
      • getUsage

        public List<U> getUsage​(String typeName)
        Returns the usages for a type.
        Parameters:
        typeName - The type name.
        Returns:
        The list of usages.
      • getTypeNames

        public Set<String> getTypeNames()
        Returns the names of every type that has at least one recorded usage.
        Returns:
        The set of type names with recorded usage.