Package sc.lang.java
Class ModelStream
- java.lang.Object
-
- sc.lang.SemanticNode
-
- sc.lang.java.ModelStream
-
- All Implemented Interfaces:
ISemanticNode
,ICustomResolver
,ILifecycle
public class ModelStream extends SemanticNode implements ICustomResolver
Stores a stream of changes that need to be made to a model. This object is used both for synchronization and for updating an application when the source code changes. It's the main data structure that stores info used in a sync update to/from the client. When the serialization format is 'stratacode', you can create the model stream by parsing the input using the ModelStream parselet in the JavaLanguage. Or a model stream can be created in the code from UpdateInstanceInfo - when changes are detected after the source code is refreshed (in this case, it represents the changes to the code since the source was last refreshed). The model stream can also be created from other serialization formats like JSON.
-
-
Field Summary
Fields Modifier and Type Field Description BindingContext
bindCtx
JavaModel
globalModel
ClassDeclaration
globalType
boolean
isSyncStream
Set this to true if your sync is going against the sync manager - i.e.SemanticNodeList<JavaModel>
modelList
SyncManager.SyncContext
syncCtx
boolean
useRuntimeResolution
-
Fields inherited from class sc.lang.SemanticNode
debugDiffTrace, initialized, PARENT_NODE_PROPERTY, parentNode, PARSE_NODE_PROPERTY, parseletId, parseNode, parseNodeInvalid, processed, started, transformed, validated
-
Fields inherited from interface sc.lang.ISemanticNode
CopyAll, CopyIndependent, CopyInitLevels, CopyNormal, CopyParseNode, CopyReplace, CopyState, CopyTransformed, SkipParseNode
-
-
Constructor Summary
Constructors Constructor Description ModelStream()
ModelStream(boolean isSyncStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addModel(JavaModel model)
java.lang.StringBuilder
convertToJS(java.lang.String destName, java.lang.String defaultScope)
static ModelStream
convertToModelStream(java.lang.String layerDef, BindingContext bindCtx)
java.lang.String
getRegisterInstName()
java.lang.String
getResolveMethodName()
java.lang.String
getResolveOrCreateInstName()
VariableDefinition
resolveFieldWithName(java.lang.String pkgName, java.lang.String typeName)
java.lang.Object
resolveObject(java.lang.String currentPackage, java.lang.String name, boolean create, boolean unwrap)
Returns the object instance with the given name - for runtime lookup.java.lang.Object
resolveType(java.lang.String currentPackage, java.lang.String typeName, boolean create, TypeDeclaration fromType)
Returns the type of the object with the given name - for compile time checksvoid
setLayeredSystem(LayeredSystem sys)
void
updateRuntime(java.lang.String destName, java.lang.String defaultScope, boolean applyRemoteReset)
This is called to apply the model stream to the system using the supplied default scope.boolean
useRuntimeResolution()
Return true for the sync system to look up .class files only.-
Methods inherited from class sc.lang.SemanticNode
changeLanguage, clearInitialized, clearParseNode, clearStarted, computeNearString, containsChild, deepCopy, deepEquals, diffNode, ensureValidated, equals, formatLeftParenDelegateToParent, formatSpaceBeforeAngleBracket, getAnyChildParseNode, getChildAtIndex, getChildNestingDepth, getDependencyDisabledText, getEnclosingSrcStatement, getLanguageModel, getNestingDepth, getNodeCount, getNodeErrorRange, getNodeErrorText, getNodeWarningText, getNotFoundError, getParentNode, getParseErrorNode, getParseletId, getParseNode, getRootNode, getStartIndex, getStopSemanticProps, getTransformed, getUserVisibleName, hasErrors, hashCode, indexOfChild, init, isInitialized, isParseNodeValid, isProcessed, isSemanticChildValue, isSemanticProperty, isSemanticProperty, isStarted, isTrailingSrcStatement, isValidated, needsTransform, process, refreshNode, regenerate, regenerateIfTracking, removeChild, replaceChild, restoreParseNode, restoreParseNode, sameSrcLocation, serialize, setParentNode, setParseErrorNode, setParselet, setParseletId, setParseNode, setParseNodeValid, setProperty, setProperty, spaceAfterParen, start, stop, styleNode, styleNode, toDeclarationString, toDefinitionString, toDefinitionString, toDefinitionString, toHeaderString, toLanguageString, toLanguageString, toLocationString, toLocationString, toLocationString, toModelString, toModelString, toSafeLanguageString, transform, validate, validateParseNode
-
-
-
-
Field Detail
-
modelList
public SemanticNodeList<JavaModel> modelList
-
isSyncStream
public boolean isSyncStream
Set this to true if your sync is going against the sync manager - i.e. is updating instances. Otherwise, it's updating types.
-
syncCtx
public SyncManager.SyncContext syncCtx
-
bindCtx
public BindingContext bindCtx
-
useRuntimeResolution
public boolean useRuntimeResolution
-
globalModel
public JavaModel globalModel
-
globalType
public ClassDeclaration globalType
-
-
Method Detail
-
convertToJS
public java.lang.StringBuilder convertToJS(java.lang.String destName, java.lang.String defaultScope)
-
updateRuntime
public void updateRuntime(java.lang.String destName, java.lang.String defaultScope, boolean applyRemoteReset)
This is called to apply the model stream to the system using the supplied default scope.
-
setLayeredSystem
public void setLayeredSystem(LayeredSystem sys)
-
resolveType
public java.lang.Object resolveType(java.lang.String currentPackage, java.lang.String typeName, boolean create, TypeDeclaration fromType)
Returns the type of the object with the given name - for compile time checks- Specified by:
resolveType
in interfaceICustomResolver
-
getResolveMethodName
public java.lang.String getResolveMethodName()
- Specified by:
getResolveMethodName
in interfaceICustomResolver
-
resolveObject
public java.lang.Object resolveObject(java.lang.String currentPackage, java.lang.String name, boolean create, boolean unwrap)
Returns the object instance with the given name - for runtime lookup.- Specified by:
resolveObject
in interfaceICustomResolver
-
resolveFieldWithName
public VariableDefinition resolveFieldWithName(java.lang.String pkgName, java.lang.String typeName)
-
getRegisterInstName
public java.lang.String getRegisterInstName()
- Specified by:
getRegisterInstName
in interfaceICustomResolver
-
getResolveOrCreateInstName
public java.lang.String getResolveOrCreateInstName()
- Specified by:
getResolveOrCreateInstName
in interfaceICustomResolver
-
useRuntimeResolution
public boolean useRuntimeResolution()
Return true for the sync system to look up .class files only. We only use this optimization when all of the classes are compiled.- Specified by:
useRuntimeResolution
in interfaceICustomResolver
-
addModel
public void addModel(JavaModel model)
-
convertToModelStream
public static ModelStream convertToModelStream(java.lang.String layerDef, BindingContext bindCtx)
-
-