Browse Source

prism.UndefinedConstants: provide additional method removeConstants(Collection<String> constNames)

Refactor removeConstants(String[] constNames) to use that method as well.


git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11796 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 9 years ago
parent
commit
97c72b534e
  1. 22
      prism/src/prism/UndefinedConstants.java

22
prism/src/prism/UndefinedConstants.java

@ -27,6 +27,8 @@
package prism; package prism;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -240,14 +242,24 @@ public class UndefinedConstants
/** /**
* Remove some constants. This is used if you decide that you do not want to treat * Remove some constants. This is used if you decide that you do not want to treat
* some constants as undefined once you have created the UndefinedConstants object.
* @return how many constants were actually removed.
* some constants as undefined once you have created the UndefinedConstants object.
* @return how many constants were actually removed.
*/ */
public int removeConstants(String constNames[]) public int removeConstants(String constNames[])
{ {
int removed = 0, n = constNames.length;
for (int i = 0; i < n; i++) {
if (removeConstant(constNames[i]))
return removeConstants(Arrays.asList(constNames));
}
/**
* Remove some constants. This is used if you decide that you do not want to treat
* some constants as undefined once you have created the UndefinedConstants object.
* @return how many constants were actually removed.
*/
public int removeConstants(Collection<String> constNames)
{
int removed = 0;
for (String name : constNames) {
if (removeConstant(name))
removed++; removed++;
} }
return removed; return removed;

Loading…
Cancel
Save