Browse Source

ConstantList: methods for removing a constant definition

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11595 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 10 years ago
parent
commit
52dc54df5b
  1. 32
      prism/src/parser/ast/ConstantList.java

32
prism/src/parser/ast/ConstantList.java

@ -121,9 +121,39 @@ public class ConstantList extends ASTElement
return names.indexOf(s);
}
/**
* Remove the constant with the given name.
* @param name the name of the constant
* @param ignoreNonexistent if true, don't throw an exception if the constant does not exist
* @throws PrismLangException if the constant does not exist (if not ignoreNonexistent)
*/
public void removeConstant(String name, boolean ignoreNonexistent) throws PrismLangException
{
int constantIndex = getConstantIndex(name);
if (constantIndex == -1) {
if (ignoreNonexistent) {
return;
}
throw new PrismLangException("Can not remove nonexistent constant: " + name);
}
removeConstant(constantIndex);
}
/**
* Remove the constant with the given index.
* @param i the index
*/
public void removeConstant(int i)
{
names.remove(i);
constants.remove(i);
types.remove(i);
nameIdents.remove(i);
}
/**
* Find cyclic dependencies.
*/
*/
public void findCycles() throws PrismLangException
{
// Create boolean matrix of dependencies

Loading…
Cancel
Save