Package jetbrains.mps.smodel.constraints
Class ModelConstraints
- java.lang.Object
 - 
- jetbrains.mps.smodel.constraints.ModelConstraints
 
 
- 
public class ModelConstraints extends Object
API for model constraints All methods require read action If you don't need breaking node set checkingNodeContext parameter to null If you need Scope use 1) getScope(SReference) or 2) getReferenceDescriptor(...).getScope() If you need reference presentation use getReferenceDescriptor(...).getText(...) Possible parameters for getReferenceDescriptor method: getReferenceDescriptor(reference) gets ref descriptor for existing reference getReferenceDescriptor(node, role) gets ref descriptor for reference being created at the location, role (cannot be null) should be "reference" link getReferenceDescriptor(node, role, index, smartConcept) gets ref descriptor for smartReference being created in "aggregation" role 
- 
- 
Constructor Summary
Constructors Constructor Description ModelConstraints() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanBeAncestor(SNode childNode, CheckingNodeContext checkingNodeContext)static booleancanBeAncestor(SNode parentNode, SAbstractConcept childConcept, SContainmentLink containmentLink, CheckingNodeContext checkingNodeContext)static booleancanBeAncestorDirect(SNode ancestor, SAbstractConcept childConcept, SNode parent, SContainmentLink containmentLink, CheckingNodeContext checkingNodeContext)static booleancanBeAncestorDirect(SNode ancestor, SNode descendant, CheckingNodeContext checkingNodeContext)static booleancanBeChild(SNode node, CheckingNodeContext checkingNodeContext)static booleancanBeChild(SNode parentNode, SAbstractConcept childConcept, SContainmentLink link, CheckingNodeContext checkingNodeContext)static booleancanBeParent(SNode childNode, CheckingNodeContext checkingNodeContext)static booleancanBeParent(SNode node, SAbstractConcept childConcept, SContainmentLink link, CheckingNodeContext checkingNodeContext)static booleancanBeRoot(SAbstractConcept concept, SModel model)static booleancanBeRoot(SAbstractConcept concept, SModel model, CheckingNodeContext checkingNodeContext)static SConceptgetDefaultConcreteConcept(SAbstractConcept concept)static ReferenceDescriptorgetReferenceDescriptor(SNode contextNode, SContainmentLink containmentLink, int position, SReferenceLink association)static ReferenceDescriptorgetReferenceDescriptor(SNode contextNode, SContainmentLink containmentLink, int position, SReferenceLink association, SAbstractConcept concept)static ReferenceDescriptorgetReferenceDescriptor(SNode sourceNode, SReferenceLink association)static ReferenceDescriptorgetReferenceDescriptor(SReference reference)static ScopegetScope(SReference reference)static booleanvalidatePropertyValue(SNode node, SProperty property, Object propertyValue)Validates both structure constraints (SType.isInstanceOf(Object)) and language constraints (property validation functions in constraints aspect) 
 - 
 
- 
- 
Method Detail
- 
canBeAncestor
public static boolean canBeAncestor(@NotNull SNode parentNode, @NotNull SAbstractConcept childConcept, SContainmentLink containmentLink, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeAncestor
public static boolean canBeAncestor(@NotNull SNode childNode, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeAncestorDirect
public static boolean canBeAncestorDirect(@NotNull SNode ancestor, @NotNull SAbstractConcept childConcept, @NotNull SNode parent, SContainmentLink containmentLink, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeAncestorDirect
public static boolean canBeAncestorDirect(@NotNull SNode ancestor, @NotNull SNode descendant, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeParent
public static boolean canBeParent(@NotNull SNode node, @NotNull SAbstractConcept childConcept, SContainmentLink link, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeParent
public static boolean canBeParent(@NotNull SNode childNode, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeChild
public static boolean canBeChild(@NotNull SNode parentNode, @NotNull SAbstractConcept childConcept, SContainmentLink link, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeChild
public static boolean canBeChild(@NotNull SNode node, @Nullable CheckingNodeContext checkingNodeContext)
 
- 
canBeRoot
public static boolean canBeRoot(@NotNull SAbstractConcept concept, @NotNull SModel model)
 
- 
canBeRoot
public static boolean canBeRoot(@NotNull SAbstractConcept concept, @NotNull SModel model, CheckingNodeContext checkingNodeContext)
 
- 
getScope
@NotNull public static Scope getScope(@NotNull SReference reference)
 
- 
getReferenceDescriptor
@NotNull public static ReferenceDescriptor getReferenceDescriptor(@NotNull SReference reference)
 
- 
getReferenceDescriptor
@NotNull public static ReferenceDescriptor getReferenceDescriptor(@NotNull SNode sourceNode, @NotNull SReferenceLink association)
 
- 
getReferenceDescriptor
public static ReferenceDescriptor getReferenceDescriptor(@NotNull SNode contextNode, @Nullable SContainmentLink containmentLink, int position, @NotNull SReferenceLink association)
 
- 
getReferenceDescriptor
public static ReferenceDescriptor getReferenceDescriptor(@NotNull SNode contextNode, @Nullable SContainmentLink containmentLink, int position, @NotNull SReferenceLink association, @NotNull SAbstractConcept concept)
 
- 
getDefaultConcreteConcept
@NotNull public static SConcept getDefaultConcreteConcept(@NotNull SAbstractConcept concept)
 
- 
validatePropertyValue
public static boolean validatePropertyValue(SNode node, SProperty property, Object propertyValue)
Validates both structure constraints (SType.isInstanceOf(Object)) and language constraints (property validation functions in constraints aspect) 
 - 
 
 -