Browse Source

ModelInfo: provide getVarIndex() and getVarName()

Default implementation relies on the getVarNames() method


git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11079 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 10 years ago
parent
commit
f78b3437d6
  1. 12
      prism/src/prism/DefaultModelGenerator.java
  2. 8
      prism/src/prism/ModelInfo.java

12
prism/src/prism/DefaultModelGenerator.java

@ -71,6 +71,18 @@ public abstract class DefaultModelGenerator implements ModelGenerator
@Override @Override
public abstract List<String> getVarNames(); public abstract List<String> getVarNames();
@Override
public int getVarIndex(String name)
{
return getVarNames().indexOf(name);
}
@Override
public String getVarName(int i)
{
return getVarNames().get(i);
}
@Override @Override
public abstract List<Type> getVarTypes(); public abstract List<Type> getVarTypes();

8
prism/src/prism/ModelInfo.java

@ -78,10 +78,16 @@ public interface ModelInfo
*/ */
public List<Type> getVarTypes(); public List<Type> getVarTypes();
/**
* Look up the index of a variable in the model by name.
* Returns -1 if there is no such variable.
*/
public int getVarIndex(String name);
/** /**
* Get the name of the {@code i}th variable in the model. * Get the name of the {@code i}th variable in the model.
*/ */
//public String getVarName(int i) throws PrismException;
public String getVarName(int i);
/** /**
* Get the type of the {@code i}th variable in the model. * Get the type of the {@code i}th variable in the model.

Loading…
Cancel
Save