public class SimpleTupleFormat extends Object
Modifier | Constructor and Description |
---|---|
|
SimpleTupleFormat(String prefix,
String suffix)
Constructs a new instance with the default string separator (a comma)
and the given prefix and suffix.
|
protected |
SimpleTupleFormat(String separator,
String prefix,
String suffix)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
format(double a)
Return a tuple string with the given value.
|
String |
format(double a1,
double a2)
Return a tuple string with the given values.
|
String |
format(double a1,
double a2,
double a3)
Return a tuple string with the given values.
|
String |
format(double a1,
double a2,
double a3,
double a4)
Return a tuple string with the given values.
|
static SimpleTupleFormat |
getDefault()
Return an instance configured with default values.
|
String |
getPrefix()
Return the string used to signal the start of a tuple.
|
String |
getSeparator()
Return the string used to separate tuple values.
|
String |
getSuffix()
Returns the string used to signal the end of a tuple.
|
<T> T |
parse(String str,
DoubleFunction1N<T> fn)
Parse the given string as a 1-tuple and passes the tuple values to the
given function.
|
<T> T |
parse(String str,
DoubleFunction2N<T> fn)
Parse the given string as a 2-tuple and passes the tuple values to the
given function.
|
<T> T |
parse(String str,
DoubleFunction3N<T> fn)
Parse the given string as a 3-tuple and passes the parsed values to the
given function.
|
public SimpleTupleFormat(String prefix, String suffix)
prefix
- String used to signal the start of a tuple; if null, no
string is expected at the start of the tuplesuffix
- String used to signal the end of a tuple; if null, no
string is expected at the end of the tupleprotected SimpleTupleFormat(String separator, String prefix, String suffix)
separator
- String used to separate tuple values; must not be null.prefix
- String used to signal the start of a tuple; if null, no
string is expected at the start of the tuplesuffix
- String used to signal the end of a tuple; if null, no
string is expected at the end of the tuplepublic String getSeparator()
public String getPrefix()
public String getSuffix()
public String format(double a)
a
- valuepublic String format(double a1, double a2)
a1
- first valuea2
- second valuepublic String format(double a1, double a2, double a3)
a1
- first valuea2
- second valuea3
- third valuepublic String format(double a1, double a2, double a3, double a4)
a1
- first valuea2
- second valuea3
- third valuea4
- fourth valuepublic <T> T parse(String str, DoubleFunction1N<T> fn)
T
- function return typestr
- the string to be parsedfn
- function that will be passed the parsed tuple valuesfn
IllegalArgumentException
- if the input string format is invalidpublic <T> T parse(String str, DoubleFunction2N<T> fn)
T
- function return typestr
- the string to be parsedfn
- function that will be passed the parsed tuple valuesfn
IllegalArgumentException
- if the input string format is invalidpublic <T> T parse(String str, DoubleFunction3N<T> fn)
T
- function return typestr
- the string to be parsedfn
- function that will be passed the parsed tuple valuesfn
IllegalArgumentException
- if the input string format is invalidpublic static SimpleTupleFormat getDefault()
"(1.0)" "(1.0, 2.0)" "(1.0, 2.0, 3.0)"
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.