Class VariableNumber

java.lang.Object
jwat.VariableNumber
All Implemented Interfaces:
JWATConstants
Direct Known Subclasses:
VariableDate, VariableString

public class VariableNumber extends Object implements JWATConstants
Description: This class represents a single variable which contains numerical values. It provides statistics information and variable transofrmations and sampling operations
Author:
Brambilla Davide Matr 667986, Fumagalli Claudio 667971 Created: 1-ago-2006 Modified: 27-dec-2006
  • Field Details

  • Constructor Details

    • VariableNumber

      public VariableNumber(Observation[] valObs, String vName, int pos, short type, VariableMapping varMapping)
      Constructor, creates new numerical variable.
      Parameters:
      valObs - list of observations already sorted by this variable
      vName - variable's name
      pos - variable's positione in observation
      varMapping - mapping object (null)
  • Method Details

    • getMapping

      public VariableMapping getMapping()
    • getValue

      public double getValue(int Index) throws ArrayIndexOutOfBoundsException
      Returns Index-th value of the variable
      Parameters:
      Index - index of variable's value desired
      Returns:
      value of Index-th value
      Throws:
      ArrayIndexOutOfBoundsException - throws if Index is < 0 or > numbero of observations
    • getValue

      public double getValue(int Index, int var) throws ArrayIndexOutOfBoundsException
      Returns the index-th value of the var-th variable of the observaion
      Parameters:
      Index - index of variable's value desired
      var - variable index
      Returns:
      index-th value of the var-th variable
      Throws:
      ArrayIndexOutOfBoundsException - throws if Index is < 0 or > numbero of observations or var < 0 or > number of variables ( elements of observation )
    • getUniStats

      public UnivariateStatistics getUniStats()
      Returns object holding current univariate variable statistics
      Returns:
      univariateStatistics
    • getQuantile

      public double getQuantile(int ind)
      Returns element corresponding to the ind quantile
      Parameters:
      ind - quantile
      Returns:
      element corresponding to the ind quantile
    • Size

      public int Size()
      Returns number of observations
      Returns:
      number of observations
    • getIndex

      public int getIndex()
      Returns variable's index
      Returns:
      variable's index
    • getName

      public String getName()
      Return variable's name
      Returns:
      variable's name
    • getType

      public short getType()
      Returns variable's type
      Returns:
      variable's type
    • doTransformation

      public void doTransformation(int index) throws TrasformException
      Perform one of the transformations
      Parameters:
      index - transformation to apply
      Throws:
      TrasformException - throws if it is not possible to apply transformation
    • undoLastTrasf

      public boolean undoLastTrasf()
      Undo last transformation applied to variable if exists
    • getTrasfName

      public static String[] getTrasfName()
      Returns names of transformations
      Returns:
      Array of transformation's names
    • getTrasfStr

      public String getTrasfStr()
      Returns the trasf str.
      Returns:
    • getDimInt

      public double getDimInt()
    • getNumeroObsPerInt

      public int getNumeroObsPerInt()
    • getStartInt

      public int getStartInt(int j)
    • getEndInt

      public int getEndInt(int j)
    • getIntValue

      public double getIntValue(int Index)
      Returns the value relative to the pos index of the range array
      Parameters:
      Index - Range array index
      Returns:
      Return of the real value at a limit of the range
    • getIntValueG

      public double getIntValueG(int Index)
      Returns the value relative to the pos index of the range array
      Parameters:
      Index - Range array index
      Returns:
      Return of the real value at a limit of the range
    • setRangeIntervallo

      public void setRangeIntervallo(int min, int max, double minv, double maxv, int n)
      Setting to search for points within a range for the plot
      Parameters:
      min - Range lower bound as range array index
      max - Range upper bound as range array index
      minv - Lower bound as the value of the companion variable of the scatter plot
      maxv - Upper limit as the value of the companion variable of the scatter plot
      n - Position of the companion variable in the scatter plot in the observations
    • getNextInt

      public int getNextInt() throws Exception
      Returns the next index if there is an observation to plot that matches the restrictions set with setRangeQuantili
      Returns:
      index that satisfies the conditions
      Throws:
      Exception - if the operation cannot be completed
    • getIntRange

      public double getIntRange(int min, int max)
      Returns the range between interval positions
      Parameters:
      min - minimum position of the range
      max - maximum position of the interval
      Returns:
      range between the two intervals
    • getIntRangeG

      public double getIntRangeG(int min, int max)
      Returns the range between interval positions
      Parameters:
      min - minimum position of the range
      max - maximum position of the interval
      Returns:
      range between the two intervals
    • getIndex

      public int getIndex(double value)
      NOT USED INCORRECT Returns the range array
      Returns:
      vector containing the positions of the variables that delimit the intervals
    • getIndexMin

      public int getIndexMin(double value)
    • getIndexMax

      public int getIndexMax(double value)
    • getInterval1000

      public int[] getInterval1000()
    • applySampling

      public int applySampling(FilterOnVariable filter)
      Applies filter to variable
      Parameters:
      filter -
      Returns:
    • updateOnSampling

      public void updateOnSampling(int size)
      Sync variable respect with another variable sampling
      Parameters:
      size -
    • undoSampling

      public void undoSampling()
    • resetSampling

      public void resetSampling()
    • isSampled

      public boolean isSampled()
    • getCurObs

      public Observation[] getCurObs()
    • getObsID

      public int getObsID(int Index)
    • getNumOfTransf

      public int getNumOfTransf()
    • doClusteringTrasformation

      public void doClusteringTrasformation(int index)
    • undoClueringTrasformation

      public void undoClueringTrasformation()