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 classVariableState.CyclicalErrorThrown byVariableState.ResolveStateif a cycle is found.static classVariableState.ResolveState-
Nested classes/interfaces inherited from class org.qdl_lang.state.AbstractState
AbstractState.QDLStackTraceElement
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXTRINSIC_MARKERstatic Stringint_regexprotected inttypeSafetyModestatic Stringvar_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 VStackgetExtrinsicVars()VStackgetIntrinsicVariables()intgetTypeSafetyMode()QDLValuegetValue(String variableName)GetValue may return null if the variable has not been set.QDLValuegetValue(String variableName, Set<XKey> checkedAliases)protected QDLVariablegsrNSScalarOp(String variableName, int op, QDLValue value, Set<XKey> checkedAliases)protected QDLValuegsrNSStemOp(StemMultiIndex w, int op, QDLValue value, Set<XKey> checkInstances)gsr = get, set or remove.protected VThinghandleVariableType(VThing vThing, XKey key, QDLValue newValue)the contract here is that if theVThingis null, then it can be created.booleanisDefined(String symbol)Checks if a symbol is defined.static booleanisExtrinsic(String x)booleanisStem(String var)TreeSet<String>listVariables(boolean useCompactNotation, boolean includeModules, boolean showIntrinsic, boolean showExtrinsic)voidremove(String variableName)protected StringresolveStemIndex(String index)protected StringresolveStemIndex(String index, VariableState.ResolveState resolveState)voidsetIntrinsicVariables(VStack instrinsicVariables)voidsetTypeSafetyMode(int typeSafetyMode)voidsetValue(String variableName, QDLValue value)voidsetValue(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, getLibrarySupportMode, 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, setLibrarySupportMode, 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 theVThingis 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()
-
-