Browse Source

AcceptanceGeneric: add getLoafNodes() helper

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10529 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 10 years ago
parent
commit
1a17950deb
  1. 26
      prism/src/acceptance/AcceptanceGeneric.java

26
prism/src/acceptance/AcceptanceGeneric.java

@ -27,7 +27,10 @@
package acceptance;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.List;
import prism.PrismException;
import prism.PrismNotSupportedException;
@ -156,6 +159,29 @@ public class AcceptanceGeneric implements AcceptanceOmega {
return false;
}
/** Get a list of all the (non-true/false) leaf nodes in this acceptance condition */
public List<AcceptanceGeneric> getLeafNodes()
{
switch (getKind()) {
case AND:
case OR: {
List<AcceptanceGeneric> result = new ArrayList<AcceptanceGeneric>();
result.addAll(left.getLeafNodes());
result.addAll(right.getLeafNodes());
return result;
}
case TRUE:
case FALSE:
return Collections.emptyList();
case FIN:
case FIN_NOT:
case INF:
case INF_NOT:
return Collections.singletonList(this);
}
throw new UnsupportedOperationException("Unknown kind");
}
@Override
public String getSignatureForState(int i) {
return "";

Loading…
Cancel
Save