Class InstanceImpl

    • Field Detail

      • weight

        protected double weight
        The weight.
      • instanceData

        protected InstanceData instanceData
        The instance data.
      • instanceHeader

        protected InstancesHeader instanceHeader
        The instance information.
    • Constructor Detail

      • InstanceImpl

        public InstanceImpl​(InstanceImpl inst)
        Instantiates a new instance.
        Parameters:
        inst - the inst
      • InstanceImpl

        public InstanceImpl​(double weight,
                            double[] res)
        Instantiates a new instance.
        Parameters:
        weight - the weight
        res - the res
      • InstanceImpl

        public InstanceImpl​(double weight,
                            double[] attributeValues,
                            int[] indexValues,
                            int numberAttributes)
        Instantiates a new instance.
        Parameters:
        weight - the weight
        attributeValues - the attribute values
        indexValues - the index values
        numberAttributes - the number attributes
      • InstanceImpl

        public InstanceImpl​(double weight,
                            InstanceData instanceData)
        Instantiates a new instance.
        Parameters:
        weight - the weight
        instanceData - the instance data
      • InstanceImpl

        public InstanceImpl​(int numAttributes)
        Instantiates a new instance.
        Parameters:
        numAttributes - the num attributes
    • Method Detail

      • weight

        public double weight()
        Weight.
        Specified by:
        weight in interface Instance
        Returns:
        the double
      • setWeight

        public void setWeight​(double weight)
        Sets the weight.
        Specified by:
        setWeight in interface Instance
        Parameters:
        weight - the new weight
      • attribute

        public Attribute attribute​(int instAttIndex)
        Attribute.
        Specified by:
        attribute in interface Instance
        Parameters:
        instAttIndex - the inst att index
        Returns:
        the attribute
      • indexOfAttribute

        public int indexOfAttribute​(Attribute attribute)
        Description copied from interface: Instance
        Index of an Attribute.
        Specified by:
        indexOfAttribute in interface Instance
        Parameters:
        attribute - the attribute to be found.
        Returns:
        the index of an attribute
      • deleteAttributeAt

        public void deleteAttributeAt​(int i)
        Delete attribute at.
        Specified by:
        deleteAttributeAt in interface Instance
        Parameters:
        i - the i
      • insertAttributeAt

        public void insertAttributeAt​(int i)
        Insert attribute at.
        Specified by:
        insertAttributeAt in interface Instance
        Parameters:
        i - the i
      • numAttributes

        public int numAttributes()
        Num attributes.
        Specified by:
        numAttributes in interface Instance
        Returns:
        the int
      • value

        public double value​(int instAttIndex)
        Value.
        Specified by:
        value in interface Instance
        Parameters:
        instAttIndex - the inst att index
        Returns:
        the double
      • isMissing

        public boolean isMissing​(int instAttIndex)
        Checks if is missing.
        Specified by:
        isMissing in interface Instance
        Parameters:
        instAttIndex - the inst att index
        Returns:
        true, if is missing
      • numValues

        public int numValues()
        Num values.
        Specified by:
        numValues in interface Instance
        Returns:
        the int
      • index

        public int index​(int i)
        Index.
        Specified by:
        index in interface Instance
        Parameters:
        i - the i
        Returns:
        the int
      • valueSparse

        public double valueSparse​(int i)
        Value sparse.
        Specified by:
        valueSparse in interface Instance
        Parameters:
        i - the i
        Returns:
        the double
      • isMissingSparse

        public boolean isMissingSparse​(int p)
        Checks if is missing sparse.
        Specified by:
        isMissingSparse in interface Instance
        Parameters:
        p - the p
        Returns:
        true, if is missing sparse
      • value

        public double value​(Attribute attribute)
        Value.
        Specified by:
        value in interface Instance
        Parameters:
        attribute - the attribute
        Returns:
        the double
      • stringValue

        public String stringValue​(int i)
        String value.
        Specified by:
        stringValue in interface Instance
        Parameters:
        i - the i
        Returns:
        the string
      • toDoubleArray

        public double[] toDoubleArray()
        To double array.
        Specified by:
        toDoubleArray in interface Instance
        Returns:
        the double[]
      • setValue

        public void setValue​(int numAttribute,
                             double d)
        Sets the value.
        Specified by:
        setValue in interface Instance
        Parameters:
        numAttribute - the num attribute
        d - the d
      • classValue

        public double classValue()
        Class value.
        Specified by:
        classValue in interface Instance
        Returns:
        the double
      • classIndex

        public int classIndex()
        Class index.
        Specified by:
        classIndex in interface Instance
        Returns:
        the int
      • numClasses

        public int numClasses()
        Num classes.
        Specified by:
        numClasses in interface Instance
        Returns:
        the int
      • classIsMissing

        public boolean classIsMissing()
        Class is missing.
        Specified by:
        classIsMissing in interface Instance
        Returns:
        true, if successful
      • setClassValue

        public void setClassValue​(double d)
        Sets the class value.
        Specified by:
        setClassValue in interface Instance
        Parameters:
        d - the new class value
      • copy

        public Instance copy()
        Copy.
        Specified by:
        copy in interface Instance
        Returns:
        the instance
      • setDataset

        public void setDataset​(Instances dataset)
        Sets the dataset.
        Specified by:
        setDataset in interface Instance
        Parameters:
        dataset - the new dataset
      • addSparseValues

        public void addSparseValues​(int[] indexValues,
                                    double[] attributeValues,
                                    int numberAttributes)
        Adds the sparse values.
        Specified by:
        addSparseValues in interface Instance
        Parameters:
        indexValues - the index values
        attributeValues - the attribute values
        numberAttributes - the number attributes
      • toString

        public String toString()
        Text representation of a InstanceImpl.
        Overrides:
        toString in class Object
      • numInputAttributes

        public int numInputAttributes()
        Description copied from interface: Instance
        Gets the number of input attributes.
        Specified by:
        numInputAttributes in interface Instance
        Returns:
        the number of input attributes
      • numOutputAttributes

        public int numOutputAttributes()
        Description copied from interface: Instance
        Gets the number of output attributes.
        Specified by:
        numOutputAttributes in interface Instance
        Returns:
        the number of output attributes
      • numberOutputTargets

        public int numberOutputTargets()
        Description copied from interface: Instance
        Gets the number of output attributes.
        Specified by:
        numberOutputTargets in interface Instance
        Returns:
        the number of output attributes
      • classValue

        public double classValue​(int instAttIndex)
        Description copied from interface: Instance
        Gets the value of an output attribute.
        Specified by:
        classValue in interface Instance
        Parameters:
        instAttIndex - the index
        Returns:
        the value
      • setClassValue

        public void setClassValue​(int indexClass,
                                  double valueAttribute)
        Description copied from interface: Instance
        Sets the value of an output attribute.
        Specified by:
        setClassValue in interface Instance
        Parameters:
        indexClass - the output attribute index
        valueAttribute - the value of the attribute
      • outputAttribute

        public Attribute outputAttribute​(int outputIndex)
        Description copied from interface: Instance
        Gets an output attribute given its index.
        Specified by:
        outputAttribute in interface Instance
        Parameters:
        outputIndex - the index
        Returns:
        the attribute
      • inputAttribute

        public Attribute inputAttribute​(int attributeIndex)
        Description copied from interface: Instance
        Gets an input attribute given its index.
        Specified by:
        inputAttribute in interface Instance
        Parameters:
        attributeIndex - the index
        Returns:
        the attribute
      • valueInputAttribute

        public double valueInputAttribute​(int attributeIndex)
        Description copied from interface: Instance
        Gets the value of an input attribute.
        Specified by:
        valueInputAttribute in interface Instance
        Parameters:
        attributeIndex - the index
        Returns:
        the value
      • valueOutputAttribute

        public double valueOutputAttribute​(int attributeIndex)
        Description copied from interface: Instance
        Gets the value of an output attribute.
        Specified by:
        valueOutputAttribute in interface Instance
        Parameters:
        attributeIndex - the index
        Returns:
        the value
      • setMissing

        public void setMissing​(int instAttIndex)
        Description copied from interface: Instance
        Sets an attribute as missing
        Specified by:
        setMissing in interface Instance
        Parameters:
        instAttIndex - , the attribute's index
      • setMissing

        public void setMissing​(Attribute attribute)
        Description copied from interface: Instance
        Sets an attribute as missing
        Specified by:
        setMissing in interface Instance
        Parameters:
        attribute - , the Attribute
      • isMissing

        public boolean isMissing​(Attribute attribute)
        Description copied from interface: Instance
        Checks if an attribute is missing.
        Specified by:
        isMissing in interface Instance
        Parameters:
        attribute - , the Attribute
        Returns:
        true, if is missing
      • setValue

        public void setValue​(Attribute attribute,
                             double value)
        Description copied from interface: Instance
        Sets the value of an attribute.
        Specified by:
        setValue in interface Instance
        Parameters:
        attribute - , the Attribute
        value - the value