net.obsearch.dimension
Class DimensionInt

java.lang.Object
  extended by net.obsearch.dimension.AbstractDimension
      extended by net.obsearch.dimension.DimensionInt
All Implemented Interfaces:
Comparable<DimensionInt>

public class DimensionInt
extends AbstractDimension
implements Comparable<DimensionInt>

DimensionInt Stores objects of type int.

Author:
Arnoldo Jose Muller Molina

Constructor Summary
DimensionInt(int position, int value)
          Creates a new DimensionInt object.
 
Method Summary
 int compareTo(DimensionInt other)
          Compares this object with other.
static int euclidean(int[] a, int[] b)
          Calculates the euc distance for two tuples
static int[] getBasicTuple(OBInt[] pivots, OBInt object)
          Creates a int array from the given pivots and the given object.
static int[] getPrimitiveTuple(long[] pivots, long objectId, Index<? extends OBInt> index)
          Calculates the smap tuple for the given objectId, and the given pivots
static int[] getPrimitiveTuple(OBInt[] pivots, OBInt object)
          Calculates the smap tuple for the given objectId, and the given pivots
static DimensionInt[] getTuple(long[] pivots, long objectId, Index<? extends OBInt> index)
          Creates a dimension array from the given pivots and the given object id.
static DimensionInt[] getTuple(OBInt[] pivots, OBInt object)
          Creates a dimension array from the given pivots and the given object.
 int getValue()
           
static int lInfinite(int[] a, int[] b)
          Calculates L-inf for two int tuples.
static int minDistance(List<Long> objects, Index<OBInt> index)
          Calculate the minimum distance of the given objects (all objects compared against all objects)
static long[] select(int k, Random r, cern.colt.list.LongArrayList source, Index<OBInt> index, cern.colt.list.LongArrayList excludes, int minDistance)
          Selects k random elements from the given source.
static DimensionInt[] transformPrimitiveTuple(int[] tuple)
          Transform the given primitive tuple into a Dimension tuple.
 
Methods inherited from class net.obsearch.dimension.AbstractDimension
getOrder, mapId, max, select
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimensionInt

public DimensionInt(int position,
                    int value)
Creates a new DimensionInt object.

Parameters:
position - The position of this dimension.
value - The value of this dimension.
Method Detail

getTuple

public static DimensionInt[] getTuple(OBInt[] pivots,
                                      OBInt object)
                               throws IllegalIdException,
                                      IllegalAccessException,
                                      InstantiationException,
                                      OBException
Creates a dimension array from the given pivots and the given object.

Parameters:
pivots - The pivots used for the embedding.
object - The object to be projected.
Returns:
A new dimension array.
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

select

public static long[] select(int k,
                            Random r,
                            cern.colt.list.LongArrayList source,
                            Index<OBInt> index,
                            cern.colt.list.LongArrayList excludes,
                            int minDistance)
                     throws IllegalIdException,
                            OBException,
                            IllegalAccessException,
                            InstantiationException
Selects k random elements from the given source.

Parameters:
k - number of elements to select
r - Random object used to randomly select objects.
source - The source of item ids.
index - underlying index.
will - not add pivots included in excludes.
minDistance - The min distance required by the objects.
Returns:
The ids of selected objects.
Throws:
IllegalIdException
OBException
IllegalAccessException
InstantiationException

minDistance

public static int minDistance(List<Long> objects,
                              Index<OBInt> index)
                       throws IllegalIdException,
                              OBException,
                              IllegalAccessException,
                              InstantiationException
Calculate the minimum distance of the given objects (all objects compared against all objects)

Parameters:
objects -
Returns:
the min distance
Throws:
IllegalIdException
OBException
IllegalAccessException
InstantiationException

getBasicTuple

public static int[] getBasicTuple(OBInt[] pivots,
                                  OBInt object)
                           throws IllegalIdException,
                                  IllegalAccessException,
                                  InstantiationException,
                                  OBException
Creates a int array from the given pivots and the given object.

Parameters:
pivots - The pivots used for the embedding.
object - The object to be projected.
Returns:
A new int array.
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

getTuple

public static DimensionInt[] getTuple(long[] pivots,
                                      long objectId,
                                      Index<? extends OBInt> index)
                               throws IllegalIdException,
                                      IllegalAccessException,
                                      InstantiationException,
                                      OBException
Creates a dimension array from the given pivots and the given object id. Loads the objects from the DB.

Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

compareTo

public int compareTo(DimensionInt other)
Compares this object with other.

Specified by:
compareTo in interface Comparable<DimensionInt>

getValue

public int getValue()

getPrimitiveTuple

public static int[] getPrimitiveTuple(long[] pivots,
                                      long objectId,
                                      Index<? extends OBInt> index)
                               throws IllegalIdException,
                                      IllegalAccessException,
                                      InstantiationException,
                                      OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

transformPrimitiveTuple

public static DimensionInt[] transformPrimitiveTuple(int[] tuple)
Transform the given primitive tuple into a Dimension tuple.

Parameters:
tuple - The tuple that will be transformed.
Returns:
A DimensionInt of dimensions.

getPrimitiveTuple

public static int[] getPrimitiveTuple(OBInt[] pivots,
                                      OBInt object)
                               throws IllegalIdException,
                                      IllegalAccessException,
                                      InstantiationException,
                                      OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

lInfinite

public static int lInfinite(int[] a,
                            int[] b)
Calculates L-inf for two int tuples.

Parameters:
a - tuple
b - tuple
Returns:
L-infinite for a and b.

euclidean

public static int euclidean(int[] a,
                            int[] b)
Calculates the euc distance for two tuples

Parameters:
a - tuple
b - tuple
Returns:
L-infinite for a and b.


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.