Record Class LocatorCandidate
java.lang.Object
java.lang.Record
com.shaft.capture.model.LocatorCandidate
- Record Components:
strategy- locator strategyexpression- sanitized locator expressionuniquenessCount- number of matching elements observedvisible- whether the target was visiblestable- whether the evidence appeared stablesignals- additional deterministic scoring signalsreplayXpath- literal XPath the in-page recorder computed and self-verified for this candidate (issue #4026), or blank when none was computed. When present, it is the exact string the engine resolves at replay -- record and replay share one artifact instead of independently deriving the same locator twice.roleXpathVerified- whether the recorder self-verified thatSHAFT.GUI.Locator.hasRole(...)'s EXACT fixed per-role XPath union (issue #4239 P1.0a/ladder) resolves uniquely to this element in the live DOM. Only meaningful forLocatorCandidate.LocatorStrategy.ROLEcandidates:uniquenessCounton a ROLE candidate is derived by re-derivinginferredRoleacross the page, which can disagree with what the fixed XPath unionhasRole(...)actually ships (e.g. a<div role="button">truthfully hasuniquenessCount == 1yet matches zero elements viahasRole(Role.BUTTON)'s tag-shape union) -- this is the only signal that tells the two apart, so codegen's rung-1 emission gate must check it explicitly.
public record LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals, String replayXpath, boolean roleXpathVerified)
extends Record
Locator evidence retained for deterministic ranking and review.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeterministic evidence signals.static enumSupported locator evidence strategies. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<LocatorCandidate> Stable best-first ordering for candidate review and replay. -
Constructor Summary
ConstructorsConstructorDescriptionLocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals) Creates immutable locator evidence with no recordedreplayXpathandroleXpathVerifieddefaulted tofalse(additive backward-compatible overload; existing 6-arg call sites keep compiling unchanged).LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals, String replayXpath) Creates immutable locator evidence withroleXpathVerifieddefaulted tofalse(additive backward-compatible overload; existing 7-arg call sites keep compiling unchanged).LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals, String replayXpath, boolean roleXpathVerified) Creates immutable locator evidence. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpressionrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thereplayXpathrecord component.booleanReturns the value of theroleXpathVerifiedrecord component.intscore()Computes a deterministic score without model inference.signals()Returns the value of thesignalsrecord component.booleanstable()Returns the value of thestablerecord component.strategy()Returns the value of thestrategyrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of theuniquenessCountrecord component.booleanvisible()Returns the value of thevisiblerecord component.
-
Field Details
-
BEST_FIRST
Stable best-first ordering for candidate review and replay.
-
-
Constructor Details
-
LocatorCandidate
public LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals) Creates immutable locator evidence with no recordedreplayXpathandroleXpathVerifieddefaulted tofalse(additive backward-compatible overload; existing 6-arg call sites keep compiling unchanged).- Parameters:
strategy- locator strategyexpression- raw locator expressionuniquenessCount- number of matching elements observedvisible- whether the target was visiblestable- whether the evidence appeared stablesignals- additional deterministic scoring signals
-
LocatorCandidate
public LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals, String replayXpath) Creates immutable locator evidence withroleXpathVerifieddefaulted tofalse(additive backward-compatible overload; existing 7-arg call sites keep compiling unchanged).- Parameters:
strategy- locator strategyexpression- raw locator expressionuniquenessCount- number of matching elements observedvisible- whether the target was visiblestable- whether the evidence appeared stablesignals- additional deterministic scoring signalsreplayXpath- self-verified replay XPath, or blank when none was computed
-
LocatorCandidate
public LocatorCandidate(LocatorCandidate.LocatorStrategy strategy, String expression, int uniquenessCount, boolean visible, boolean stable, Set<LocatorCandidate.LocatorSignal> signals, String replayXpath, boolean roleXpathVerified) Creates immutable locator evidence.
-
-
Method Details
-
score
public int score()Computes a deterministic score without model inference.- Returns:
- candidate score
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
strategy
-
expression
Returns the value of theexpressionrecord component.- Returns:
- the value of the
expressionrecord component
-
uniquenessCount
public int uniquenessCount()Returns the value of theuniquenessCountrecord component.- Returns:
- the value of the
uniquenessCountrecord component
-
visible
-
stable
-
signals
-
replayXpath
Returns the value of thereplayXpathrecord component.- Returns:
- the value of the
replayXpathrecord component
-
roleXpathVerified
public boolean roleXpathVerified()Returns the value of theroleXpathVerifiedrecord component.- Returns:
- the value of the
roleXpathVerifiedrecord component
-