public final class Scalar extends Object
Loading and saving scalars...
public static int getStringScalar(String[] args) {
String name = args[0];
String contents = Scalar.getString(name);
// equivalent to: Scalar.getString(name, Scalar.TYPE_GLOBAL);
SFIToolkit.displayln(name + " = " + contents);
return 0;
}
public static int setStringScalar(String[] args) {
String name = args[0];
String contents = args[1];
int rc = Scalar.setString(name, contents);
// equivalent to: Scalar.setString(name, contents, Scalar.TYPE_GLOBAL);
return rc;
}
public static int getScalar(String[] args) {
String name = args[0];
Double contents = Scalar.getValue(name);
SFIToolkit.displayln(name + " = " + contents);
return 0;
}
public static int setScalar(String[] args) {
String name = args[0];
Double value = Double.parseDouble(args[1]);
int rc = Scalar.setValue(name, value);
return rc;
}
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_CRETURN |
static int |
TYPE_ERETURN |
static int |
TYPE_GLOBAL |
static int |
TYPE_RETURN |
static int |
TYPE_RRETURN |
static int |
TYPE_SRETURN |
static int |
VTYPE_HIDDEN |
static int |
VTYPE_HISTORICAL |
static int |
VTYPE_VISIBLE |
Modifier and Type | Method and Description |
---|---|
static String |
getString(String name)
Get the contents of a Stata string scalar.
|
static String |
getString(String name,
int type)
Get the contents of a Stata string scalar.
|
static Double |
getValue(String name)
Get the contents of a Stata scalar.
|
static Double |
getValue(String name,
int type)
Get the contents of a Stata scalar.
|
static int |
setString(String name,
String value)
Set the contents of a Stata string scalar.
|
static int |
setString(String name,
String value,
int type)
Set the contents of a Stata string scalar.
|
static int |
setValue(String name,
double val)
Set the value of a Stata scalar.
|
static int |
setValue(String name,
double value,
int type)
Set the value of a Stata scalar.
|
static int |
setValue(String name,
double value,
int type,
int vtype)
Set the value of a Stata scalar.
|
static int |
setValue(String name,
double value,
int type,
String version)
Set the value of a Stata scalar.
|
public static final int TYPE_GLOBAL
public static final int TYPE_RETURN
public static final int TYPE_RRETURN
public static final int TYPE_ERETURN
public static final int TYPE_CRETURN
public static final int TYPE_SRETURN
public static final int VTYPE_VISIBLE
public static final int VTYPE_HIDDEN
public static final int VTYPE_HISTORICAL
public static Double getValue(String name)
name
- Name of the scalar.public static Double getValue(String name, int type)
name
- Name of the scalar.type
- Type of the scalar; may be
TYPE_GLOBAL
, TYPE_RETURN
,
TYPE_RRETURN
, TYPE_ERETURN
,
or TYPE_CRETURN
.public static int setValue(String name, double val)
name
- Name of the scalar.val
- Value to store in the scalar.public static int setValue(String name, double value, int type)
name
- Name of the scalar.value
- Value to store in the scalar.type
- Type of the scalar; may be
TYPE_GLOBAL
, TYPE_RETURN
,
TYPE_RRETURN
, or TYPE_ERETURN
.public static int setValue(String name, double value, int type, int vtype)
name
- Name of the scalar.value
- Value to store in the scalar.type
- Type of the scalar; may be
TYPE_GLOBAL
, TYPE_RETURN
,
TYPE_RRETURN
, or TYPE_ERETURN
.vtype
- If the scalar is a type of return value,
sets whether the return value is
VTYPE_VISIBLE
, VTYPE_HIDDEN
,
or VTYPE_HISTORICAL
.
This parameter is ignored with TYPE_GLOBAL
.public static int setValue(String name, double value, int type, String version)
name
- Name of the scalar.value
- Value to store in the scalar.type
- Type of the scalar; may be
TYPE_GLOBAL
, TYPE_RETURN
,
TYPE_RRETURN
, or TYPE_ERETURN
.version
- If the scalar is a type of return value,
sets the release number in the form
#[#][.[#[#]]]
for a return result. This parameter is ignored
with TYPE_GLOBAL
.public static String getString(String name)
name
- Name of the scalar.public static int setString(String name, String value)
name
- Name of the scalar.value
- Value to store in the scalar.public static String getString(String name, int type)
name
- Name of the scalar.type
- Type of the scalar; may be
TYPE_GLOBAL
or TYPE_CRETURN
.public static int setString(String name, String value, int type)
name
- Name of the scalar.value
- Value to store in the scalar.type
- Type of the scalar; may be TYPE_GLOBAL
.