|
|
@ -35,6 +35,7 @@ import java.util.List; |
|
|
|
|
|
|
|
|
import parser.State; |
|
|
import parser.State; |
|
|
import parser.ast.ExpressionBinaryOp; |
|
|
import parser.ast.ExpressionBinaryOp; |
|
|
|
|
|
import parser.ast.ExpressionUnaryOp; |
|
|
import parser.type.Type; |
|
|
import parser.type.Type; |
|
|
import parser.type.TypeBool; |
|
|
import parser.type.TypeBool; |
|
|
import parser.type.TypeDouble; |
|
|
import parser.type.TypeDouble; |
|
|
@ -491,8 +492,7 @@ public class StateValues |
|
|
for (int i = 0; i < size; i++) { |
|
|
for (int i = 0; i < size; i++) { |
|
|
valuesB.set(i, valuesD[i] > sv.valuesD[i]); |
|
|
valuesB.set(i, valuesD[i] > sv.valuesD[i]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
throw new PrismException("Operator > can not be applied to Boolean vectors"); |
|
|
throw new PrismException("Operator > can not be applied to Boolean vectors"); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
@ -531,8 +531,7 @@ public class StateValues |
|
|
for (int i = 0; i < size; i++) { |
|
|
for (int i = 0; i < size; i++) { |
|
|
valuesB.set(i, valuesD[i] >= sv.valuesD[i]); |
|
|
valuesB.set(i, valuesD[i] >= sv.valuesD[i]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
throw new PrismException("Operator >= can not be applied to Boolean vectors"); |
|
|
throw new PrismException("Operator >= can not be applied to Boolean vectors"); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
@ -571,8 +570,7 @@ public class StateValues |
|
|
for (int i = 0; i < size; i++) { |
|
|
for (int i = 0; i < size; i++) { |
|
|
valuesB.set(i, valuesD[i] < sv.valuesD[i]); |
|
|
valuesB.set(i, valuesD[i] < sv.valuesD[i]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
throw new PrismException("Operator < can not be applied to Boolean vectors"); |
|
|
throw new PrismException("Operator < can not be applied to Boolean vectors"); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
@ -611,8 +609,7 @@ public class StateValues |
|
|
for (int i = 0; i < size; i++) { |
|
|
for (int i = 0; i < size; i++) { |
|
|
valuesB.set(i, valuesD[i] <= sv.valuesD[i]); |
|
|
valuesB.set(i, valuesD[i] <= sv.valuesD[i]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
throw new PrismException("Operator <= can not be applied to Boolean vectors"); |
|
|
throw new PrismException("Operator <= can not be applied to Boolean vectors"); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
@ -771,6 +768,52 @@ public class StateValues |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Modify the vector by applying unary operator {@code op}. |
|
|
|
|
|
*/ |
|
|
|
|
|
public void applyUnaryOp(int op) throws PrismException |
|
|
|
|
|
{ |
|
|
|
|
|
switch (op) { |
|
|
|
|
|
case ExpressionUnaryOp.NOT: |
|
|
|
|
|
not(); |
|
|
|
|
|
break; |
|
|
|
|
|
case ExpressionUnaryOp.MINUS: |
|
|
|
|
|
minus(); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
throw new PrismException("Unknown binary operator"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Modify the vector by applying 'not' |
|
|
|
|
|
*/ |
|
|
|
|
|
public void not() throws PrismException |
|
|
|
|
|
{ |
|
|
|
|
|
if (!(type instanceof TypeBool)) { |
|
|
|
|
|
throw new PrismException("Operator ! can only be applied to Boolean vectors"); |
|
|
|
|
|
} |
|
|
|
|
|
valuesB.flip(0, size); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Modify the vector by applying (unary) 'minus'. |
|
|
|
|
|
*/ |
|
|
|
|
|
public void minus() throws PrismException |
|
|
|
|
|
{ |
|
|
|
|
|
if (type instanceof TypeInt) { |
|
|
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
|
|
valuesI[i] = -valuesI[i]; |
|
|
|
|
|
} |
|
|
|
|
|
} else if (type instanceof TypeDouble) { |
|
|
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
|
|
valuesD[i] = -valuesD[i]; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
throw new PrismException("Operator - can not be applied to Boolean vectors"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Set the elements of this vector by reading them in from a file. |
|
|
* Set the elements of this vector by reading them in from a file. |
|
|
*/ |
|
|
*/ |
|
|
|