Browse Source

ParamModel: provide getTransitionsIterator

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11648 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 9 years ago
parent
commit
ccdb02c5f2
  1. 53
      prism/src/param/ParamModel.java

53
prism/src/param/ParamModel.java

@ -30,6 +30,7 @@ import java.io.File;
import java.util.BitSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.TreeSet;
import parser.Values;
@ -141,6 +142,58 @@ final class ParamModel extends ModelExplicit
throw new UnsupportedOperationException();
}
/**
* Get an iterator over the transitions from choice {@code i} of state {@code s}.
* <br>
* For DTMC/CTMCs, there is only a single choice.
*/
public Iterator<Entry<Integer, Function>> getTransitionsIterator(final int s, final int i)
{
return new Iterator<Entry<Integer, Function>>()
{
final int start = choiceBegin(stateBegin(s) + i);
int col = start;
final int end = choiceBegin(stateBegin(s) + i + 1);
@Override
public boolean hasNext()
{
return col < end;
}
@Override
public Entry<Integer, Function> next()
{
assert (col < end);
final int i = col;
col++;
return new Entry<Integer, Function>()
{
int key = cols[i];
Function value = nonZeros[i];
@Override
public Integer getKey()
{
return key;
}
@Override
public Function getValue()
{
return value;
}
@Override
public Function setValue(Function arg0)
{
throw new UnsupportedOperationException();
}
};
}
};
}
@Override
public void findDeadlocks(boolean fix) throws PrismException
{

Loading…
Cancel
Save