Class JustificationModel<E extends JustificationElement>
- Direct Known Subclasses:
Justification, Template
Justification (concrete) and Template
(abstract/reusable).
The type parameter E constrains which elements can be added:
Justification accepts only
CommonElement, while Template
accepts any JustificationElement including
AbstractSupport.
Every model has exactly one Conclusion, set via
setConclusion(Conclusion) and accessed via conclusion().
Passing a Conclusion to addElement(JustificationElement) is
rejected.
Use validate() to check consistency and completeness. For
location-aware diagnostics in a compiler pipeline use
ConsistencyValidator and
CompletenessValidator directly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <R> Raccept(JustificationVisitor<R> visitor) voidaddElement(E element) RejectsConclusion— usesetConclusion(Conclusion)instead.Returns the conclusion, if one has been set.Elements that replaced an ancestor'sAbstractSupportplaceholder — same qualified id, but a concrete type (e.g.<T extends JustificationElement>
List<T> elementsOfType(Class<T> type) evidence()Searches both the conclusion field and the elements list, so callers do not need to know how the conclusion is stored.getName()booleanReturnstruewhen the conclusion was defined directly in this model, i.e. it was not inherited from a parent template viainline(Template, String).protected abstract booleanReturns true if the given element copy should be added to this model during template expansion.Elements copied from an ancestor template whose runtime type is unchanged (not overridden).voidInlinestemplateinto this model: each template element is copied with a qualified id (templateName:originalId) and support edges between copied elements are re-wired.Elements defined directly in this model — their id has no counterpart in any ancestor template.protected static StringReturns the last colon-separated segment of a qualified id.protected static JustificationElementqualifiedCopy(JustificationElement elem, String prefix) Creates a copy ofelem.voidremoveElement(String id) Removes the element with the given id from the elements list.voidsetConclusion(Conclusion conclusion) Sets the single required conclusion.protected voidvalidate()Validates this model for consistency and completeness without requiring aUnit.protected abstract <R> RvisitSelf(JustificationVisitor<R> visitor)
-
Constructor Details
-
JustificationModel
-
-
Method Details
-
getName
-
setConclusion
Sets the single required conclusion. ThrowsIllegalStateExceptionif a conclusion has already been assigned. -
conclusion
Returns the conclusion, if one has been set. -
getParent
-
setParent
-
addElement
RejectsConclusion— usesetConclusion(Conclusion)instead. -
inline
Inlinestemplateinto this model: each template element is copied with a qualified id (templateName:originalId) and support edges between copied elements are re-wired. The model becomes self-contained — operators can mutate it freely without affecting the original template.Whether a copy is added is controlled by
includeInExpansion(JustificationElement):JustificationexcludesAbstractSupportcopies (type constraint; abstract supports must be overridden by concrete elements);Templateincludes everything.The template's conclusion is always copied as a
Conclusion, maintaining its top-level status. If this model already has a conclusion, the template's conclusion is mapped to it for edge re-wiring but not added as a second conclusion. -
includeInExpansion
Returns true if the given element copy should be added to this model during template expansion.Justificationreturns false forAbstractSupport;Templatereturns true for all elements. -
validate
Validates this model for consistency and completeness without requiring aUnit. Useful for non-compiler consumers that build models programmatically.All violations carry
SourceLocation.UNKNOWNbecause source location data is only available when building through the compiler pipeline (seeConsistencyValidatorandCompletenessValidator).- Returns:
- unmodifiable list of violations; empty means valid.
-
removeElement
Removes the element with the given id from the elements list. -
getElements
-
hasOwnConclusion
public boolean hasOwnConclusion()Returnstruewhen the conclusion was defined directly in this model, i.e. it was not inherited from a parent template viainline(Template, String). Returnsfalsewhen there is no conclusion yet or when the conclusion was set by inlining a parent template. -
ownElements
-
inheritedElements
-
concreteOverrides
Elements that replaced an ancestor'sAbstractSupportplaceholder — same qualified id, but a concrete type (e.g.EvidenceorSubConclusion).Together with
ownElements()andinheritedElements(), these three lists partitiongetElements(). -
findById
Searches both the conclusion field and the elements list, so callers do not need to know how the conclusion is stored. -
elementsOfType
-
subConclusions
-
strategies
-
evidence
-
accept
-
visitSelf
-
plainId
-
qualifiedCopy
Creates a copy ofelem. If the element's id is already qualified (contains:), the id is preserved as-is — it was inherited from a grandparent template and must not be double-qualified. Plain ids are prefixed withprefix:.
-