Skip to content

Commit 624563e

Browse files
committed
Add conversions from primitive types to String to CProverString
Adds static methods toString() to convert primitive types to String.
1 parent e70f080 commit 624563e

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

src/main/java/org/cprover/CProverString.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,77 @@ public static String format(
348348
String arg4, String arg5, String arg6, String arg7, String arg8, String arg9) {
349349
return CProver.nondetWithoutNullForNotModelled();
350350
}
351+
352+
/**
353+
* Returns a {@code String} object representing the
354+
* specified integer. The argument is converted to signed decimal
355+
* representation and returned as a string.
356+
*
357+
* @param i an integer to be converted.
358+
* @return a string representation of the argument in base 10.
359+
*/
360+
public static String toString(int i) {
361+
return CProver.nondetWithoutNullForNotModelled();
362+
}
363+
364+
/**
365+
* Returns a string representation of the first argument in the
366+
* radix specified by the second argument.
367+
*
368+
* @param i an integer to be converted to a string.
369+
* @param radix the radix to use in the string representation.
370+
* @return a string representation of the argument in the specified radix.
371+
*/
372+
public static String toString(int i, int radix) {
373+
return CProver.nondetWithoutNullForNotModelled();
374+
}
375+
376+
/**
377+
* Returns a {@code String} object representing the specified
378+
* {@code long}. The argument is converted to signed decimal
379+
* representation and returned as a string.
380+
*
381+
* @param i a {@code long} to be converted.
382+
* @return a string representation of the argument in base 10.
383+
*/
384+
public static String toString(long l) {
385+
return CProver.nondetWithoutNullForNotModelled();
386+
}
387+
388+
/**
389+
* Returns a string representation of the first argument in the
390+
* radix specified by the second argument.
391+
*
392+
* @param i a {@code long} to be converted to a string.
393+
* @param radix the radix to use in the string representation.
394+
* @return a string representation of the argument in the specified radix.
395+
*/
396+
public static String toString(long l, int radix) {
397+
return CProver.nondetWithoutNullForNotModelled();
398+
}
399+
400+
/**
401+
* Returns a string representation of the {@code float}
402+
* argument.
403+
*
404+
* @param f the float to be converted.
405+
* @return a string representation of the argument.
406+
*/
407+
public static String toString(float f) {
408+
return CProver.nondetWithoutNullForNotModelled();
409+
}
410+
411+
/**
412+
* Returns a string representation of the {@code double}
413+
* argument.
414+
*
415+
* The double is converted to a float first as the string solver currently
416+
* can convert float to String but not double to String.
417+
*
418+
* @param d the double to be converted.
419+
* @return a string representation of the argument.
420+
*/
421+
public static String toString(double d) {
422+
return toString(CProver.doubleToFloat(d));
423+
}
351424
}

0 commit comments

Comments
 (0)