Class VariableTypeStateProvider
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.model.typesytem.VariableTypeStateProvider
-
- Direct Known Subclasses:
ThreadSafeVariableTypeStateProvider
public class VariableTypeStateProvider extends Object
Provider for fast getting state ofVariable
by offset
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
VariableTypeStateProvider.EnvironmentStates
Wrapper for provider ofVariableTypeState
for concreteEnvironment
protected static class
VariableTypeStateProvider.InnerProvider
Provider ofVariableTypeState
.
-
Field Summary
Fields Modifier and Type Field Description protected List<VariableTypeStateProvider.EnvironmentStates>
allStates
-
Constructor Summary
Constructors Constructor Description VariableTypeStateProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addState(VariableTypeState state)
Adds new state to providervoid
addStates(List<VariableTypeState> states)
Adds states to providerList<Environments>
allEnvironments()
Gets allEnvironments
in this providervoid
clear()
Doclear()
for allEnvironment
void
clear(Environments envs)
Removes all state byEnvironments
void
copyLastState(int newOffset)
Copies last state for allEnvironment
void
copyLastState(int newOffset, Environments envs)
Copies last state forEnvironment
env
void
copyNearestByOffsetState(int offset, int newOffset)
Copies the nearest state for allEnvironment
void
copyNearestByOffsetState(int offset, int newOffset, Environments envs)
Copies the nearest state for value of offsetVariableTreeTypeState
createTypeState(Variable variable, Environments envs, int offset, org.eclipse.xtext.nodemodel.INode blockNode)
Creates stateprotected VariableTypeStateProvider.InnerProvider
findProviderByEnvs(Environments envs)
protected List<VariableTypeStateProvider.InnerProvider>
findProvidersByEnvs(Environments envs)
List<VariableTypeState>
getAll()
Gets all state into providerList<VariableTypeState>
getAll(Environments envs)
Gets all state into providerList<VariableTypeState>
getLastState()
Gets all last state for all allowedEnvironment
VariableTypeState
getLastState(Environments envs)
Gets last state byEnvironment
List<VariableTypeState>
getLastStateBetween(Environments envs, int begin, int end)
Gets the nearest state toend
which hasoffset
more thanbegin
List<VariableTypeState>
getNearestByOffset(int offset)
Gets the nearestVariableTypeState
by offset for all allowedEnvironment
List<VariableTypeState>
getNearestByOffset(Environments envs, int offset)
Gets the nearestVariableTypeState
by offsetprotected VariableTypeStateProvider.EnvironmentStates
getNewEnvironmentStates(Environments envs)
Creates newVariableTypeStateProvider.EnvironmentStates
withenv
boolean
isEmptyState()
Checks states for empty for allEnvironment
boolean
isEmptyState(Environments envs)
Checks states for empty for actualEnvironment
-
-
-
Field Detail
-
allStates
protected List<VariableTypeStateProvider.EnvironmentStates> allStates
-
-
Method Detail
-
createTypeState
public VariableTreeTypeState createTypeState(Variable variable, Environments envs, int offset, org.eclipse.xtext.nodemodel.INode blockNode)
Creates state- Parameters:
variable
-Variable
in BSL associated with this state, can't benull
envs
-Environment
for this state, can't benull
offset
- position in document, where this state was createdblockNode
-INode
corresponding to the contaimentBlock
in Built-In Language, can't benull
-
addState
public void addState(VariableTypeState state)
Adds new state to provider- Parameters:
state
- newVariableTypeState
-
addStates
public void addStates(List<VariableTypeState> states)
Adds states to provider- Parameters:
states
- list ofVariableTypeState
, can't benull
-
getLastState
public VariableTypeState getLastState(Environments envs)
Gets last state byEnvironment
- Parameters:
env
- filteringEnvironments
, can't benull
- Returns:
- corresponding
VariableTypeState
. Can returnnull
-
getLastState
public List<VariableTypeState> getLastState()
Gets all last state for all allowedEnvironment
- Returns:
- list of
VariableTypeState
, nevernull
-
getNearestByOffset
public List<VariableTypeState> getNearestByOffset(Environments envs, int offset)
Gets the nearestVariableTypeState
by offset- Parameters:
envs
- filteringEnvironments
, can't benull
offset
- position for getting type ofVariable
- Returns:
- the nearest
VariableTypeState
. Can returnnull
-
getNearestByOffset
public List<VariableTypeState> getNearestByOffset(int offset)
Gets the nearestVariableTypeState
by offset for all allowedEnvironment
- Parameters:
offset
- position for getting type ofVariable
- Returns:
- list of
VariableTypeState
, nevernull
-
getLastStateBetween
public List<VariableTypeState> getLastStateBetween(Environments envs, int begin, int end)
Gets the nearest state toend
which hasoffset
more thanbegin
- Parameters:
env
- correspondingEnvironment
, can't benull
begin
- limiting positionend
- limiting position- Returns:
- corresponding
VariableTypeState
. Can't returnnull
-
allEnvironments
public List<Environments> allEnvironments()
Gets allEnvironments
in this provider- Returns:
- all Environments, never
null
-
clear
public void clear(Environments envs)
Removes all state byEnvironments
- Parameters:
env
- correspondingEnvironments
, nevernull
-
clear
public void clear()
Doclear()
for allEnvironment
-
isEmptyState
public boolean isEmptyState(Environments envs)
Checks states for empty for actualEnvironment
- Parameters:
env
- actualEnvironments
, can't benull
- Returns:
true
, if states is empty,false
otherwise
-
isEmptyState
public boolean isEmptyState()
Checks states for empty for allEnvironment
- Returns:
true
, if states is empty,false
otherwise
-
copyLastState
public void copyLastState(int newOffset, Environments envs)
Copies last state forEnvironment
env
- Parameters:
newOffset
- value of new offsetenvs
- filteringEnvironments
, can't benull
-
copyLastState
public void copyLastState(int newOffset)
Copies last state for allEnvironment
- Parameters:
newOffset
- value of new offset
-
copyNearestByOffsetState
public void copyNearestByOffsetState(int offset, int newOffset, Environments envs)
Copies the nearest state for value of offset- Parameters:
offset
- finds the nearest state for this value of offsetnewOffset
- value of new offsetenvs
- filteringEnvironments
, can't benull
-
copyNearestByOffsetState
public void copyNearestByOffsetState(int offset, int newOffset)
Copies the nearest state for allEnvironment
- Parameters:
offset
- finds the nearest state for this value of offsetnewOffset
- value of new offset
-
getAll
public List<VariableTypeState> getAll(Environments envs)
Gets all state into provider- Parameters:
envs
- filteringEnvironments
, can't benull
- Returns:
- list of
VariableTypeState
, nevernull
-
getAll
public List<VariableTypeState> getAll()
Gets all state into provider- Returns:
- list of
VariableTypeState
, nevernull
-
getNewEnvironmentStates
protected VariableTypeStateProvider.EnvironmentStates getNewEnvironmentStates(Environments envs)
Creates newVariableTypeStateProvider.EnvironmentStates
withenv
- Parameters:
env
- actualEnvironments
for creatingVariableTypeStateProvider.EnvironmentStates
, can't benull
- Returns:
- creating
VariableTypeStateProvider.EnvironmentStates
, nevernull
-
findProviderByEnvs
protected VariableTypeStateProvider.InnerProvider findProviderByEnvs(Environments envs)
- Parameters:
envs
-Environments
for findingVariableTypeStateProvider.InnerProvider
, can't benull
- Returns:
- found
VariableTypeStateProvider.InnerProvider
ornull
if provider for passedEnvironment
wasn't found
-
findProvidersByEnvs
protected List<VariableTypeStateProvider.InnerProvider> findProvidersByEnvs(Environments envs)
- Parameters:
envs
-Environments
for findingVariableTypeStateProvider.InnerProvider
, can't benull
- Returns:
- found
VariableTypeStateProvider.InnerProvider
s which environments contains any fromenvs
or empty list if providers for passedEnvironment
wasn't found
-
-