Package org.qdl_lang.state
Class VariableState
- java.lang.Object
-
- org.qdl_lang.state.AbstractState
-
- org.qdl_lang.state.ModuleState
-
- org.qdl_lang.state.NamespaceAwareState
-
- org.qdl_lang.state.VariableState
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable
,edu.uiuc.ncsa.security.util.scripting.StateInterface
,Serializable
- Direct Known Subclasses:
FunctionState
public abstract class VariableState extends NamespaceAwareState
Created by Jeff Gaynor
on 2/2/20 at 6:42 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VariableState.CyclicalError
Thrown byVariableState.ResolveState
if a cycle is found.static class
VariableState.ResolveState
-
Nested classes/interfaces inherited from class org.qdl_lang.state.AbstractState
AbstractState.QDLStackTraceElement
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXTRINSIC_MARKER
static String
int_regex
protected int
typeSafetyMode
static String
var_regex
-
Fields inherited from class org.qdl_lang.state.NamespaceAwareState
NS_DELIMITER, RESERVED_NAMESPACE
-
Fields inherited from class org.qdl_lang.state.ModuleState
MTemplates
-
Fields inherited from class org.qdl_lang.state.AbstractState
INTRINSIC_PREFIX, libPath, scriptArgs
-
-
Constructor Summary
Constructors Constructor Description VariableState(VStack vStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VStack
getExtrinsicVars()
VStack
getIntrinsicVariables()
int
getTypeSafetyMode()
QDLValue
getValue(String variableName)
GetValue may return null if the variable has not been set.QDLValue
getValue(String variableName, Set<XKey> checkedAliases)
protected QDLVariable
gsrNSScalarOp(String variableName, int op, QDLValue value, Set<XKey> checkedAliases)
protected QDLValue
gsrNSStemOp(StemMultiIndex w, int op, QDLValue value, Set<XKey> checkInstances)
gsr = get, set or remove.protected VThing
handleVariableType(VThing vThing, XKey key, QDLValue newValue)
the contract here is that if theVThing
is null, then it can be created.boolean
isDefined(String symbol)
Checks if a symbol is defined.static boolean
isExtrinsic(String x)
boolean
isStem(String var)
TreeSet<String>
listVariables(boolean useCompactNotation, boolean includeModules, boolean showIntrinsic, boolean showExtrinsic)
void
remove(String variableName)
protected String
resolveStemIndex(String index)
protected String
resolveStemIndex(String index, VariableState.ResolveState resolveState)
void
setIntrinsicVariables(VStack instrinsicVariables)
void
setTypeSafetyMode(int typeSafetyMode)
void
setValue(String variableName, QDLValue value)
void
setValue(String variableName, QDLValue value, Set<XKey> checkedAliases)
-
Methods inherited from class org.qdl_lang.state.NamespaceAwareState
getAlias, getUNQName
-
Methods inherited from class org.qdl_lang.state.ModuleState
getImportedModule, getMInstances, getModule, getMTemplates, getUsedModules, hasModule, isImportMode, isModuleState, setImportMode, setMInstances, setModule, setModuleState, setMTemplates, setUsedModules
-
Methods inherited from class org.qdl_lang.state.AbstractState
debug, error, error, error, getCompletionProvider, getIoInterface, getLibPath, getLogger, getMetaEvaluator, getModulePaths, getOperatorType, getOpEvaluator, getScriptArgs, getScriptArgStem, getScriptName, getScriptPaths, getScriptStack, getStateRegistry, getSuperState, getUuid, getVStack, hasCompletionProvider, hasLogging, hasScriptArgs, hasScriptName, hasSuperState, info, isDebugOn, isEnableLibrarySupport, isIntrinsic, isPrintUnicode, pathToList, setCompletionProvider, setDebugOn, setEnableLibrarySupport, setIoInterface, setLibPath, setLibPath, setLogger, setMetaEvaluator, setModulePaths, setModulePaths, setOpEvaluator, setPrintUnicode, setScriptArgs, setScriptArgStem, setScriptName, setScriptPaths, setScriptPaths, setScriptStack, setSuperState, setUuid, setvStack, warn
-
-
-
-
Field Detail
-
var_regex
public static String var_regex
-
int_regex
public static String int_regex
-
typeSafetyMode
protected int typeSafetyMode
-
EXTRINSIC_MARKER
public static final String EXTRINSIC_MARKER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VariableState
public VariableState(VStack vStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade)
-
-
Method Detail
-
isDefined
public boolean isDefined(String symbol)
Checks if a symbol is defined. Note that this does do stem tail resolution and namespace resolution.- Parameters:
symbol
-- Returns:
-
getValue
public QDLValue getValue(String variableName)
GetValue may return null if the variable has not been set.- Parameters:
variableName
-- Returns:
-
remove
public void remove(String variableName)
-
gsrNSStemOp
protected QDLValue gsrNSStemOp(StemMultiIndex w, int op, QDLValue value, Set<XKey> checkInstances)
gsr = get, set or remove. This resolves the name of the stem- Parameters:
w
-op
-value
-- Returns:
-
handleVariableType
protected VThing handleVariableType(VThing vThing, XKey key, QDLValue newValue)
the contract here is that if theVThing
is null, then it can be created. If it does exist, then cvarious contracts for type safety are followed. These are in theQDLVariable.setQDLValue(QDLValue)
method.This returns the vThing to save or throws an exception for a type violation.
- Parameters:
vThing
-key
-newValue
-- Returns:
-
getTypeSafetyMode
public int getTypeSafetyMode()
-
setTypeSafetyMode
public void setTypeSafetyMode(int typeSafetyMode)
-
gsrNSScalarOp
protected QDLVariable gsrNSScalarOp(String variableName, int op, QDLValue value, Set<XKey> checkedAliases)
-
resolveStemIndex
protected String resolveStemIndex(String index, VariableState.ResolveState resolveState)
-
listVariables
public TreeSet<String> listVariables(boolean useCompactNotation, boolean includeModules, boolean showIntrinsic, boolean showExtrinsic)
-
isStem
public boolean isStem(String var)
-
isExtrinsic
public static boolean isExtrinsic(String x)
-
getExtrinsicVars
public VStack getExtrinsicVars()
-
setIntrinsicVariables
public void setIntrinsicVariables(VStack instrinsicVariables)
-
getIntrinsicVariables
public VStack getIntrinsicVariables()
-
-