SSJ
V. 2.6.

umontreal.iro.lecuyer.hups
Class CycleBasedPointSet.CycleBasedPointSetIterator

java.lang.Object
  extended by umontreal.iro.lecuyer.hups.CycleBasedPointSet.CycleBasedPointSetIterator
All Implemented Interfaces:
PointSetIterator, RandomStream
Direct Known Subclasses:
CycleBasedPointSetBase2.CycleBasedPointSetBase2Iterator
Enclosing class:
CycleBasedPointSet

public class CycleBasedPointSet.CycleBasedPointSetIterator
extends Object


Constructor Summary
CycleBasedPointSet.CycleBasedPointSetIterator()
           
 
Method Summary
 String formatState()
           
 boolean hasNextCoordinate()
          Returns true if the current point has another coordinate.
 double nextCoordinate()
          Returns the current coordinate ui, j and advances to the next one.
 void nextCoordinates(double[] p, int dim)
          Returns the next d coordinates of the current point in p and advances the current coordinate index by d.
 double nextDouble()
          Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), using this stream, after advancing its state by one step.
 int nextPoint(double[] p, int dim)
          Returns the first d coordinates of the current point in p, advances to the next point, and returns the index of the new current point.
 void resetCurCoordIndex()
          Equivalent to setCurCoordIndex (0).
 void resetCurCycle(int index)
           
 void resetCurPointIndex()
          Equivalent to setCurPointIndex (0).
 int resetToNextPoint()
          Increases the current point index by 1 and returns its new value.
 void setCurCoordIndex(int i)
          Sets the current coordinate index to j, so that the next calls to nextCoordinate or nextCoordinates will return the values ui, j, ui, j+1,..., where i is the index of the current point.
 void setCurPointIndex(int i)
          Resets the current point index to i and the current coordinate index to zero.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface umontreal.iro.lecuyer.rng.RandomStream
toString
 

Constructor Detail

CycleBasedPointSet.CycleBasedPointSetIterator

public CycleBasedPointSet.CycleBasedPointSetIterator()
Method Detail

resetCurCycle

public void resetCurCycle(int index)

setCurCoordIndex

public void setCurCoordIndex(int i)
Description copied from interface: PointSetIterator
Sets the current coordinate index to j, so that the next calls to nextCoordinate or nextCoordinates will return the values ui, j, ui, j+1,..., where i is the index of the current point.

Specified by:
setCurCoordIndex in interface PointSetIterator
Parameters:
i - index of the new current coordinate

resetCurCoordIndex

public void resetCurCoordIndex()
Description copied from interface: PointSetIterator
Equivalent to setCurCoordIndex (0).

Specified by:
resetCurCoordIndex in interface PointSetIterator

hasNextCoordinate

public boolean hasNextCoordinate()
Description copied from interface: PointSetIterator
Returns true if the current point has another coordinate. This can be useful for testing if coordinates are still available.

Specified by:
hasNextCoordinate in interface PointSetIterator
Returns:
true if the current point has another coordinate

nextDouble

public double nextDouble()
Description copied from interface: RandomStream
Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), using this stream, after advancing its state by one step. The generators programmed in SSJ never return the values 0 or 1.

Specified by:
nextDouble in interface RandomStream
Returns:
the next generated uniform

nextCoordinate

public double nextCoordinate()
Description copied from interface: PointSetIterator
Returns the current coordinate ui, j and advances to the next one. If no current coordinate is available (either because the current point index has reached the number of points or because the current coordinate index has reached the number of dimensions), it throws a NoSuchElementException.

Specified by:
nextCoordinate in interface PointSetIterator
Returns:
value of the current coordinate

nextCoordinates

public void nextCoordinates(double[] p,
                            int dim)
Description copied from interface: PointSetIterator
Returns the next d coordinates of the current point in p and advances the current coordinate index by d. If the remaining number of coordinates is too small, a NoSuchElementException is thrown, as in nextCoordinate.

Specified by:
nextCoordinates in interface PointSetIterator
Parameters:
p - array to be filled with the coordinates, starting at index 0
dim - number of coordinates to get

setCurPointIndex

public void setCurPointIndex(int i)
Description copied from interface: PointSetIterator
Resets the current point index to i and the current coordinate index to zero. If i is larger or equal to the number of points, an exception will not be raised here, but only later if we ask for a new coordinate or point.

Specified by:
setCurPointIndex in interface PointSetIterator
Parameters:
i - new index of the current point

resetCurPointIndex

public void resetCurPointIndex()
Description copied from interface: PointSetIterator
Equivalent to setCurPointIndex (0).

Specified by:
resetCurPointIndex in interface PointSetIterator

resetToNextPoint

public int resetToNextPoint()
Description copied from interface: PointSetIterator
Increases the current point index by 1 and returns its new value. If there is no more point, an exception will be raised only if we ask for a new coordinate or point later on.

Specified by:
resetToNextPoint in interface PointSetIterator
Returns:
index of the new current point

nextPoint

public int nextPoint(double[] p,
                     int dim)
Description copied from interface: PointSetIterator
Returns the first d coordinates of the current point in p, advances to the next point, and returns the index of the new current point. Even if the current coordinate index is 0, the point returned starts from coordinate 0. After obtaining the last point via this method, the current point index (returned by the method) is equal to the number of points, so it is no longer a valid point index. An exception will then be raised if we attempt to generate additional points or coordinates.

Specialized implementations of this method often allow for increased efficiency, e.g., for cycle-based point sets where the cycles (but not the points) are stored explicitly or for digital nets by allowing non-incremental point enumerations via Gray-code counters.

Specified by:
nextPoint in interface PointSetIterator
Parameters:
p - array to be filled with the coordinates, starting from array index 0
dim - number of coordinates to return
Returns:
index of the new current point

formatState

public String formatState()

SSJ
V. 2.6.

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