public class MixedBasicVariableMap extends BasicLocalVariableMap implements HierarchicalVariableMap
| Constructor and Description |
|---|
MixedBasicVariableMap() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
converted(String name)
Converts the name of a variable in a way that if the name 'a' and name
'b' results the same string converted then 'a' and 'b' are treated from
some aspects as the same variable name.
|
void |
createVariablesOnTheFly()
Inform the object that variables have to be created on the fly without
previous proper registration.
|
void |
defaultVariableScopeShallBeGlobal()
Inform the object that when a variable is created on the fly without
prior declaration that would have specified if the variable is local or
global, then the variable has to be global by default.
|
void |
defaultVariableScopeShallBeLocal()
Inform the object that when a variable is created on the fly without
prior declaration that would have specified if the variable is local or
global, then the variable has to be local by default.
|
VariableMap |
getGlobalMap() |
Set<String> |
getVariableNameSet()
Get the set of the variables stored in the variable map so that the
caller can iterate through the variables.
|
RightValue |
getVariableValue(String variableName)
Get the value of a variable.
|
void |
registerGlobalVariable(String variableName)
Register a variable as a global variable.
|
void |
requireVariableDeclaration()
Inform the object that variables should not be created on the fly, but
first a variable has to be registered and can only be used afterwards.
|
void |
setCaseFreak()
Tell the object that the variable names has to be cased only one way.
|
void |
setCaseIgnorant()
Tell the object that the variable handling is case insensitive.
|
void |
setCaseSensitive()
Tell the object that the variable names are handled in a case sensitive
way.
|
void |
setVariable(String variableName,
RightValue rightValue)
Set the value of the variable.
|
Boolean |
variableDefined(String variableName)
Checks that a variable exists and has a defined value in this map.
|
Boolean |
variableExists(String variableName)
Checks that a variable exists in this map.
|
currentScopeIsGlobal, dropFrame, isGlobal, isLocal, newFrame, registerLocalVariableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdropFrame, newFrame, registerLocalVariablegetVariableNameSetpublic VariableMap getGlobalMap()
getGlobalMap in interface HierarchicalVariableMappublic RightValue getVariableValue(String variableName) throws ExecutionException
VariableMapgetVariableValue in interface VariableMapgetVariableValue in class BasicLocalVariableMapnull if the variable
is not defined or does not exists.ExecutionExceptionpublic Boolean variableExists(String variableName) throws ExecutionException
VariableMapvariableExists in interface VariableMapvariableExists in class BasicLocalVariableMaptrue if the variable exists, even if the variable has
undefined value. false if the variable does not exist in
this map.ExecutionExceptionpublic Boolean variableDefined(String variableName) throws ExecutionException
VariableMapnull.variableDefined in interface VariableMapvariableDefined in class BasicLocalVariableMaptrue if the variable exists and has a defined value.ExecutionExceptionpublic void requireVariableDeclaration()
public void createVariablesOnTheFly()
Nevertheless this is the default behavior.
public void defaultVariableScopeShallBeLocal()
This is the safer solution and this is the default, since there is no previous BASIC style in this aspect.
public void defaultVariableScopeShallBeGlobal()
This is generally dangerous, however it is up to the programmer embedding the interpreter to his/her application.
public void registerGlobalVariable(String variableName) throws ExecutionException
LocalVariableMapInterpreters handle variables differently. When a variable is not defined using some keyword as 'LOCAL' or 'GLOBAL' then the interpreter may treat the variable default local, may treat default global or may raise error.
This method can be used to declare that a variable is used in the local environment referring to the global variable.
registerGlobalVariable in interface LocalVariableMapregisterGlobalVariable in class BasicLocalVariableMapExecutionExceptionpublic void setVariable(String variableName, RightValue rightValue) throws ExecutionException
VariableMap
You can set a variable to undefined passing null to this method
as rightValue.
setVariable in interface VariableMapsetVariable in class BasicLocalVariableMaprightValue - the new value of the variableExecutionExceptionpublic void setCaseSensitive()
It is not recommended to use this mode, however most modern programming languages do this.
public void setCaseFreak()
It is the recommended behavior, however BASIC implementations rarely exhibit such variable name handling this is not the default.
public void setCaseIgnorant()
It is not recommended to use this mode, however most BASIC implementation do this. This is the default behavior.
public Set<String> getVariableNameSet()
VariableMapgetVariableNameSet in interface VariableMapprotected String converted(String name)
name - Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.