.. java:import:: java.text DecimalFormat .. java:import:: java.text NumberFormat .. java:import:: java.util ArrayList .. java:import:: java.util Locale .. java:import:: java.util.regex Pattern Util ==== .. java:package:: com.ampl :noindex: .. java:type:: final class Util The \ ``Util``\ class contains various utility methods and constants. Fields ------ FPPattern ^^^^^^^^^ .. java:field:: public static final Pattern FPPattern :outertype: Util NEWLINE ^^^^^^^ .. java:field:: public static final String NEWLINE :outertype: Util The system line separator ("\n" on UNIX). nf ^^ .. java:field:: NumberFormat nf :outertype: Util Stores the appropriate NumberFormat for AMPL's only locale (US) Need to have an instance, as formats are not synchronised s1 ^^ .. java:field:: static long s1 :outertype: Util t1 ^^ .. java:field:: static long t1 :outertype: Util Constructors ------------ Util ^^^^ .. java:constructor:: public Util() :outertype: Util Methods ------- CreateUSFormat ^^^^^^^^^^^^^^ .. java:method:: public static NumberFormat CreateUSFormat() :outertype: Util Used by classes which by design don't have a reference to the ampl object (i.e. Tuple and DataFrame) IndexFactoryFromObjects ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: static Object IndexFactoryFromObjects(Object... elements) :outertype: Util Get the internal indexing representation of the elements. If null or zero length, return null; If length = 1 returns getDoubleOrStringFromSingleObject of the object If length > 1 returns a tuple :param elements: format ^^^^^^ .. java:method:: public String format(double d) :outertype: Util Formats a number with the proper number format for being understood by AMPL (US) formatObjectWithBrackets ^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: String formatObjectWithBrackets(Object key) :outertype: Util Returns a string representation of the object: double -> format(double) String -> quoted string Tuple -> Tuple.toString (which has the brackets) (like (1, 2, 'a')) :param key: formatObjectWithoutBrackets ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: String formatObjectWithoutBrackets(Object key) :outertype: Util Returns a string representation of the object: double -> format(double) String -> quoted string Tuple -> Tuple.toString (which does not have brackets) like: 1, 2, 'a' :param key: formatObjectWithoutBracketsNoCommas ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: String formatObjectWithoutBracketsNoCommas(Object key) :outertype: Util Returns a string representation of the object: double -> format(double) String -> quoted string Tuple -> Tuple.toString (which does not have brackets) like: 1 2 'a' :param key: getClassLocation ^^^^^^^^^^^^^^^^ .. java:method:: public static java.net.URL getClassLocation(Class c) :outertype: Util getDoubleOrString ^^^^^^^^^^^^^^^^^ .. java:method:: static Object getDoubleOrString(String value) :outertype: Util getDoubleOrStringFromSingleObject ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: static Object getDoubleOrStringFromSingleObject(Object o) :outertype: Util parseDouble ^^^^^^^^^^^ .. java:method:: public static double parseDouble(String s) :outertype: Util Parses numbers, AMPL Style :param s: string representation :return: Double , or positive/negative infinity, or NaN print ^^^^^ .. java:method:: static void print() :outertype: Util printObjectInfo ^^^^^^^^^^^^^^^ .. java:method:: static void printObjectInfo(Object key) :outertype: Util quote ^^^^^ .. java:method:: public static String quote(String str) :outertype: Util Converts \ ``str``\ into an AMPL/SAMPL string by surrounding it with single quotes and escaping quotes and newlines. splitOnCommas ^^^^^^^^^^^^^ .. java:method:: static Object[] splitOnCommas(String s, int indexarity) :outertype: Util Split the input string on commas, considering that we can have input strings, surrounded by quotes, containing a comma :param s: string :return: Splitted string staticFormat ^^^^^^^^^^^^ .. java:method:: public static String staticFormat(double d) :outertype: Util Formats a number with the proper number format for being understood by AMPL (US) tic ^^^ .. java:method:: static void tic() :outertype: Util tic2 ^^^^ .. java:method:: static void tic2() :outertype: Util tic3 ^^^^ .. java:method:: static void tic3() :outertype: Util toIntWithFlooring ^^^^^^^^^^^^^^^^^ .. java:method:: public static int toIntWithFlooring(Object o) :outertype: Util toc ^^^ .. java:method:: static void toc() :outertype: Util toc2 ^^^^ .. java:method:: static void toc2() :outertype: Util toc3 ^^^^ .. java:method:: static void toc3() :outertype: Util unquote ^^^^^^^ .. java:method:: public static String unquote(String str) :outertype: Util Unquotes an AMPL string. Returns the same string if it is not a valid AMPL string