Class VariableTypeState
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.model.typesytem.VariableTypeState
-
- All Implemented Interfaces:
IExpressionTypeState
,Comparable<VariableTypeState>
- Direct Known Subclasses:
VariableTreeTypeState
public class VariableTypeState extends Object implements IExpressionTypeState, Comparable<VariableTypeState>
Implements interfaceIExpressionTypeState
for BSL model elementVariable
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.xtext.nodemodel.INode
blockNode
protected Collection<IExpressionTypeState>
children
protected Map<Expression,Set<? extends TypeItem>>
typesByDependedState
protected Set<TypeItem>
typesState
-
Constructor Summary
Constructors Constructor Description VariableTypeState(Variable variable, Environments envs, int offset, org.eclipse.xtext.nodemodel.INode blockNode)
Creates state
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChildState(IExpressionTypeState childState)
Add new child state.void
addExpressionRelatedTypes(Expression baseExpression, Collection<? extends TypeItem> types)
Adds types to state.void
addType(TypeItem type)
Add type to statevoid
addTypes(VariableTypeState state)
Add type to state from another statevoid
addTypes(Collection<? extends TypeItem> types)
Add types to stateint
compareTo(VariableTypeState state)
VariableTypeState
copyWithNewOffset(int newOffset)
Creates newVariableTypeState
with new offsetint
getBlockOffset()
Gets offset of theBlock
corresponding to the this stateIterable<IExpressionTypeState>
getChildState()
Gets children states for current stateEnvironments
getEnvironments()
Gets correspondingEnvironments
for current stateint
getOffset()
Gets position of the document where this state was createdIExpressionTypeState
getParentState()
Gets state that was before current stateorg.eclipse.emf.ecore.EObject
getSemanticObject()
Gets semantic model object corresponding to the this stateIterable<TypeItem>
getTypes()
Gets all types associated with this stateint
getTypesSize()
Gets type's list sizeVariable
getVariable()
Gets variable for which this state was createdboolean
hasTypes()
Checks that state has assosiated typesvoid
setParentState(IExpressionTypeState parentState)
Sets state that was before current state.
-
-
-
Field Detail
-
children
protected Collection<IExpressionTypeState> children
-
typesByDependedState
protected Map<Expression,Set<? extends TypeItem>> typesByDependedState
-
blockNode
protected final org.eclipse.xtext.nodemodel.INode blockNode
-
-
Constructor Detail
-
VariableTypeState
public VariableTypeState(Variable variable, Environments envs, int offset, org.eclipse.xtext.nodemodel.INode blockNode)
Creates state- Parameters:
variable
-Variable
in BSL associated with this stateenvs
-Environments
for this state, can't benull
offset
- position in document, where this state was createdblockNode
-INode
corresponding to the containmentBlock
in Built-In Language, can't benull
-
-
Method Detail
-
getVariable
public Variable getVariable()
Gets variable for which this state was created- Returns:
- variable in BSL
-
getOffset
public int getOffset()
Gets position of the document where this state was created- Returns:
- position
-
copyWithNewOffset
public VariableTypeState copyWithNewOffset(int newOffset)
Creates newVariableTypeState
with new offset- Parameters:
newOffset
- value of new offset- Returns:
- new
VariableTypeState
-
getEnvironments
public Environments getEnvironments()
Gets correspondingEnvironments
for current state- Specified by:
getEnvironments
in interfaceIExpressionTypeState
- Returns:
Environments
, nevernull
-
getTypes
public Iterable<TypeItem> getTypes()
Gets all types associated with this state- Specified by:
getTypes
in interfaceIExpressionTypeState
- Returns:
- list of
TypeItem
-
hasTypes
public boolean hasTypes()
Description copied from interface:IExpressionTypeState
Checks that state has assosiated types- Specified by:
hasTypes
in interfaceIExpressionTypeState
- Returns:
true
if there are assosiated types in state,false
otherwise
-
addType
public void addType(TypeItem type)
Description copied from interface:IExpressionTypeState
Add type to state- Specified by:
addType
in interfaceIExpressionTypeState
- Parameters:
type
- addingTypeItem
, can't benull
-
addTypes
public void addTypes(Collection<? extends TypeItem> types)
Description copied from interface:IExpressionTypeState
Add types to state- Specified by:
addTypes
in interfaceIExpressionTypeState
- Parameters:
types
- addingTypeItem
s, can't benull
-
addExpressionRelatedTypes
public void addExpressionRelatedTypes(Expression baseExpression, Collection<? extends TypeItem> types)
Description copied from interface:IExpressionTypeState
Adds types to state. Method removes old types related tobaseExpression
and add new related types- Specified by:
addExpressionRelatedTypes
in interfaceIExpressionTypeState
- Parameters:
baseExpression
-Expression
which provides adding types, cannot benull
types
- settingTypeItem
s, cannot benull
-
addTypes
public void addTypes(VariableTypeState state)
Description copied from interface:IExpressionTypeState
Add type to state from another state- Specified by:
addTypes
in interfaceIExpressionTypeState
- Parameters:
state
-VariableTypeState
for adding types, can't benull
-
getTypesSize
public int getTypesSize()
Description copied from interface:IExpressionTypeState
Gets type's list size- Specified by:
getTypesSize
in interfaceIExpressionTypeState
- Returns:
- count of types in
VariableTypeState
-
getParentState
public IExpressionTypeState getParentState()
Gets state that was before current state- Specified by:
getParentState
in interfaceIExpressionTypeState
- Returns:
- parent state
-
setParentState
public void setParentState(IExpressionTypeState parentState)
Sets state that was before current state.
Remark that inIExpressionTypeState.addChildState(IExpressionTypeState)
parent state set automatically- Specified by:
setParentState
in interfaceIExpressionTypeState
- Parameters:
parentState
- parent state
-
getChildState
public Iterable<IExpressionTypeState> getChildState()
Gets children states for current state- Specified by:
getChildState
in interfaceIExpressionTypeState
- Returns:
- list of
IExpressionTypeState
-
addChildState
public void addChildState(IExpressionTypeState childState)
Add new child state.
Remarks that current state will be parent state forchildState
- Specified by:
addChildState
in interfaceIExpressionTypeState
- Parameters:
childState
- new child
-
compareTo
public int compareTo(VariableTypeState state)
- Specified by:
compareTo
in interfaceComparable<VariableTypeState>
-
getSemanticObject
public org.eclipse.emf.ecore.EObject getSemanticObject()
Gets semantic model object corresponding to the this state- Returns:
- semantic model object corresponding to the this state, can't be
null
if there is no semantic object for this state
-
-