Interface Supracontext

  • All Known Implementing Classes:
    BasicSupra, ClassifiedSupra, Concept, LinkedLatticeNode

    public interface Supracontext
    A supracontext contains a set of Subcontexts which have certain commonalities in their Labels. Classifying data sets with analogical modeling tends to create many supracontexts with the exact same set of subcontexts. To save time and space, duplicate supracontexts should be kept track of using the count instead of by saving separate Supracontext objects. The count is stored in a BigInteger object and starts out as one and is never allowed to fall below zero, which indicates that the object should be discarded.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void add​(Subcontext sub)
      Add a subcontext to this supracontext.
      Supracontext copy()
      Return an exact, deep copy of the supracontext.
      boolean equals​(java.lang.Object other)
      Two Supracontexts are equal if they are of the same class and contain the same subcontexts.
      default Label getContext()
      Retrieve the supracontextual context, represented with a Label object.
      java.math.BigInteger getCount()  
      java.util.Set<Subcontext> getData()  
      int hashCode()
      The hashcode depends solely on the set of subcontexts contained in a supracontext.
      boolean isEmpty()  
      void setCount​(java.math.BigInteger count)
      Set the count of the supracontext.
    • Method Detail

      • copy

        Supracontext copy()
        Return an exact, deep copy of the supracontext. The new object should be an instance of the same class as the calling object.
        Returns:
        a deep copy of this supracontext.
      • getData

        java.util.Set<Subcontext> getData()
        Returns:
        an unmodifiable view of the set of subcontexts contained in this supracontext.
      • add

        void add​(Subcontext sub)
        Add a subcontext to this supracontext.
        Parameters:
        sub - Subcontext to add to the supracontext.
      • isEmpty

        boolean isEmpty()
        Returns:
        true if this supracontext contains no subcontexts; false otherwise.
      • getCount

        java.math.BigInteger getCount()
        Returns:
        the number of copies of this supracontext contained in the lattice
      • setCount

        void setCount​(java.math.BigInteger count)
        Set the count of the supracontext.
        Parameters:
        count - the count
        Throws:
        java.lang.IllegalArgumentException - if c is null or less than BigInteger.ZERO
      • getContext

        default Label getContext()
        Retrieve the supracontextual context, represented with a Label object. Label mismatches should be interpreted as "contained subcontexts may or may not match for this attribute, while matches should be regarded as "all contained subcontexts matched for this attribute". The running time for this default implementation is linear in the number of contained subcontexts.
        Returns:
        The context for this supracontext, or null if the subcontexts are empty
      • equals

        boolean equals​(java.lang.Object other)
        Two Supracontexts are equal if they are of the same class and contain the same subcontexts.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        int hashCode()
        The hashcode depends solely on the set of subcontexts contained in a supracontext.
        Overrides:
        hashCode in class java.lang.Object