Package org.jetbrains.mps.openapi.model
Interface SModel
- 
- All Known Subinterfaces:
- EditableSModel
 
 public interface SModelRepresents a model. Models are loaded lazily when needed.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceSModel.ProblemRepresents a problem with the persistence.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddAccessListener(SNodeAccessListener l)voidaddChangeListener(SNodeChangeListener l)AsSNodeAPI suggests, any model could be modified.voidaddModelListener(SModelListener l)voidaddRootNode(SNode node)Adds the node as a root to this model.SNodecreateNode(SConcept concept)Instantiates an SNode of the given concept, suitable for use in this model.SNodecreateNode(SConcept concept, SNodeId nodeId)Instantiates an SNode of the given concept, suitable for use in this model, optionally specifying an id for the node.SModelIdgetModelId()Returns the id of the model valid within the containing module.StringgetModelName()Deprecated.PrefergetName()with access to distinct fractions of the nameModelRootgetModelRoot()SModulegetModule()Retrieves the owning module TODO: fix remove SModule!SModelNamegetName()This is an equivalent togetModelReference().getName()SNodegetNode(SNodeId id)Iterable<SModel.Problem>getProblems()The list of persistence-specific model problems (like syntax or I/O errors).SModelReferencegetReference()SRepositorygetRepository()Iterable<SNode>getRootNodes()Returns a collection of root nodes.DataSourcegetSource()The data source which this model was loaded from.booleanisLoaded()The model is fully loaded into memory.booleanisReadOnly()No changes are permitted.voidload()When owning a read action lock, this method will fully load the model from the storage.voidremoveAccessListener(SNodeAccessListener l)voidremoveChangeListener(SNodeChangeListener l)voidremoveModelListener(SModelListener l)voidremoveRootNode(SNode node)Removes the whole subtree from the model.voidunload()When owning a write action lock, this method will discard the in-memory representation of the model.
 
- 
- 
- 
Method Detail- 
getRepositorySRepository getRepository() 
 - 
getModelId@NotNull SModelId getModelId() Returns the id of the model valid within the containing module.
 - 
getModelName@Deprecated String getModelName() Deprecated.PrefergetName()with access to distinct fractions of the nameThis is an equivalent to getModelReference().getModelName The returned name of the model may include a stereotype, such as 'generator' or 'tests', separated by the '@' character, e.g. jetbrains.mps.sample.generator.main@generator
 - 
getName@NotNull SModelName getName() This is an equivalent togetModelReference().getName()- Returns:
- name of the model in its full glory
 
 - 
getReference@NotNull SModelReference getReference() 
 - 
getModelRootModelRoot getModelRoot() 
 - 
getModuleSModule getModule() Retrieves the owning module TODO: fix remove SModule!
 - 
getRootNodesIterable<SNode> getRootNodes() Returns a collection of root nodes. Root nodes are all nodes added to model using addRootNode. todo VP: should be immutable collection? Currently it isn't.
 - 
createNodeSNode createNode(@NotNull SConcept concept) Instantiates an SNode of the given concept, suitable for use in this model.
 - 
createNodeSNode createNode(@NotNull SConcept concept, @Nullable SNodeId nodeId) Instantiates an SNode of the given concept, suitable for use in this model, optionally specifying an id for the node. If nonodeIdwas supplied, the call is identical tocreateNode(org.jetbrains.mps.openapi.language.SConcept)
 - 
addRootNodevoid addRootNode(SNode node) Adds the node as a root to this model. Each node in the underlying subtree becomes connected to this model and returns it from the getModel() method.- Throws:
- jetbrains.mps.smodel.IllegalModelChangeError- when invoked on a read-only model or outside of a valid command.
 
 - 
removeRootNodevoid removeRootNode(SNode node) Removes the whole subtree from the model.- Throws:
- jetbrains.mps.smodel.IllegalModelChangeError- when invoked on a read-only model or outside of a valid command.
 
 - 
getSource@NotNull DataSource getSource() The data source which this model was loaded from.
 - 
isReadOnlyboolean isReadOnly() No changes are permitted. For read-only models all modification operations always throwjetbrains.mps.smodel.IllegalModelChangeError.
 - 
isLoadedboolean isLoaded() The model is fully loaded into memory.
 - 
loadvoid load() When owning a read action lock, this method will fully load the model from the storage. Does nothing if already loaded. The load() method is called automatically on a not-loaded model whenever elements from it are being resolved. Problems can be retrieved later by thegetProblems()method.
 - 
getProblems@NotNull Iterable<SModel.Problem> getProblems() The list of persistence-specific model problems (like syntax or I/O errors). Returns empty list if this model is not loaded yet.
 - 
unloadvoid unload() When owning a write action lock, this method will discard the in-memory representation of the model. A modified model is first saved into the storage so that the changes are preserved.
 - 
addModelListenervoid addModelListener(SModelListener l) 
 - 
removeModelListenervoid removeModelListener(SModelListener l) 
 - 
addAccessListenervoid addAccessListener(SNodeAccessListener l) - Parameters:
- l- listener to add, tolerates- null
- Since:
- 3.3
 
 - 
removeAccessListenervoid removeAccessListener(SNodeAccessListener l) - Parameters:
- l- listener to remove, tolerates- null
- Since:
- 3.3
 
 - 
addChangeListenervoid addChangeListener(SNodeChangeListener l) AsSNodeAPI suggests, any model could be modified. However, it's up to model's implementation to decide whether to send notifications about changes or not. Attaching a change listener to a model doesn't guarantee changes get dispatched to the listener, unless it's a model that explicitly states that as part of its contract (e.g.EditableSModel). Note, there's no guarantee about listener uniqueness, i.e. it's unspecified what happens if the same listener instance is added twice.- Parameters:
- l- listener to add, tolerates- null
- Since:
- 3.3
 
 - 
removeChangeListenervoid removeChangeListener(SNodeChangeListener l) - Parameters:
- l- listener to remove, tolerates- nulland unknown (not registered) listeners
- Since:
- 3.3
 
 
- 
 
-