|
|
|
@ -26,11 +26,15 @@ |
|
|
|
|
|
|
|
package parser; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.text.*; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import parser.type.*; |
|
|
|
import parser.ast.ModulesFile; |
|
|
|
import parser.type.Type; |
|
|
|
import parser.type.TypeBool; |
|
|
|
import parser.type.TypeDouble; |
|
|
|
import parser.type.TypeInt; |
|
|
|
import prism.PrismLangException; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -414,16 +418,30 @@ public class Values //implements Comparable |
|
|
|
@Override |
|
|
|
public String toString() |
|
|
|
{ |
|
|
|
int i, n; |
|
|
|
String s; |
|
|
|
return toString(true, ","); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Return a string representation of this Values object, e.g. "x=1,y=2". |
|
|
|
* If {@code printNames} is false, the "x="s are omitted. |
|
|
|
* The separator ("," above) can be specified in {@code separator}. |
|
|
|
* @param printNames Print variable/constant names? |
|
|
|
* @param separator String used to separate values in the list |
|
|
|
*/ |
|
|
|
public String toString(boolean printNames, String separator) |
|
|
|
{ |
|
|
|
// Build string of form "x=1,y=2" |
|
|
|
n = getNumValues(); |
|
|
|
s = ""; |
|
|
|
for (i = 0; i < n; i++) { |
|
|
|
s += getName(i) + "=" + valToString(getValue(i)); |
|
|
|
if (i < n-1) s += ","; |
|
|
|
int n = getNumValues(); |
|
|
|
String s = ""; |
|
|
|
for (int i = 0; i < n; i++) { |
|
|
|
if (printNames) { |
|
|
|
s += getName(i) + "="; |
|
|
|
} |
|
|
|
s += valToString(getValue(i)); |
|
|
|
if (i < n-1) { |
|
|
|
s += separator; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
} |
|
|
|
|
|
|
|
|