Record Class ConceptNode

java.lang.Object
java.lang.Record
org.ek9lang.assist.ConceptNode
Record Components:
ring0 - Core synonyms (weight 1.0)
ring1 - Close relatives (weight 0.8)
ring2 - Related concepts (weight 0.6)
ring3 - Broader context (weight 0.4)
ring4 - Distant associations (weight 0.2)
ek9Links - Actual EK9 keywords/types for -h suggestions

public record ConceptNode(Set<String> ring0, Set<String> ring1, Set<String> ring2, Set<String> ring3, Set<String> ring4, Set<String> ek9Links) extends Record
A concept with concentric rings of weighted related terms and EK9 keyword links. Ring 0 contains the closest synonyms (weight 1.0), Ring 4 the most distant (weight 0.2). The ek9Links set contains actual EK9 keywords/types that the concept maps to.
  • Constructor Details

    • ConceptNode

      public ConceptNode(Set<String> ring0, Set<String> ring1, Set<String> ring2, Set<String> ring3, Set<String> ring4, Set<String> ek9Links)
      Creates an instance of a ConceptNode record class.
      Parameters:
      ring0 - the value for the ring0 record component
      ring1 - the value for the ring1 record component
      ring2 - the value for the ring2 record component
      ring3 - the value for the ring3 record component
      ring4 - the value for the ring4 record component
      ek9Links - the value for the ek9Links record component
  • Method Details

    • ringOf

      public int ringOf(String term)
      Find which ring a term belongs to.
      Returns:
      ring number (0-4) or -1 if not found
    • ringWeight

      public static double ringWeight(int ring)
      Get the weight for a given ring number.
      Returns:
      weight (1.0 to 0.2) or 0.0 for invalid ring
    • allTerms

      public Set<String> allTerms()
      Union of all terms across all rings.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • ring0

      public Set<String> ring0()
      Returns the value of the ring0 record component.
      Returns:
      the value of the ring0 record component
    • ring1

      public Set<String> ring1()
      Returns the value of the ring1 record component.
      Returns:
      the value of the ring1 record component
    • ring2

      public Set<String> ring2()
      Returns the value of the ring2 record component.
      Returns:
      the value of the ring2 record component
    • ring3

      public Set<String> ring3()
      Returns the value of the ring3 record component.
      Returns:
      the value of the ring3 record component
    • ring4

      public Set<String> ring4()
      Returns the value of the ring4 record component.
      Returns:
      the value of the ring4 record component
    • ek9Links

      public Set<String> ek9Links()
      Returns the value of the ek9Links record component.
      Returns:
      the value of the ek9Links record component