Record Class Names

java.lang.Object
java.lang.Record
org.clafer.frontend.Names
Record Components:
clafers - the clafers of the model, enumerations and their literals included, in declaration order
uses - the clafer each written name refers to, by the name's span

public record Names(List<Symbols.ClaferSymbol> clafers, Map<SourceSpan, Symbols.ClaferSymbol> uses) extends Record
What the names of a model refer to, for the language server: the clafers, whose Symbols.ClaferSymbol.nameSpan() is where each is declared, and the clafer that each written name refers to, by the span of the name.

The names are those of the constraints, assertions, objectives, initial values and reference targets, as the resolver resolves them, and those of the supers and the references to a clafer by name, as the symbols resolve them. In a path a.b or A\b, each name has its own span. The special names (this, parent, dref, ...), the primitive types and the locals of quantifiers and let are not in it. The spans are in the lines of the model, the files of its imports first (ModelFiles.position(int)).

  • Field Details

    • None

      public static final Names None
      The names of a model that has errors before the resolver.
  • Constructor Details

  • Method Details

    • isClaferName

      public static boolean isClaferName(String name)
      Parameters:
      name - a word
      Returns:
      whether a clafer or a local can be named so: it lexes as one name, and it is neither a reserved word nor one of the words that no clafer can be named
    • 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.
    • clafers

      Returns the value of the clafers record component.
      Returns:
      the value of the clafers record component
    • uses

      Returns the value of the uses record component.
      Returns:
      the value of the uses record component