dice.data
Interface Instance


public interface Instance

An Instance stores a data record in memory.

Author:
Zhang Xiatian
See Also:
Instances

Method Summary
 int getIndex()
          Get the position or index of
 int[] getIndexs()
          Get the index array of the values.
 Instances getInstances()
          Return the Instances hold the current Instance.
 double getValue(int attrId)
          Get the value of the assigned attribute.
 double[] getValues()
          Get the array holds the values of attributes of the Instance.
 void setIndexs(int[] indexs)
          Set the index array of the values.
 void setValue(int attrId, double value)
          Set the value of a attribute
 void setValues(double[] values)
          Set the value array
 

Method Detail

getValues

double[] getValues()
Get the array holds the values of attributes of the Instance. Note, for sparse storage form, the returned array is a compact model which only keep the non-zero (or any other default value) in the array. In order to determine the values belong to which attribute, you should to check the index array (can be gotten from getIndexs()) function.

Returns:
The value array.

getValue

double getValue(int attrId)
Get the value of the assigned attribute.

Parameters:
attrId - Attribute id.
Returns:
The value of the assined attribute.

setValues

void setValues(double[] values)
Set the value array

Parameters:
values - Value array.

setValue

void setValue(int attrId,
              double value)
Set the value of a attribute

Parameters:
attrId - Attribute id.
value - The value to be set.

getIndex

int getIndex()
Get the position or index of

Returns:
The index of current instance.

setIndexs

void setIndexs(int[] indexs)
Set the index array of the values. The index array is only used for sparse storage form.

Parameters:
indexs - Index array.

getIndexs

int[] getIndexs()
Get the index array of the values. The index array is only used for sparse storage form.

Returns:
The index array.

getInstances

Instances getInstances()
Return the Instances hold the current Instance.

Returns:
The Instances.