use of com.google.api.expr.v1alpha1.Type in project snail by acgist.
the class M3u8Builder method buildM3u8.
/**
* <p>新建M3U8信息</p>
*
* @return {@link M3u8}
*
* @throws NetException 网络异常
*/
private M3u8 buildM3u8() throws NetException {
final M3u8.Type type = this.buildType();
final Cipher cipher = this.buildCipher();
List<String> links;
if (type == Type.M3U8) {
links = this.buildM3u8Links();
} else {
// 获取LABEL_EXTINF标签数据
links = this.buildFileLinks(LABEL_EXTINF);
// 没有LABEL_EXTINF标签数据:获取LABEL_EXT_X_BITRATE标签数据
if (CollectionUtils.isEmpty(links)) {
links = this.buildFileLinks(LABEL_EXT_X_BITRATE);
}
if (CollectionUtils.isEmpty(links)) {
throw new NetException("没有下载文件");
}
}
return new M3u8(type, cipher, links);
}
use of com.google.api.expr.v1alpha1.Type in project java-smt by sosy-lab.
the class CVC4FormulaCreator method convertValue.
@Override
public Object convertValue(Expr expForType, Expr value) {
final Type type = expForType.getType();
final Type valueType = value.getType();
if (value.getKind() == Kind.BOUND_VARIABLE) {
// CVC4 does not allow model values for bound vars
return value.toString();
} else if (valueType.isBoolean()) {
return value.getConstBoolean();
} else if (valueType.isInteger() && type.isInteger()) {
return new BigInteger(value.getConstRational().toString());
} else if (valueType.isReal() && type.isReal()) {
Rational rat = value.getConstRational();
return org.sosy_lab.common.rationals.Rational.of(new BigInteger(rat.getNumerator().toString()), new BigInteger(rat.getDenominator().toString()));
} else if (valueType.isBitVector()) {
Integer bv = value.getConstBitVector().getValue();
if (bv.fitsSignedLong()) {
return BigInteger.valueOf(bv.getUnsignedLong());
} else {
// default
return value.toString();
}
} else if (valueType.isFloatingPoint()) {
return parseFloatingPoint(value);
} else if (valueType.isString()) {
return value.getConstString().toString();
} else {
// String serialization for unknown terms.
return value.toString();
}
}
use of com.google.api.expr.v1alpha1.Type in project java-smt by sosy-lab.
the class CVC4FormulaCreator method makeBoundCopy.
/**
* Makes a bound copy of a variable for use in quantifier. Note that all occurrences of the free
* var have to be substituted by the bound once it exists.
*
* @param var Variable you want a bound copy of.
* @return Bound Variable
*/
public Expr makeBoundCopy(Expr var) {
Type type = var.getType();
String name = getName(var);
Expr boundCopy = exprManager.mkBoundVar(name, type);
return boundCopy;
}
use of com.google.api.expr.v1alpha1.Type in project java-smt by sosy-lab.
the class CVC4ArrayFormulaManager method internalMakeArray.
@Override
@SuppressWarnings("MethodTypeParameterName")
protected <TI extends Formula, TE extends Formula> Expr internalMakeArray(String pName, FormulaType<TI> pIndexType, FormulaType<TE> pElementType) {
final ArrayFormulaType<TI, TE> arrayFormulaType = FormulaType.getArrayType(pIndexType, pElementType);
final Type cvc4ArrayType = toSolverType(arrayFormulaType);
return getFormulaCreator().makeVariable(cvc4ArrayType, pName);
}
use of com.google.api.expr.v1alpha1.Type in project java-smt by sosy-lab.
the class CVC4FloatingPointFormulaManager method genericCast.
private Expr genericCast(Expr pNumber, FormulaType<?> pTargetType) {
Type type = pNumber.getType();
FormulaType<?> argType = getFormulaCreator().getFormulaType(pNumber);
Expr castFuncDecl = getFormulaCreator().declareUFImpl("__cast_" + argType + "_to_" + pTargetType, toSolverType(pTargetType), ImmutableList.of(type));
return exprManager.mkExpr(Kind.APPLY_UF, castFuncDecl, pNumber);
}
Aggregations