Record Class AssignmentStatement

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.AssignmentStatement
Record Components:
exported - true if this name is importable by other files; false when the private modifier is present
name - the symbol name; must not be blank
body - the right-hand side (RA expression or inline table)
location - the source location of this statement; never null
All Implemented Interfaces:
Statement

public record AssignmentStatement(boolean exported, String name, AssignmentBody body, SourceLocation location) extends Record implements Statement
An assignment statement — gives a name to a relational algebra expression or an inline table.

Syntax forms:

   // Named view (query assignment body)
   ActiveUsers := { σ status = "active" (Users) };

   // Inline Markdown table
   Cities := [
   | name         | country |
   |--------------|---------|
   | Chicago, IL  | US      |
   | London       | UK      |
   ];

   // Inline CSV table
   Cities := csv[
       name, country
       "Chicago, IL", US
       London, UK
   ];

   // Private — not importable by other files
   private Temp := { σ deleted = false (RawData) };
 
  • Constructor Details

    • AssignmentStatement

      public AssignmentStatement(boolean exported, String name, AssignmentBody body, SourceLocation location)
      Creates an instance of a AssignmentStatement record class.
      Parameters:
      exported - the value for the exported record component
      name - the value for the name record component
      body - the value for the body record component
      location - the value for the location record component
    • AssignmentStatement

      public AssignmentStatement(boolean exported, String name, AssignmentBody body)
      Convenience constructor for tests; uses SourceLocation.UNKNOWN.
  • Method Details

    • of

      public static AssignmentStatement of(String name, AssignmentBody body)
      Creates an exported assignment (the common case).
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • exported

      public boolean exported()
      Returns the value of the exported record component.
      Returns:
      the value of the exported record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • body

      public AssignmentBody body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Specified by:
      location in interface Statement
      Returns:
      the value of the location record component