public class InstancesHelper extends java.lang.Object implements VariableDeclarations, Macro, MacroDeclarations
setInstance(Instance) and setInstance(int) methods) as a1,
A1 or ATT1 etc where the number is the attribute index (starting with
1). Furthermore exposes the class value as CLASS.
Exposes the 'ismissing' macro which can only be applied to
instance values and returns whether the value is set as missing in the
current instance.| Constructor and Description |
|---|
InstancesHelper(Instances dataset)
Constructs an
InstancesHelper for the given dataset. |
InstancesHelper(Instances dataset,
boolean retainData)
Constructs an
InstancesHelper for the given dataset. |
| Modifier and Type | Method and Description |
|---|---|
Node |
evaluate(Node... params)
Evaluates the 'ismissing' macro
|
Macro |
getMacro(java.lang.String name)
Tries to fetch a macro
|
Node |
getVariable(java.lang.String name)
Tries to fetch a variable of an instance value
|
boolean |
hasMacro(java.lang.String name)
Whether the given macro is declared
|
boolean |
hasVariable(java.lang.String name)
Returns whether the variable is declared
|
boolean |
missingAccessed()
Whether a missing value has been evaluated during computation.
|
void |
setInstance(Instance instance)
Sets the current instance to be the supplied instance
|
void |
setInstance(int i)
Sets the instance at index i of the supplied dataset to be the current
instance
|
public InstancesHelper(Instances dataset)
InstancesHelper for the given dataset. Only attribute
information is retained in memory.dataset - the dataset whose attribute values should be exposedpublic InstancesHelper(Instances dataset, boolean retainData)
InstancesHelper for the given dataset.dataset - the datasetretainData - true if the full dataset (rather than just the attribute
information) is to be retainedpublic boolean hasMacro(java.lang.String name)
hasMacro in interface MacroDeclarationsname - name of the macropublic Macro getMacro(java.lang.String name)
MacroDeclarations applies here too.getMacro in interface MacroDeclarationsname - of the macropublic Node evaluate(Node... params) throws SemanticException
evaluate in interface Macroparams - the arguments for the macroSemanticExceptionpublic void setInstance(int i)
i - the index of the instance to be setjava.lang.UnsupportedOperationException - if the full dataset has not been
retained in memorypublic void setInstance(Instance instance)
instance - instance to be set as the current instancepublic boolean missingAccessed()
setInstance(int) or
setInstance(Instance) method is called.public boolean hasVariable(java.lang.String name)
hasVariable in interface VariableDeclarationsname - name of the variablepublic Node getVariable(java.lang.String name)
VariableDeclarations applies here too.getVariable in interface VariableDeclarationsname - name of the variable