Record Class PerspectiveScriptGrounding.TargetSnapshot

java.lang.Object
java.lang.Record
com.inductiveautomation.perspective.designer.ai.PerspectiveScriptGrounding.TargetSnapshot
Record Components:
anchorTypeId - the type id of the first component the window edits, e.g. ia.input.button, or null if unknown.
targetCount - how many components the window writes the script to.
Enclosing class:
PerspectiveScriptGrounding

public static record PerspectiveScriptGrounding.TargetSnapshot(@Nullable String anchorTypeId, int targetCount) extends Record
What an editor window was opened on, captured once when the window is built — not when an editor panel inside it is built, since those are created lazily, after the selection may already have moved.
  • Constructor Details

    • TargetSnapshot

      public TargetSnapshot(@Nullable String anchorTypeId, int targetCount)
      Creates an instance of a TargetSnapshot record class.
      Parameters:
      anchorTypeId - the value for the anchorTypeId record component
      targetCount - the value for the targetCount record component
  • Method Details

    • capture

      public static PerspectiveScriptGrounding.TargetSnapshot capture(ComponentSelection selection, List<String> componentPaths)
      The anchor type is taken from selection only when the selection's anchor is the first of componentPaths; otherwise it is left unknown, so a window opened on components other than the selected ones is never described with another component's type.
      Parameters:
      selection - the Designer selection at the moment the window opens.
      componentPaths - the components the window writes the script to.
      Returns:
      the snapshot.
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • anchorTypeId

      public @Nullable String anchorTypeId()
      Returns the value of the anchorTypeId record component.
      Returns:
      the value of the anchorTypeId record component
    • targetCount

      public int targetCount()
      Returns the value of the targetCount record component.
      Returns:
      the value of the targetCount record component