public class PythonVariables extends Object implements Serializable
Constructor and Description |
---|
PythonVariables() |
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
PythonType type) |
void |
add(String name,
PythonType type,
Object value) |
void |
addBool(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addBool(String name,
boolean value)
Add a boolean variable to
the set of variables
|
void |
addBytes(String name) |
void |
addBytes(String name,
org.bytedeco.javacpp.BytePointer value) |
void |
addDict(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addDict(String name,
Map value)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addFloat(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addFloat(String name,
double value)
Add a double variable to
the set of variables
|
void |
addFloat(String name,
float value)
Add a float variable to
the set of variables
|
void |
addInt(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addInt(String name,
int value)
Add an int variable to
the set of variables
|
void |
addInt(String name,
long value)
Add a long variable to
the set of variables
|
void |
addList(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addList(String name,
Object[] value)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addNDArray(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addNDArray(String name,
INDArray value)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addNDArray(String name,
NumpyArray value)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addStr(String name)
Add a null variable to
the set of variables
to describe the type but no value
|
void |
addStr(String name,
String value)
Add a string variable to
the set of variables
|
PythonVariables |
copySchema()
Returns a copy of the variable
schema in this array without the values
|
static PythonVariables |
fromJSON(org.json.JSONArray jsonArray)
Get the python variable state relative to the
input json array
|
boolean |
getBooleanValue(String name)
Returns a boolean variable with the given name.
|
org.bytedeco.javacpp.BytePointer |
getBytesValue(String name) |
Map<?,?> |
getDictValue(String name) |
Double |
getFloatValue(String name) |
Long |
getIntValue(String name) |
List |
getListValue(String name) |
INDArray |
getNDArrayValue(String name) |
String |
getStrValue(String name)
/**
|
PythonType |
getType(String name)
Returns the type for the given variable name
|
Object |
getValue(String name)
Do a general object lookup.
|
String[] |
getVariables()
Get all the variables present as a string array
|
boolean |
isEmpty() |
static PythonVariables |
schemaFromMap(Map<String,String> inputTypes)
Create a schema from a map.
|
void |
setValue(String name,
Object value) |
org.json.JSONArray |
toJSON()
This variables set as its json representation (an array of json objects)
|
public PythonVariables copySchema()
public boolean isEmpty()
public void add(String name, PythonType type)
name
- Name of the variabletype
- Type of the variablepublic void add(String name, PythonType type, Object value) throws PythonException
name
- name of the variabletype
- type of the variablevalue
- value of the variable (must be instance of expected type)PythonException
public void addDict(String name)
name
- the field to addpublic void addBool(String name)
name
- the field to addpublic void addStr(String name)
name
- the field to addpublic void addInt(String name)
name
- the field to addpublic void addFloat(String name)
name
- the field to addpublic void addNDArray(String name)
name
- the field to addpublic void addList(String name)
name
- the field to addpublic void addBool(String name, boolean value)
name
- the field to addvalue
- the value to addpublic void addStr(String name, String value)
name
- the field to addvalue
- the value to addpublic void addInt(String name, int value)
name
- the field to addvalue
- the value to addpublic void addInt(String name, long value)
name
- the field to addvalue
- the value to addpublic void addFloat(String name, double value)
name
- the field to addvalue
- the value to addpublic void addFloat(String name, float value)
name
- the field to addvalue
- the value to addpublic void addNDArray(String name, NumpyArray value)
name
- the field to addvalue
- the value to addpublic void addNDArray(String name, INDArray value)
name
- the field to addvalue
- the value to addpublic void addList(String name, Object[] value)
name
- the field to addvalue
- the value to addpublic void addDict(String name, Map value)
name
- the field to addvalue
- the value to addpublic void addBytes(String name)
public void addBytes(String name, org.bytedeco.javacpp.BytePointer value)
public void setValue(String name, Object value) throws PythonException
name
- name of the variablevalue
- new value for the variablePythonException
public Object getValue(String name)
PythonType
of variable is described in thename
- the name of the variable to getpublic boolean getBooleanValue(String name)
name
- the variable name to get the value forpublic Map<?,?> getDictValue(String name)
name
- the variable namepublic String getStrValue(String name)
name
- the variable namepublic Long getIntValue(String name)
name
- the variable namepublic Double getFloatValue(String name)
name
- the variable namepublic INDArray getNDArrayValue(String name)
name
- the variable namepublic List getListValue(String name)
name
- the variable namepublic org.bytedeco.javacpp.BytePointer getBytesValue(String name)
name
- the variable namepublic PythonType getType(String name)
name
- the name of the variable to get the type forpublic String[] getVariables()
public org.json.JSONArray toJSON()
public static PythonVariables schemaFromMap(Map<String,String> inputTypes) throws Exception
inputTypes
- the input types to convertException
public static PythonVariables fromJSON(org.json.JSONArray jsonArray)
jsonArray
- the input json arrayCopyright © 2020. All rights reserved.