|
|
|
@ -49,6 +49,7 @@ public class BasicModelTransformation<OM extends Model, TM extends Model> implem |
|
|
|
|
|
|
|
protected final OM originalModel; |
|
|
|
protected final TM transformedModel; |
|
|
|
protected BitSet transformedStatesOfInterest; |
|
|
|
protected final IntFunction<Integer> mapToTransformedModel; |
|
|
|
|
|
|
|
protected final int numberOfStates; |
|
|
|
@ -56,19 +57,26 @@ public class BasicModelTransformation<OM extends Model, TM extends Model> implem |
|
|
|
/** Constructor for a model transformation that maps states one-on-one. */ |
|
|
|
public BasicModelTransformation(final OM originalModel, final TM transformedModel) |
|
|
|
{ |
|
|
|
this(originalModel, transformedModel, IDENTITY); |
|
|
|
this(originalModel, transformedModel, null); |
|
|
|
} |
|
|
|
|
|
|
|
public BasicModelTransformation(final OM originalModel, final TM transformedModel, final BitSet transformedStatesOfInterest) |
|
|
|
{ |
|
|
|
this(originalModel, transformedModel, transformedStatesOfInterest, IDENTITY); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Constructor for a model transformation where the state mapping is given |
|
|
|
* by a function |
|
|
|
*/ |
|
|
|
public BasicModelTransformation(final OM originalModel, final TM transformedModel, final IntFunction<Integer> mapToTransformedModel) |
|
|
|
public BasicModelTransformation(final OM originalModel, final TM transformedModel, final BitSet transformedStatesOfInterest, final IntFunction<Integer> mapToTransformedModel) |
|
|
|
{ |
|
|
|
this.originalModel = originalModel; |
|
|
|
this.transformedModel = transformedModel; |
|
|
|
this.numberOfStates = originalModel.getNumStates(); |
|
|
|
this.mapToTransformedModel = mapToTransformedModel; |
|
|
|
setTransformedStatesOfInterest(transformedStatesOfInterest); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -83,6 +91,21 @@ public class BasicModelTransformation<OM extends Model, TM extends Model> implem |
|
|
|
return transformedModel; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public BitSet getTransformedStatesOfInterest() |
|
|
|
{ |
|
|
|
return transformedStatesOfInterest; |
|
|
|
} |
|
|
|
|
|
|
|
public BasicModelTransformation<OM, TM> setTransformedStatesOfInterest(BitSet transformedStatesOfInterest) |
|
|
|
{ |
|
|
|
if (transformedStatesOfInterest != null && transformedStatesOfInterest.length() > transformedModel.getNumStates()) { |
|
|
|
throw new IndexOutOfBoundsException("State set must be subset of transformed model's state space"); |
|
|
|
} |
|
|
|
this.transformedStatesOfInterest = transformedStatesOfInterest; |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public StateValues projectToOriginalModel(final StateValues sv) throws PrismException |
|
|
|
{ |
|
|
|
|