SSJ
V. labo.

umontreal.iro.lecuyer.hups
Class SortedPointSet

java.lang.Object
  extended by umontreal.iro.lecuyer.hups.PointSet
      extended by umontreal.iro.lecuyer.hups.CachedPointSet
          extended by umontreal.iro.lecuyer.hups.SortedPointSet

public class SortedPointSet
extends CachedPointSet

************ Cette classe est trop particulière au problème d'Adam pour être incluse dans le HUPS public. Ne pas la recopier pour distribution hors du labo. ************

This container class builds a sorted point set based on some given original point set. Both point sets may have the same number of points, but the dimension of the sorted point set is smaller than the dimension of the original point set. Some of the coordinates of the original point set are used for sorting the points according to a MultiDimSort, and the remaining coordinates define the sorted point set, where the points are in the new sorted order.

If the original point set has dimension d0 and the MultiDimSort sorts in ds dimensions, then the sorted point set has dimension (d0 - ds). The MultiDimSort is applied on the first ds coordinates of the original point set and the remaining coordinates belong to the sorted point set.

When a SortedPointSet is randomized, the randomization is applied to the original point set, but the changes over the first ds coordinates are ignored, such that the point ordering between the original point set and the sorted point set is unchanged. The remaining randomized coordinates of the original used become the new values of the SortedPointSet.

All points of a SortedPointSet are held in memory, which could be problematic for a large point set.


Constructor Summary
SortedPointSet(PointSet P, int n, int dim, MultiDimSort sort)
          Takes the first dim coordinates of the first n points of P and creates a SortedPointSet from these points by sorting them according to sort.
SortedPointSet(PointSet P, MultiDimSort sort)
          Creates a new SortedPointSet storing the points of P and sorting them according to sort.
 
Method Summary
 void addRandomShift(int d1, int d2, RandomStream stream)
          Add the shift to the contained point set.
 int getDimension()
          Returns the number of coordinates of each point, which is the dimension of the original point set minus the dimension of the sort.
 MultiDimSort getSort()
          Returns the sort used.
 PointSetIterator iterator()
          Constructs and returns a point set iterator which gets the values directly from the array.
 void randomize(PointSetRandomization rand)
          Randomizes the contained point set using rand.
 String toString()
          Formats a string that contains the information about the point set.
 
Methods inherited from class umontreal.iro.lecuyer.hups.CachedPointSet
getCoordinate
 
Methods inherited from class umontreal.iro.lecuyer.hups.PointSet
addRandomShift, addRandomShift, addRandomShift, clearRandomShift, formatPoints, formatPoints, formatPoints, formatPoints, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsNumbered, formatPointsNumbered, getNumPoints, getStream, randomize, randomize, randomize, randomize, setStream, unrandomize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedPointSet

public SortedPointSet(PointSet P,
                      int n,
                      int dim,
                      MultiDimSort sort)
Takes the first dim coordinates of the first n points of P and creates a SortedPointSet from these points by sorting them according to sort. If sort is a MultiDimSort of dimension ds, then the ordering of the points is determined from this sort acting on the first ds coordinates of the original subset. The dimension of the resulting SortedPointSet is (dim- ds).

Parameters:
P - point set to be cached
n - number of points from P to use
dim - dimension to use for the points of P, before sorting.
sort - MultiDimSort to use for sorting

SortedPointSet

public SortedPointSet(PointSet P,
                      MultiDimSort sort)
Creates a new SortedPointSet storing the points of P and sorting them according to sort. Both the number of points and their dimension must be finite.

Parameters:
P - point set to be cached
sort - MultiDimSort to use for sorting
Method Detail

getDimension

public int getDimension()
Returns the number of coordinates of each point, which is the dimension of the original point set minus the dimension of the sort.

Overrides:
getDimension in class PointSet
Returns:
the dimension of the point set or Integer.MAX_VALUE if it is infinite

getSort

public MultiDimSort getSort()
Returns the sort used.


iterator

public PointSetIterator iterator()
Constructs and returns a point set iterator which gets the values directly from the array.

Overrides:
iterator in class PointSet
Returns:
point set iterator for the point set

addRandomShift

public void addRandomShift(int d1,
                           int d2,
                           RandomStream stream)
Add the shift to the contained point set.

Overrides:
addRandomShift in class CachedPointSet

randomize

public void randomize(PointSetRandomization rand)
Randomizes the contained point set using rand.

Overrides:
randomize in class CachedPointSet
Parameters:
rand - PointSetRandomization to use

toString

public String toString()
Formats a string that contains the information about the point set.

Overrides:
toString in class CachedPointSet
Returns:
string representation of the point set information

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.