SSJ
V. 2.6.

umontreal.iro.lecuyer.hups
Class SubsetOfPointSet

java.lang.Object
  extended by umontreal.iro.lecuyer.hups.PointSet
      extended by umontreal.iro.lecuyer.hups.SubsetOfPointSet

public class SubsetOfPointSet
extends PointSet

This container class permits one to select a subset of a point set. This is done by selecting a range or providing an array of either point or coordinate indices. A typical application of a range selection is to make the number of points or the dimension finite. It is also possible to provide, for example, a random permutation in the selection of components. It is possible also to take projections of coordinates for selected dimensions.

Selecting a new subset of points or coordinates overwrites the previous selection. The specification of a subset with respect to the points is independent from selecting a subset with respect to the coordinates. The number of points and the dimension are adapted to the current selection and all indices still start from 0, i.e., the subset works just like an ordinary point set.

When the points or coordinates ranges are changed, existing iterators become invalid. They should be reconstructed or reset to avoid inconsistencies.


Constructor Summary
SubsetOfPointSet(PointSet P)
          Constructs a new PointSet object, initially identical to P, and from which a subset of the points and/or a subset of the coordinates is to be extracted.
 
Method Summary
 double getCoordinate(int i, int j)
          Returns ui, j, the coordinate j of the point i.
 PointSetIterator iterator()
          Constructs and returns a point set iterator.
 void selectCoordinates(int[] coordIndices, int numCoord)
          Selects the numCoord coordinates whose numbers are provided in the array coordIndices.
 void selectCoordinatesRange(int from, int to)
          Selects the coordinates from ``from'' to ``to - 1'' from the original point set.
 void selectPoints(int[] pointIndices, int numPoints)
          Selects the numPoints points whose numbers are provided in the array pointIndices.
 void selectPointsRange(int from, int to)
          Selects the points numbered from ``from'' to ``to - 1'' from the original point set.
 String toString()
          Formats a string that contains information about the point set.
 
Methods inherited from class umontreal.iro.lecuyer.hups.PointSet
addRandomShift, addRandomShift, addRandomShift, addRandomShift, clearRandomShift, formatPoints, formatPoints, formatPoints, formatPoints, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsNumbered, formatPointsNumbered, getDimension, getNumPoints, getStream, randomize, randomize, randomize, randomize, randomize, setStream, unrandomize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubsetOfPointSet

public SubsetOfPointSet(PointSet P)
Constructs a new PointSet object, initially identical to P, and from which a subset of the points and/or a subset of the coordinates is to be extracted.

Parameters:
P - point set for which a subset is constructed
Method Detail

selectPointsRange

public void selectPointsRange(int from,
                              int to)
Selects the points numbered from ``from'' to ``to - 1'' from the original point set.

Parameters:
from - index of the point, in the contained point set, corresponding to the point 0 of this point set
to - index of the last point taken from the contained point set

selectPoints

public void selectPoints(int[] pointIndices,
                         int numPoints)
Selects the numPoints points whose numbers are provided in the array pointIndices.

Parameters:
pointIndices - array of point indices to be selected
numPoints - number of points in the subset of point set

selectCoordinatesRange

public void selectCoordinatesRange(int from,
                                   int to)
Selects the coordinates from ``from'' to ``to - 1'' from the original point set.

Parameters:
from - index of the coordinate, in the contained point set, corresponding to the coordinate 0 of each point of this point set
to - index of the last coordinate taken for each point from the contained point set

selectCoordinates

public void selectCoordinates(int[] coordIndices,
                              int numCoord)
Selects the numCoord coordinates whose numbers are provided in the array coordIndices.

Parameters:
coordIndices - array of coordinate indices to be selected
numCoord - number of coordinatess for each point in the subset of point set

getCoordinate

public double getCoordinate(int i,
                            int j)
Description copied from class: PointSet
Returns ui, j, the coordinate j of the point i.

Specified by:
getCoordinate in class PointSet
Parameters:
i - index of the point to look for
j - index of the coordinate to look for
Returns:
the value of ui, j

iterator

public PointSetIterator iterator()
Description copied from class: PointSet
Constructs and returns a point set iterator. The default implementation returns an iterator that uses the method getCoordinate (i,j) to iterate over the points and coordinates, but subclasses can reimplement it for better efficiency.

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

toString

public String toString()
Description copied from class: PointSet
Formats a string that contains information about the point set.

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

SSJ
V. 2.6.

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