public Set<String> getVariableNameUsedBy(String variableName) { Set<String> statements = statementVariableRef.getStatementNamesForVar(variableName); if ((statements == null) || (statements.isEmpty())) { return Collections.emptySet(); } return Collections.unmodifiableSet(statements); }
public boolean removeVariable(String name, boolean force) throws ConfigurationException { if (!force) { Set<String> statements = statementVariableRef.getStatementNamesForVar(name); if ((statements != null) && (!statements.isEmpty())) { throw new ConfigurationException( "Variable '" + name + "' is in use by one or more statements"); } } VariableReader reader = variableService.getReader(name); if (reader == null) { return false; } variableService.removeVariable(name); statementVariableRef.removeReferencesVariable(name); statementVariableRef.removeConfiguredVariable(name); return true; }
public void addVariable( String variableName, String type, Object initializationValue, boolean constant) throws ConfigurationException { try { Pair<String, Boolean> arrayType = JavaClassHelper.isGetArrayType(type); variableService.createNewVariable( variableName, arrayType.getFirst(), initializationValue, constant, arrayType.getSecond(), null, engineImportService); statementVariableRef.addConfiguredVariable(variableName); } catch (VariableExistsException e) { throw new ConfigurationException("Error creating variable: " + e.getMessage(), e); } catch (VariableTypeException e) { throw new ConfigurationException("Error creating variable: " + e.getMessage(), e); } }