adams.data.instance
Class InstanceUtils

java.lang.Object
  extended by adams.data.container.DataContainerUtils
      extended by adams.data.instance.InstanceUtils

public class InstanceUtils
extends DataContainerUtils

Utility class for instances.

Version:
$Revision: 4605 $
Author:
fracpete (fracpete at waikato dot ac dot nz)

Nested Class Summary
 
Nested classes/interfaces inherited from class adams.data.container.DataContainerUtils
DataContainerUtils.GapFilling
 
Field Summary
protected static InstancePointComparator m_Comparator
          comparator for finding X values.
 
Constructor Summary
InstanceUtils()
           
 
Method Summary
static int findClosestX(List<InstancePoint> points, int x)
          Returns the index in m_Points closest to the given x value.
static int[] findEnclosingXs(List<InstancePoint> points, int x)
          Returns the indices of points in m_Points that enclose the given x value.
static int findX(List<InstancePoint> points, InstancePoint p)
          Returns the index in m_Points of the given sequence point.
static int findX(List<InstancePoint> points, int x)
          Returns the index in m_Points of the given x value.
static InstancePointComparator getComparator()
          Returns the comparator used for finding X values.
static double[] toDoubleArray(Instance c)
          Returns the points as double array.
static double[] toDoubleArray(List<InstancePoint> data)
          Returns the points as double array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Comparator

protected static InstancePointComparator m_Comparator
comparator for finding X values.

Constructor Detail

InstanceUtils

public InstanceUtils()
Method Detail

getComparator

public static InstancePointComparator getComparator()
Returns the comparator used for finding X values.

Returns:
the comparator

findX

public static int findX(List<InstancePoint> points,
                        InstancePoint p)
Returns the index in m_Points of the given sequence point.

Parameters:
points - the data to process
p - the point to get the index for
Returns:
the index

findX

public static int findX(List<InstancePoint> points,
                        int x)
Returns the index in m_Points of the given x value.

Parameters:
points - the data to process
x - the x value to get the index for
Returns:
the index

findClosestX

public static int findClosestX(List<InstancePoint> points,
                               int x)
Returns the index in m_Points closest to the given x value.

Parameters:
points - the data to process
x - the x value to get the closest index for
Returns:
the index

findEnclosingXs

public static int[] findEnclosingXs(List<InstancePoint> points,
                                    int x)
Returns the indices of points in m_Points that enclose the given x value. If the given x value happens to be an exact point, then this points will be stored at index 0. If no index could be determined, then -1 will be stored.

Parameters:
points - the data to process
x - the x value to get the enclosing indices for
Returns:
the indices

toDoubleArray

public static double[] toDoubleArray(Instance c)
Returns the points as double array.

Parameters:
c - the instance to turn into a double array
Returns:
the points as double array

toDoubleArray

public static double[] toDoubleArray(List<InstancePoint> data)
Returns the points as double array.

Parameters:
data - the instance points to turn into a double array
Returns:
the points as double array


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.